22 #ifndef otbBinaryImageDensityFunction_hxx
23 #define otbBinaryImageDensityFunction_hxx
27 #include "itkConstNeighborhoodIterator.h"
35 template <
class TInputImage,
class TCoordRep>
38 m_NeighborhoodRadius.Fill(1);
44 template <
class TInputImage,
class TCoordRep>
47 this->Superclass::PrintSelf(os, indent);
48 os << indent <<
"NeighborhoodRadius: " << m_NeighborhoodRadius << std::endl;
55 template <
class TInputImage,
class TCoordRep>
62 sum = itk::NumericTraits<RealType>::Zero;
64 if (!this->GetInputImage())
66 return (itk::NumericTraits<RealType>::max());
69 if (!this->IsInsideBuffer(index))
71 return (itk::NumericTraits<RealType>::max());
75 typename InputImageType::SizeType kernelSize = m_NeighborhoodRadius;
77 itk::ConstNeighborhoodIterator<InputImageType> it(kernelSize, this->GetInputImage(), this->GetInputImage()->GetBufferedRegion());
80 it.SetLocation(index);
83 const unsigned int size = it.Size();
84 for (
unsigned int i = 0; i < size; ++i)