12 #ifndef itkIntelligentBinaryClosingFilter_h
13 #define itkIntelligentBinaryClosingFilter_h
15 #include <itkBinaryBallStructuringElement.h>
16 #include <itkBinaryDilateImageFilter.h>
17 #include <itkBinaryErodeImageFilter.h>
18 #include <itkConnectedComponentImageFilter.h>
19 #include <itkConnectedComponentImageFilter.h>
20 #include <itkGrayscaleDilateImageFilter.h>
21 #include <itkImageRegionIterator.h>
22 #include <itkImageToImageFilter.h>
23 #include <itkRelabelComponentImageFilter.h>
24 #include <itkSubtractImageFilter.h>
48 template <
class TInputImage,
class TOutputImage>
65 typedef ImageToImageFilter<InputImageType, OutputImageType>
Superclass;
74 itkFactorylessNewMacro(
Self);
96 this->ProcessObject::SetNthInput(0,
const_cast<InputImageType *
>(input));
97 m_DilateImageFilter->SetInput(input);
100 using Superclass::SetInput;
107 void SetInput(
unsigned int i,
const TInputImage *image)
override
111 itkExceptionMacro(<<
"Filter has only one input.");
115 this->SetInput(image);
123 itkGetMacro(ClosingRadius,
float);
129 itkSetMacro(ClosingRadius,
float);
135 itkGetMacro(SurfaceRatio,
float);
145 itkSetMacro(SurfaceRatio,
float);
150 void PrintSelf(std::ostream &os, Indent indent)
const override;
153 typedef typename InputImageType::PixelType InputPixelType;
154 typedef BinaryBallStructuringElement<InputPixelType, ImageDimension> StructuringElementType;
155 typedef BinaryErodeImageFilter<InputImageType, InputImageType, StructuringElementType> BinaryErodeImageFilterType;
156 typedef BinaryDilateImageFilter<InputImageType, InputImageType, StructuringElementType> BinaryDilateImageFilterType;
157 typedef SubtractImageFilter<InputImageType, InputImageType, InputImageType> SubtractImageFilterType;
158 typedef ConnectedComponentImageFilter<InputImageType, OutputImageType> ConnectedComponentImageFilterType;
159 typedef RelabelComponentImageFilter<OutputImageType, OutputImageType> RelabelComponentImageFilterType;
160 typedef GrayscaleDilateImageFilter<OutputImageType, OutputImageType, StructuringElementType>
161 DilateComponentImageFilterType;
162 typedef ImageRegionIterator<InputImageType> InputIteratorType;
163 typedef ImageRegionConstIterator<InputImageType> ConstInputIteratorType;
164 typedef ImageRegionIterator<OutputImageType> OutputIteratorType;
166 typename BinaryErodeImageFilterType::Pointer m_ErodeImageFilter;
167 typename BinaryDilateImageFilterType::Pointer m_DilateImageFilter;
168 typename SubtractImageFilterType::Pointer m_SubtractImageFilter;
169 typename ConnectedComponentImageFilterType::Pointer m_ConnectedComponentImageFilter;
170 typename RelabelComponentImageFilterType::Pointer m_RelabelComponentImageFilter;
171 typename DilateComponentImageFilterType::Pointer m_BorderDetectionDilateFilter;
173 float m_ClosingRadius;
174 float m_SurfaceRatio;
179 #ifndef ITK_MANUAL_INSTANTIATION
180 #include <itkIntelligentBinaryClosingFilter.tpp>
Performs a morphological closing on a binary image, selectively filling only those holes whose surfac...
void PrintSelf(std::ostream &os, Indent indent) const override
itkStaticConstMacro(ImageDimension, unsigned int, TInputImage::ImageDimension)
void GenerateData() override
Execute the intelligent binary closing algorithm.
ImageToImageFilter< InputImageType, OutputImageType > Superclass
SmartPointer< Self > Pointer
TOutputImage OutputImageType
void SetInput(unsigned int i, const TInputImage *image) override
Set the input at a given index. Only index 0 is supported.
void SetInput(const InputImageType *input) override
Set the input binary image.
TInputImage InputImageType
IntelligentBinaryClosingFilter Self
IntelligentBinaryClosingFilter()
~IntelligentBinaryClosingFilter() override