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;
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);
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;
207 #ifndef ITK_MANUAL_INSTANTIATION
bool m_KeepOriginalLabelBool
Superclass::NeighborhoodIteratorType NeighborhoodIteratorType
NeighborhoodMajorityVotingImageFilter(const Self &)=delete
NeighborhoodMajorityVotingImageFilter Self
~NeighborhoodMajorityVotingImageFilter() override
bool m_OnlyIsolatedPixels
DefaultBoundaryConditionType m_MajorityVotingBoundaryCondition
unsigned int m_IsolatedThreshold
Superclass::DefaultBoundaryConditionType DefaultBoundaryConditionType
Superclass::PixelType PixelType
Superclass::KernelType KernelType
TKernel::PixelType KernelPixelType
itk::MorphologyImageFilter< TInputImage, TOutputImage, TKernel > Superclass
itk::SmartPointer< const Self > ConstPointer
void operator=(const Self &)=delete
Superclass::KernelIteratorType KernelIteratorType
itk::SmartPointer< Self > Pointer
PixelType m_LabelForNoDataPixels
virtual void SetLabelForNoDataPixels(const PixelType _arg)
PixelType m_LabelForUndecidedPixels
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
bool operator()(const HistoValueType &a, const HistoValueType &b)
std::pair< PixelType, unsigned int > HistoValueType
unsigned int freqCenterLabel