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