1 /*=========================================================================
2 Program: vv http://www.creatis.insa-lyon.fr/rio/vv
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
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.
13 It is distributed under dual licence
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
21 /* =================================================
22 * @file clitkDecomposeThroughErosionImageFilter.h
28 ===================================================*/
33 #include "clitkCommon.h"
34 #include "clitkSetBackgroundImageFilter.h"
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"
49 template <class InputImageType, class OutputImageType>
50 class ITK_EXPORT DecomposeThroughErosionImageFilter :
51 public itk::ImageToImageFilter<InputImageType, OutputImageType>
54 //----------------------------------------
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;
62 // Method for creation through the object factory
65 // Run-time type information (and related methods)
66 itkTypeMacro( DecomposeThroughErosionImageFilter, ImageToImageFilter );
68 /** Dimension of the domain space. */
69 itkStaticConstMacro(InputImageDimension, unsigned int, Superclass::InputImageDimension);
70 itkStaticConstMacro(OutputImageDimension, unsigned int, Superclass::OutputImageDimension);
72 //----------------------------------------
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;
81 //----------------------------------------
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);
112 //----------------------------------------
113 // Constructor & Destructor
114 //----------------------------------------
115 DecomposeThroughErosionImageFilter();
116 ~DecomposeThroughErosionImageFilter() {};
118 //----------------------------------------
120 //----------------------------------------
122 void GenerateData(void);
123 void AllocateOutput(){;}
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 //----------------------------------------
136 //----------------------------------------
138 bool m_FullyConnected;
139 InputPixelType m_Lower;
140 InputPixelType m_Upper;
141 OutputPixelType m_ErosionPaddingValue;
142 InputPixelType m_Inside;
143 InputPixelType m_Outside;
145 unsigned int m_NumberOfNewLabels;
146 unsigned int m_MinimumObjectSize;
147 unsigned int m_MinimumNumberOfIterations;
152 } // end namespace clitk
154 #ifndef ITK_MANUAL_INSTANTIATION
155 #include "clitkDecomposeThroughErosionImageFilter.txx"
158 #endif // #define clitkDecomposeThroughErosionImageFilter_h