21 #ifndef otbNeighborhoodMajorityVotingImageFilter_h
22 #define otbNeighborhoodMajorityVotingImageFilter_h
27 #include "itkConfigure.h"
29 #include "itkMorphologyImageFilter.h"
30 #include "itkBinaryBallStructuringElement.h"
65 template <
class TInputImage,
class TOutputImage = TInputImage,
66 class TKernel =
typename itk::BinaryBallStructuringElement<typename TInputImage::PixelType, TInputImage::ImageDimension>>
73 typedef itk::MorphologyImageFilter<TInputImage, TOutputImage, TKernel>
Superclass;
84 typedef typename Superclass::PixelType
PixelType;
101 itkStaticConstMacro(InputImageDimension,
unsigned int, TInputImage::ImageDimension);
102 itkStaticConstMacro(OutputImageDimension,
unsigned int, TOutputImage::ImageDimension);
103 itkStaticConstMacro(KernelDimension,
unsigned int, TKernel::NeighborhoodDimension);
110 #ifdef ITK_USE_CONCEPT_CHECKING
112 itkConceptMacro(InputConvertibleToOutputCheck, (itk::Concept::Convertible<PixelType, typename TOutputImage::PixelType>));
113 itkConceptMacro(SameDimensionCheck1, (itk::Concept::SameDimension<InputImageDimension, OutputImageDimension>));
114 itkConceptMacro(SameDimensionCheck2, (itk::Concept::SameDimension<InputImageDimension, KernelDimension>));
115 itkConceptMacro(InputGreaterThanComparableCheck, (itk::Concept::GreaterThanComparable<PixelType>));
116 itkConceptMacro(KernelGreaterThanComparableCheck, (itk::Concept::GreaterThanComparable<KernelPixelType>));
125 itkDebugMacro(
"setting LabelForNoDataPixels to " << _arg);
126 if (this->m_LabelForNoDataPixels != _arg)
128 this->m_LabelForNoDataPixels = _arg;
130 m_MajorityVotingBoundaryCondition.SetConstant(m_LabelForNoDataPixels);
131 this->OverrideBoundaryCondition(&m_MajorityVotingBoundaryCondition);
138 itkSetMacro(LabelForUndecidedPixels, PixelType);
141 itkSetMacro(KeepOriginalLabelBool,
bool);
144 itkSetMacro(OnlyIsolatedPixels,
bool);
145 itkSetMacro(IsolatedThreshold,
unsigned int);
158 PixelType Evaluate(
const NeighborhoodIteratorType& nit,
const KernelIteratorType kernelBegin,
const KernelIteratorType kernelEnd)
override;
160 void GenerateOutputInformation()
override;
176 return a.second > b.second;
183 const HistoSummary ComputeNeighborhoodHistogramSummary(
const NeighborhoodIteratorType& nit,
const KernelIteratorType kernelBegin,
184 const KernelIteratorType kernelEnd)
const;
188 void operator=(
const Self&) =
delete;
207 #ifndef ITK_MANUAL_INSTANTIATION