]> Creatis software - clitk.git/blob - segmentation/clitkDecomposeThroughErosionImageFilter.h
changes in license header
[clitk.git] / segmentation / clitkDecomposeThroughErosionImageFilter.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 clitkDecomposeThroughErosionImageFilter_h
19 #define clitkDecomposeThroughErosionImageFilter_h
20
21 /* =================================================
22  * @file   clitkDecomposeThroughErosionImageFilter.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 "clitkSetBackgroundImageFilter.h"
35
36 //itk include
37 #include "itkImageToImageFilter.h"
38 #include "itkBinaryThresholdImageFilter.h"
39 #include "itkBinaryErodeImageFilter.h"
40 #include "itkStatisticsImageFilter.h"
41 #include "itkConnectedComponentImageFilter.h"
42 #include "itkCastImageFilter.h"
43 #include "itkBinaryBallStructuringElement.h"
44 #include "itkRelabelComponentImageFilter.h"
45
46 namespace clitk 
47 {
48
49   template <class InputImageType, class OutputImageType>
50   class ITK_EXPORT DecomposeThroughErosionImageFilter :
51     public itk::ImageToImageFilter<InputImageType, OutputImageType>
52   {
53   public:
54     //----------------------------------------
55     // ITK
56     //----------------------------------------
57     typedef DecomposeThroughErosionImageFilter                                                 Self;
58     typedef itk::ImageToImageFilter<InputImageType, OutputImageType>  Superclass;
59     typedef itk::SmartPointer<Self>                                   Pointer;
60     typedef itk::SmartPointer<const Self>                             ConstPointer;
61    
62     // Method for creation through the object factory
63     itkNewMacro(Self);  
64
65     // Run-time type information (and related methods)
66     itkTypeMacro( DecomposeThroughErosionImageFilter, ImageToImageFilter );
67
68     /** Dimension of the domain space. */
69     itkStaticConstMacro(InputImageDimension, unsigned int, Superclass::InputImageDimension);
70     itkStaticConstMacro(OutputImageDimension, unsigned int, Superclass::OutputImageDimension);
71
72     //----------------------------------------
73     // Typedefs
74     //----------------------------------------
75     typedef typename OutputImageType::RegionType OutputImageRegionType;
76     typedef int InternalPixelType;
77     typedef typename InputImageType::PixelType InputPixelType;
78     typedef typename OutputImageType::PixelType OutputPixelType;
79     typedef typename InputImageType::SizeType SizeType;
80
81     //----------------------------------------
82     // Set & Get
83     //----------------------------------------    
84     itkBooleanMacro(Verbose);
85     itkSetMacro( Verbose, bool);
86     itkGetConstReferenceMacro( Verbose, bool);
87     itkBooleanMacro(FullyConnected);
88     itkSetMacro( FullyConnected, bool);
89     itkGetConstReferenceMacro( FullyConnected, bool);
90     itkSetMacro( Lower, InputPixelType);
91     itkGetConstMacro( Lower, InputPixelType);
92     itkSetMacro( Upper, InputPixelType);
93     itkGetConstMacro( Upper, InputPixelType);
94     itkSetMacro( Inside, InternalPixelType);
95     itkGetConstMacro( Inside, InternalPixelType);  
96     itkSetMacro( Outside, InternalPixelType);
97     itkGetConstMacro( Outside, InternalPixelType);  
98     itkSetMacro( ErosionPaddingValue, OutputPixelType);
99     itkGetConstMacro( ErosionPaddingValue, OutputPixelType);  
100     void SetRadius ( const SizeType& s){ m_Radius=s; this->Modified();}
101     SizeType GetRadius(void){return m_Radius;}
102     itkSetMacro( NumberOfNewLabels, unsigned int);
103     itkGetConstMacro( NumberOfNewLabels, unsigned int);
104     itkSetMacro( MinimumObjectSize, unsigned int);
105     itkGetConstMacro( MinimumObjectSize, unsigned int);
106     itkSetMacro( MinimumNumberOfIterations, unsigned int);
107     itkGetConstMacro( MinimumNumberOfIterations, unsigned int);
108
109   protected:
110
111     //----------------------------------------  
112     // Constructor & Destructor
113     //----------------------------------------  
114     DecomposeThroughErosionImageFilter();
115     ~DecomposeThroughErosionImageFilter() {};
116
117     //----------------------------------------  
118     // Update
119     //----------------------------------------  
120     // Generate Data
121     void GenerateData(void);
122     void AllocateOutput(){;}
123
124     //     // Threaded Generate Data
125     //     void BeforeThreadedGenerateData(void );
126     //     void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread, int threadId );
127     //     void AfterThreadedGenerateData(void );
128     //     // Override defaults
129     //     virtual void GenerateInputRequestedRegion();
130     //     virtual void GenerateOutputInformation (void);
131     //     virtual void EnlargeOutputRequestedRegion(DataObject *data);
132     //     void AllocateOutputs();
133     //----------------------------------------  
134     // Data members
135     //----------------------------------------
136     bool m_Verbose;
137     bool m_FullyConnected;
138     InputPixelType m_Lower;
139     InputPixelType m_Upper;
140     OutputPixelType m_ErosionPaddingValue;
141     InputPixelType m_Inside;
142     InputPixelType m_Outside;
143     SizeType m_Radius;
144     unsigned int m_NumberOfNewLabels;
145     unsigned int m_MinimumObjectSize;
146     unsigned int m_MinimumNumberOfIterations;
147
148   };
149
150
151 } // end namespace clitk
152
153 #ifndef ITK_MANUAL_INSTANTIATION
154 #include "clitkDecomposeThroughErosionImageFilter.txx"
155 #endif
156
157 #endif // #define clitkDecomposeThroughErosionImageFilter_h
158
159