12 #ifndef __itkIntelligentBinaryClosingFilter_h
13 #define __itkIntelligentBinaryClosingFilter_h
16 #pragma warning(disable : 4786)
19 #include <itkBinaryBallStructuringElement.h>
20 #include <itkBinaryDilateImageFilter.h>
21 #include <itkBinaryErodeImageFilter.h>
22 #include <itkConnectedComponentImageFilter.h>
23 #include <itkConnectedComponentImageFilter.h>
24 #include <itkGrayscaleDilateImageFilter.h>
25 #include <itkImageRegionIterator.h>
26 #include <itkImageToImageFilter.h>
27 #include <itkRelabelComponentImageFilter.h>
28 #include <itkSubtractImageFilter.h>
37 template <
class TInputImage,
class TOutputImage>
48 itkStaticConstMacro(ImageDimension,
unsigned int, TInputImage::ImageDimension);
54 typedef ImageToImageFilter<InputImageType, OutputImageType>
Superclass;
63 itkFactorylessNewMacro(
Self);
67 void GenerateData()
override;
74 this->ProcessObject::SetNthInput(0,
const_cast<InputImageType *
>(input));
75 m_DilateImageFilter->SetInput(input);
78 using Superclass::SetInput;
79 void SetInput(
unsigned int i,
const TInputImage *image)
override
83 itkExceptionMacro(<<
"Filter has only one input.");
87 this->SetInput(image);
91 itkGetMacro(ClosingRadius,
float);
92 itkSetMacro(ClosingRadius,
float);
94 itkGetMacro(SurfaceRatio,
float);
95 itkSetMacro(SurfaceRatio,
float);
100 void PrintSelf(std::ostream &os, Indent indent)
const override;
103 typedef typename InputImageType::PixelType InputPixelType;
104 typedef BinaryBallStructuringElement<InputPixelType, ImageDimension> StructuringElementType;
105 typedef BinaryErodeImageFilter<InputImageType, InputImageType, StructuringElementType> BinaryErodeImageFilterType;
106 typedef BinaryDilateImageFilter<InputImageType, InputImageType, StructuringElementType> BinaryDilateImageFilterType;
107 typedef SubtractImageFilter<InputImageType, InputImageType, InputImageType> SubtractImageFilterType;
108 typedef ConnectedComponentImageFilter<InputImageType, OutputImageType> ConnectedComponentImageFilterType;
109 typedef RelabelComponentImageFilter<OutputImageType, OutputImageType> RelabelComponentImageFilterType;
110 typedef GrayscaleDilateImageFilter<OutputImageType, OutputImageType, StructuringElementType>
111 DilateComponentImageFilterType;
112 typedef ImageRegionIterator<InputImageType> InputIteratorType;
113 typedef ImageRegionConstIterator<InputImageType> ConstInputIteratorType;
114 typedef ImageRegionIterator<OutputImageType> OutputIteratorType;
116 typename BinaryErodeImageFilterType::Pointer m_ErodeImageFilter;
117 typename BinaryDilateImageFilterType::Pointer m_DilateImageFilter;
118 typename SubtractImageFilterType::Pointer m_SubtractImageFilter;
119 typename ConnectedComponentImageFilterType::Pointer m_ConnectedComponentImageFilter;
120 typename RelabelComponentImageFilterType::Pointer m_RelabelComponentImageFilter;
121 typename DilateComponentImageFilterType::Pointer m_BorderDetectionDilateFilter;
123 float m_ClosingRadius;
124 float m_SurfaceRatio;
129 #ifndef ITK_MANUAL_INSTANTIATION
130 #include "itkIntelligentBinaryClosingFilter.txx"
134 #endif // IntelligentBinaryClosingFilter_h