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://oncora1.lyon.fnclcc.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 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);
111 //----------------------------------------
112 // Constructor & Destructor
113 //----------------------------------------
114 DecomposeThroughErosionImageFilter();
115 ~DecomposeThroughErosionImageFilter() {};
117 //----------------------------------------
119 //----------------------------------------
121 void GenerateData(void);
122 void AllocateOutput(){;}
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 //----------------------------------------
135 //----------------------------------------
137 bool m_FullyConnected;
138 InputPixelType m_Lower;
139 InputPixelType m_Upper;
140 OutputPixelType m_ErosionPaddingValue;
141 InputPixelType m_Inside;
142 InputPixelType m_Outside;
144 unsigned int m_NumberOfNewLabels;
145 unsigned int m_MinimumObjectSize;
146 unsigned int m_MinimumNumberOfIterations;
151 } // end namespace clitk
153 #ifndef ITK_MANUAL_INSTANTIATION
154 #include "clitkDecomposeThroughErosionImageFilter.txx"
157 #endif // #define clitkDecomposeThroughErosionImageFilter_h