]> Creatis software - clitk.git/blob - itk/clitkSliceBySliceRelativePositionFilter.h
simplify, correct default
[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;
52
53     /** ImageDimension constants */
54     itkStaticConstMacro(ImageDimension, unsigned int, ImageType::ImageDimension);
55     typedef itk::Image<float, ImageDimension> FloatImageType;
56
57     /** Some convenient typedefs. */
58     typedef typename ImageType::ConstPointer ImageConstPointer;
59     typedef typename ImageType::Pointer      ImagePointer;
60     typedef typename ImageType::RegionType   RegionType; 
61     typedef typename ImageType::PixelType    PixelType;
62     typedef typename ImageType::SpacingType  SpacingType;
63     typedef typename ImageType::SizeType     SizeType;
64     typedef itk::Image<PixelType, ImageDimension-1> SliceType;
65     typedef clitk::AddRelativePositionConstraintToLabelImageFilter<SliceType> RelPosFilterType;
66     typedef typename RelPosFilterType::OrientationTypeEnumeration OrientationTypeEnumeration;
67     
68     /** Input : initial image and object */
69     void SetInput(const ImageType * image);
70     void SetInputObject(const ImageType * image);
71
72     // Options
73     void PrintOptions();
74     itkGetConstMacro(Direction, int);
75     itkSetMacro(Direction, int);
76     // itkGetConstMacro(ObjectBackgroundValue, PixelType);
77     // itkSetMacro(ObjectBackgroundValue, PixelType);
78
79     // itkSetMacro(OrientationTypeString, std::string);
80     // itkGetConstMacro(OrientationTypeString, std::string);
81
82     // itkGetConstMacro(ResampleBeforeRelativePositionFilter, bool);
83     // itkSetMacro(ResampleBeforeRelativePositionFilter, bool);
84     // itkBooleanMacro(ResampleBeforeRelativePositionFilter);
85
86     // itkGetConstMacro(IntermediateSpacing, double);
87     // itkSetMacro(IntermediateSpacing, double);
88
89     // itkGetConstMacro(FuzzyThreshold, double);
90     // itkSetMacro(FuzzyThreshold, double);
91
92     itkGetConstMacro(UniqueConnectedComponentBySlice, bool);
93     itkSetMacro(UniqueConnectedComponentBySlice, bool);
94     itkBooleanMacro(UniqueConnectedComponentBySlice);
95
96     // itkGetConstMacro(AutoCropFlag, bool);
97     // itkSetMacro(AutoCropFlag, bool);
98     // itkBooleanMacro(AutoCropFlag);
99
100     // itkGetConstMacro(InverseOrientationFlag, bool);
101     // itkSetMacro(InverseOrientationFlag, bool);
102     // itkBooleanMacro(InverseOrientationFlag);
103
104     // itkGetConstMacro(RemoveObjectFlag, bool);
105     // itkSetMacro(RemoveObjectFlag, bool);
106     // itkBooleanMacro(RemoveObjectFlag);
107
108     // itkGetConstMacro(CombineWithOrFlag, bool);
109     // itkSetMacro(CombineWithOrFlag, bool);
110     // itkBooleanMacro(CombineWithOrFlag);
111
112   protected:
113     SliceBySliceRelativePositionFilter();
114     virtual ~SliceBySliceRelativePositionFilter() {}
115     
116     // PixelType m_ObjectBackgroundValue;
117     // OrientationTypeEnumeration m_OrientationType;
118     // std::string m_OrientationTypeString;
119     // double m_IntermediateSpacing;
120     // double m_FuzzyThreshold;
121     // bool m_ResampleBeforeRelativePositionFilter;
122
123     virtual void GenerateOutputInformation();
124     virtual void GenerateInputRequestedRegion();
125     virtual void GenerateData();
126
127     ImagePointer input;
128     ImagePointer object;
129     ImagePointer m_working_input;
130     ImagePointer m_working_object;
131     bool         m_UniqueConnectedComponentBySlice;
132     int          m_Direction;
133     // bool m_InverseOrientationFlag;
134     // bool m_RemoveObjectFlag;
135     // bool m_AutoCropFlag;
136     // bool m_CombineWithOrFlag;
137
138   private:
139     SliceBySliceRelativePositionFilter(const Self&); //purposely not implemented
140     void operator=(const Self&); //purposely not implemented
141     
142   }; // end class
143   //--------------------------------------------------------------------
144
145 } // end namespace clitk
146 //--------------------------------------------------------------------
147
148 #ifndef ITK_MANUAL_INSTANTIATION
149 #include "clitkSliceBySliceRelativePositionFilter.txx"
150 #endif
151
152 #endif