]> Creatis software - clitk.git/blob - itk/clitkDecomposeThroughErosionImageFilter.h
With ITKv5, change VectorResample and VectorCast Image Filter to Resample and Cast...
[clitk.git] / itk / 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     void SetRadius(const int r) { for(uint i=0; i<InputImageDimension; i++) m_Radius[i] = r; SetRadius(m_Radius); }
103     itkSetMacro( NumberOfNewLabels, unsigned int);
104     itkGetConstMacro( NumberOfNewLabels, unsigned int);
105     itkSetMacro( MinimumObjectSize, unsigned int);
106     itkGetConstMacro( MinimumObjectSize, unsigned int);
107     itkSetMacro( MinimumNumberOfIterations, unsigned int);
108     itkGetConstMacro( MinimumNumberOfIterations, unsigned int);
109
110   protected:
111
112     //----------------------------------------  
113     // Constructor & Destructor
114     //----------------------------------------  
115     DecomposeThroughErosionImageFilter();
116     ~DecomposeThroughErosionImageFilter() {};
117
118     //----------------------------------------  
119     // Update
120     //----------------------------------------  
121     // Generate Data
122     void GenerateData(void);
123     void AllocateOutput(){;}
124
125     //     // Threaded Generate Data
126     //     void BeforeThreadedGenerateData(void );
127     //     void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread, int threadId );
128     //     void AfterThreadedGenerateData(void );
129     //     // Override defaults
130     //     virtual void GenerateInputRequestedRegion();
131     //     virtual void GenerateOutputInformation (void);
132     //     virtual void EnlargeOutputRequestedRegion(DataObject *data);
133     //     void AllocateOutputs();
134     //----------------------------------------  
135     // Data members
136     //----------------------------------------
137     bool m_Verbose;
138     bool m_FullyConnected;
139     InputPixelType m_Lower;
140     InputPixelType m_Upper;
141     OutputPixelType m_ErosionPaddingValue;
142     InputPixelType m_Inside;
143     InputPixelType m_Outside;
144     SizeType m_Radius;
145     unsigned int m_NumberOfNewLabels;
146     unsigned int m_MinimumObjectSize;
147     unsigned int m_MinimumNumberOfIterations;
148
149   };
150
151
152 } // end namespace clitk
153
154 #ifndef ITK_MANUAL_INSTANTIATION
155 #include "clitkDecomposeThroughErosionImageFilter.txx"
156 #endif
157
158 #endif // #define clitkDecomposeThroughErosionImageFilter_h
159
160