]> Creatis software - clitk.git/blob - itk/clitkDecomposeAndReconstructImageFilter.h
43cbecb76b3abc3ceca348dfddaa6f7a376d924b
[clitk.git] / itk / clitkDecomposeAndReconstructImageFilter.h
1 #ifndef clitkDecomposeAndReconstructImageFilter_h
2 #define clitkDecomposeAndReconstructImageFilter_h
3
4 /* =================================================
5  * @file   clitkDecomposeAndReconstructImageFilter.h
6  * @author 
7  * @date   
8  * 
9  * @brief 
10  * 
11  ===================================================*/
12
13
14 // clitk include
15 #include "clitkIO.h"
16 #include "clitkCommon.h"
17 #include "clitkDecomposeThroughErosionImageFilter.h"
18 #include "clitkReconstructThroughDilationImageFilter.h"
19
20 //itk include
21 #include "itkImageToImageFilter.h"
22 #include "itkRelabelComponentImageFilter.h"
23
24
25 namespace clitk 
26 {
27
28   template <class InputImageType, class OutputImageType>
29   class ITK_EXPORT DecomposeAndReconstructImageFilter :
30     public itk::ImageToImageFilter<InputImageType, OutputImageType>
31   {
32   public:
33     //----------------------------------------
34     // ITK
35     //----------------------------------------
36     typedef DecomposeAndReconstructImageFilter                                                 Self;
37     typedef itk::ImageToImageFilter<InputImageType, OutputImageType>  Superclass;
38     typedef itk::SmartPointer<Self>                                   Pointer;
39     typedef itk::SmartPointer<const Self>                             ConstPointer;
40    
41     // Method for creation through the object factory
42     itkNewMacro(Self);  
43
44     // Run-time type information (and related methods)
45     itkTypeMacro( DecomposeAndReconstructImageFilter, ImageToImageFilter );
46
47     /** Dimension of the domain space. */
48     itkStaticConstMacro(InputImageDimension, unsigned int, Superclass::InputImageDimension);
49     itkStaticConstMacro(OutputImageDimension, unsigned int, Superclass::OutputImageDimension);
50
51     //----------------------------------------
52     // Typedefs
53     //----------------------------------------
54     typedef typename OutputImageType::RegionType OutputImageRegionType;
55     typedef int InternalPixelType;
56     typedef typename InputImageType::PixelType InputPixelType;
57     typedef typename OutputImageType::PixelType OutputPixelType;
58     typedef typename InputImageType::SizeType SizeType;
59
60
61     //----------------------------------------
62     // Set & Get
63     //----------------------------------------    
64     itkBooleanMacro(Verbose);
65     itkSetMacro( Verbose, bool);
66     itkGetConstReferenceMacro( Verbose, bool);
67     itkBooleanMacro(FullyConnected);
68     itkSetMacro( FullyConnected, bool);
69     itkGetConstReferenceMacro( FullyConnected, bool);
70     void SetRadius ( const SizeType& s){ m_Radius=s; this->Modified();}
71     SizeType GetRadius(void){return m_Radius;}
72     itkSetMacro( MaximumNumberOfLabels, unsigned int);
73     itkGetConstMacro( MaximumNumberOfLabels, unsigned int);
74     itkSetMacro( BackgroundValue, InternalPixelType);
75     itkGetConstMacro( BackgroundValue, InternalPixelType);
76     itkSetMacro( ForegroundValue, InternalPixelType);
77     itkGetConstMacro( ForegroundValue, InternalPixelType);
78     itkSetMacro( NumberOfNewLabels, unsigned int);
79     itkGetConstMacro( NumberOfNewLabels, unsigned int);
80     itkSetMacro( MinimumObjectSize, unsigned int);
81     itkGetConstMacro( MinimumObjectSize, unsigned int);
82     itkSetMacro( MinimumNumberOfIterations, unsigned int);
83     itkGetConstMacro( MinimumNumberOfIterations, unsigned int);
84     //     // Convenience macro's: Built-in
85     //     itkBooleanMacro (flag); //FlagOn FlagOff
86     //     itkGetMacro(name, type);
87     //     itkSetMacro(name, type);
88     //     itkSetConstMacro( name, type);
89     //     itkGetConstMacro( name, type);
90     //     itkSetConstReferenceMacro(name, type);
91     //     itkGetConstReferenceMacro(name, type);
92     //     // Convenience macro's: Smartpointers
93     //     itkSetObjectMacro(name, type); 
94     //     itkGetObjectMacro(name, type); 
95     //     itkSetConstObjectMacro(name, type); 
96     //     itkGetConstObjectMacro(name, type); 
97     //     itkSetConstReferenceObjectMacro(name, type); 
98     //     itkSetConstReference(name, type);
99     
100
101   protected:
102
103     //----------------------------------------  
104     // Constructor & Destructor
105     //----------------------------------------  
106     DecomposeAndReconstructImageFilter();
107     ~DecomposeAndReconstructImageFilter() {};
108
109     //----------------------------------------  
110     // Update
111     //----------------------------------------  
112     // Generate Data
113     void GenerateData(void);
114
115     //     // Threaded Generate Data
116     //     void BeforeThreadedGenerateData(void );
117     //     void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread, int threadId );
118     //     void AfterThreadedGenerateData(void );
119     //     // Override defaults
120     //     virtual void GenerateInputRequestedRegion();
121     //     virtual void GenerateOutputInformation (void);
122     //     virtual void EnlargeOutputRequestedRegion(DataObject *data);
123     void AllocateOutputs(){;}
124     //----------------------------------------  
125     // Data members
126     //----------------------------------------
127     bool m_Verbose;
128     SizeType m_Radius;
129     unsigned int m_NumberOfNewLabels;
130     bool m_FullyConnected;
131     InputPixelType m_BackgroundValue;
132     InputPixelType m_ForegroundValue;
133     unsigned int  m_MaximumNumberOfLabels;
134     unsigned int m_MinimumObjectSize;
135     unsigned int m_MinimumNumberOfIterations;
136   };
137
138
139 } // end namespace clitk
140
141 #ifndef ITK_MANUAL_INSTANTIATION
142 #include "clitkDecomposeAndReconstructImageFilter.txx"
143 #endif
144
145 #endif // #define clitkDecomposeAndReconstructImageFilter_h
146
147