]> Creatis software - clitk.git/blob - itk/clitkSliceBySliceRelativePositionFilter.h
Ramove warnings with C++11
[clitk.git] / itk / clitkSliceBySliceRelativePositionFilter.h
1 /*=========================================================================
2   Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
3
4   Authors belong to: 
5   - University of LYON              http://www.universite-lyon.fr/
6   - Léon Bérard cancer center       http://oncora1.lyon.fnclcc.fr
7   - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
8
9   This software is distributed WITHOUT ANY WARRANTY; without even
10   the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11   PURPOSE.  See the copyright notices for more information.
12
13   It is distributed under dual licence
14
15   - BSD        See included LICENSE.txt file
16   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17   ======================================================================-====*/
18
19 #ifndef CLITKSLICEBYSLICERELATIVEPOSITIONFILTER_H
20 #define CLITKSLICEBYSLICERELATIVEPOSITIONFILTER_H
21
22 // clitk
23 #include "clitkFilterBase.h"
24 #include "clitkAddRelativePositionConstraintToLabelImageFilter.h"
25
26 namespace clitk {
27   
28   //--------------------------------------------------------------------
29   /*
30     Perform Relative Position filtering in a slice by slice manner. 
31   */
32   //--------------------------------------------------------------------
33   
34   template <class ImageType>
35   class ITK_EXPORT SliceBySliceRelativePositionFilter:
36     public AddRelativePositionConstraintToLabelImageFilter<ImageType>
37   {
38
39   public:
40     /** Standard class typedefs. */
41     typedef AddRelativePositionConstraintToLabelImageFilter<ImageType>   Superclass;
42     typedef SliceBySliceRelativePositionFilter              Self;
43     typedef itk::SmartPointer<Self>                         Pointer;
44     typedef itk::SmartPointer<const Self>                   ConstPointer;
45        
46     /** Method for creation through the object factory. */
47     itkNewMacro(Self);
48     
49     /** Run-time type information (and related methods). */
50     itkTypeMacro(SliceBySliceRelativePositionFilter, ImageToImageFilter);
51     FILTERBASE_INIT ITK_OVERRIDE;
52
53     /** ImageDimension constants */
54     itkStaticConstMacro(ImageDimension, unsigned int, ImageType::ImageDimension);
55     typedef itk::Image<float, ImageDimension> FloatImageType;
56     typedef itk::Image<float, ImageDimension-1> FloatSliceType;
57
58     /** Some convenient typedefs. */
59     typedef typename ImageType::ConstPointer ImageConstPointer;
60     typedef typename ImageType::Pointer      ImagePointer;
61     typedef typename ImageType::RegionType   RegionType; 
62     typedef typename ImageType::PixelType    PixelType;
63     typedef typename ImageType::SpacingType  SpacingType;
64     typedef typename ImageType::SizeType     SizeType;
65     typedef itk::Image<PixelType, ImageDimension-1> SliceType;
66     typedef clitk::AddRelativePositionConstraintToLabelImageFilter<SliceType> RelPosFilterType;
67     typedef typename RelPosFilterType::OrientationTypeEnumeration OrientationTypeEnumeration;
68     
69     /** Input : initial image and object */
70     void SetInput(const ImageType * image) ITK_OVERRIDE;
71     void SetInputObject(const ImageType * image);
72
73     // Options
74     void PrintOptions(std::ostream & os = std::cout);
75     itkGetConstMacro(Direction, int);
76     itkSetMacro(Direction, int);
77
78     itkGetConstMacro(UniqueConnectedComponentBySliceFlag, bool);
79     itkSetMacro(UniqueConnectedComponentBySliceFlag, bool);
80     itkBooleanMacro(UniqueConnectedComponentBySliceFlag);
81
82     itkGetConstMacro(IgnoreEmptySliceObjectFlag, bool);
83     itkSetMacro(IgnoreEmptySliceObjectFlag, bool);
84     itkBooleanMacro(IgnoreEmptySliceObjectFlag);
85
86     itkGetConstMacro(UseTheLargestObjectCCLFlag, bool);
87     itkSetMacro(UseTheLargestObjectCCLFlag, bool);
88     itkBooleanMacro(UseTheLargestObjectCCLFlag);
89
90     itkGetConstMacro(ObjectCCLSelectionFlag, bool);
91     itkSetMacro(ObjectCCLSelectionFlag, bool);
92     itkBooleanMacro(ObjectCCLSelectionFlag);
93     itkGetConstMacro(ObjectCCLSelectionDimension, int);
94     itkSetMacro(ObjectCCLSelectionDimension, int);
95     itkGetConstMacro(ObjectCCLSelectionDirection, int);
96     itkSetMacro(ObjectCCLSelectionDirection, int);
97     itkGetConstMacro(ObjectCCLSelectionIgnoreSingleCCLFlag, bool);
98     itkSetMacro(ObjectCCLSelectionIgnoreSingleCCLFlag, bool);
99     itkBooleanMacro(ObjectCCLSelectionIgnoreSingleCCLFlag);
100
101     itkGetConstMacro(VerboseSlicesFlag, bool);
102     itkSetMacro(VerboseSlicesFlag, bool);
103     itkBooleanMacro(VerboseSlicesFlag);
104
105   protected:
106     SliceBySliceRelativePositionFilter();
107     virtual ~SliceBySliceRelativePositionFilter() {}
108     
109     virtual void GenerateOutputInformation() ITK_OVERRIDE;
110     virtual void GenerateInputRequestedRegion() ITK_OVERRIDE;
111     virtual void GenerateData() ITK_OVERRIDE;
112
113     ImagePointer input;
114     ImagePointer object;
115     ImagePointer m_working_input;
116     ImagePointer m_working_object;
117     bool         m_UniqueConnectedComponentBySliceFlag;
118     int          m_Direction;
119     bool         m_IgnoreEmptySliceObjectFlag;
120     bool         m_UseTheLargestObjectCCLFlag;
121     bool         m_ObjectCCLSelectionFlag;
122     int          m_ObjectCCLSelectionDimension;
123     int          m_ObjectCCLSelectionDirection;
124     bool         m_ObjectCCLSelectionIgnoreSingleCCLFlag;
125     bool         m_VerboseSlicesFlag;
126
127   private:
128     SliceBySliceRelativePositionFilter(const Self&); //purposely not implemented
129     void operator=(const Self&); //purposely not implemented
130     
131   }; // end class
132   //--------------------------------------------------------------------
133
134 } // end namespace clitk
135 //--------------------------------------------------------------------
136
137 #ifndef ITK_MANUAL_INSTANTIATION
138 #include "clitkSliceBySliceRelativePositionFilter.txx"
139 #endif
140 #endif