18#ifndef itkConstNeighborhoodIterator_h
19#define itkConstNeighborhoodIterator_h
50template <
typename TImage,
typename TBoundaryCondition = ZeroFluxNeumannBoundaryCondition<TImage>>
52 :
public Neighborhood<typename TImage::InternalPixelType *, TImage::ImageDimension>
57 using PixelType =
typename TImage::PixelType;
86 using OutputImageType =
typename BoundaryConditionType::OutputImageType;
113 this->Initialize(radius, ptr, region);
116 m_InBounds[i] =
false;
118 this->ResetBoundaryCondition();
119 m_NeighborhoodAccessorFunctor = ptr->GetNeighborhoodAccessor();
120 m_NeighborhoodAccessorFunctor.SetBegin(ptr->GetBufferPointer());
126 operator=(
const Self & orig);
130 PrintSelf(std::ostream &,
Indent)
const override;
154 GetCenterPointer()
const
156 return (this->
operator[]((this->
Size()) >> 1));
162 GetCenterPixel()
const
164 return m_NeighborhoodAccessorFunctor.Get(this->GetCenterPointer());
169 GetImagePointer()
const
183 GetFastIndexPlusOffset(
const OffsetType & o)
const
191 GetNeighborhood()
const;
197 if (!m_NeedToUseBoundaryCondition || this->InBounds())
199 return (m_NeighborhoodAccessorFunctor.Get(this->operator[](i)));
205 return this->IndexInBounds(i, internalIndex, offset)
206 ? m_NeighborhoodAccessorFunctor.Get(this->
operator[](i))
207 : m_NeighborhoodAccessorFunctor.BoundaryCondition(internalIndex, offset,
this, m_BoundaryCondition);
225 return (this->GetPixel(this->GetNeighborhoodIndex(o), inbounds));
234 GetPixel(
const OffsetType & o,
bool & IsInBounds)
const
236 return (this->GetPixel(this->GetNeighborhoodIndex(o), IsInBounds));
245 return (this->GetPixel(this->GetCenterNeighborhoodIndex() + (i * this->GetStride(axis))));
252 GetNext(
const unsigned int axis)
const
254 return (this->GetPixel(this->GetCenterNeighborhoodIndex() + this->GetStride(axis)));
263 return (this->GetPixel(this->GetCenterNeighborhoodIndex() - (i * this->GetStride(axis))));
270 GetPrevious(
const unsigned int axis)
const
272 return (this->GetPixel(this->GetCenterNeighborhoodIndex() - this->GetStride(axis)));
280 return (this->GetIndex() + o);
288 return (this->GetIndex() + this->GetOffset(i));
301 GetBeginIndex()
const
309 GetBoundingBoxAsImageRegion()
const;
313 GetWrapOffset()
const
326 return m_WrapOffset[n];
348 return (this->GetCenterPointer() == m_Begin);
356 if (this->GetCenterPointer() > m_End)
358 ExceptionObject
e(__FILE__, __LINE__);
359 std::ostringstream msg;
360 msg <<
"In method IsAtEnd, CenterPointer = " << this->GetCenterPointer() <<
" is greater than End = " << m_End
363 e.SetDescription(msg.str().c_str());
366 return (this->GetCenterPointer() == m_End);
393 ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(
Self);
410 return this->GetCenterPointer() <= it.GetCenterPointer();
438 this->SetLoop(position);
439 this->SetPixelPointers(position);
495 m_BoundaryCondition = i;
501 ResetBoundaryCondition()
503 m_BoundaryCondition = &m_InternalBoundaryCondition;
508 SetBoundaryCondition(
const TBoundaryCondition & c)
510 m_InternalBoundaryCondition = c;
515 GetBoundaryCondition()
const
517 return m_BoundaryCondition;
522 NeedToUseBoundaryConditionOn()
524 this->SetNeedToUseBoundaryCondition(
true);
528 NeedToUseBoundaryConditionOff()
530 this->SetNeedToUseBoundaryCondition(
false);
534 SetNeedToUseBoundaryCondition(
bool b)
536 m_NeedToUseBoundaryCondition = b;
540 GetNeedToUseBoundaryCondition()
const
542 return m_NeedToUseBoundaryCondition;
556 m_IsInBoundsValid =
false;
577 m_BeginIndex = start;
593 const InternalPixelType * m_Begin{
nullptr };
596 typename ImageType::ConstWeakPointer m_ConstImage{};
599 const InternalPixelType * m_End{
nullptr };
616 OffsetType m_WrapOffset{ { 0 } };
619 TBoundaryCondition m_InternalBoundaryCondition{};
625 ImageBoundaryConditionPointerType m_BoundaryCondition{ &m_InternalBoundaryCondition };
629 mutable bool m_InBounds[
Dimension]{
false };
632 mutable bool m_IsInBounds{
false };
637 mutable bool m_IsInBoundsValid{
false };
646 bool m_NeedToUseBoundaryCondition{
false };
649 NeighborhoodAccessorFunctorType m_NeighborhoodAccessorFunctor{};
652template <
typename TImage>
662template <
typename TImage>
670template <
typename TImage>
681#ifndef ITK_MANUAL_INSTANTIATION
682# include "itkConstNeighborhoodIterator.hxx"
Pixel-wise addition of two images.
Const version of NeighborhoodIterator, defining iteration of a local N-dimensional neighborhood of pi...
const InternalPixelType * GetCenterPointer() const
typename TImage::RegionType RegionType
typename ImageType::NeighborhoodAccessorFunctorType NeighborhoodAccessorFunctorType
typename TImage::InternalPixelType InternalPixelType
unsigned int DimensionValueType
TBoundaryCondition BoundaryConditionType
typename NeighborhoodType::NeighborIndexType NeighborIndexType
typename TImage::PixelType PixelType
typename BoundaryConditionType::OutputImageType OutputImageType
Control indentation during Print() invocation.
A light-weight container object for storing an N-dimensional neighborhood of values.
typename AllocatorType::iterator Iterator
SizeValueType NeighborIndexType
typename AllocatorType::const_iterator ConstIterator
ImageBaseType::RegionType RegionType
ImageBaseType::IndexType IndexType
constexpr unsigned int Dimension
ImageBaseType::SizeType SizeType
static constexpr double e
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
bool operator>(const Index< VDimension > &one, const Index< VDimension > &two)
bool operator<=(const Index< VDimension > &one, const Index< VDimension > &two)
ConstNeighborhoodIterator< TImage > operator-(const ConstNeighborhoodIterator< TImage > &it, const typename ConstNeighborhoodIterator< TImage >::OffsetType &ind)
bool operator==(const Index< VDimension > &one, const Index< VDimension > &two)
ConstNeighborhoodIterator< TImage > operator+(const ConstNeighborhoodIterator< TImage > &it, const typename ConstNeighborhoodIterator< TImage >::OffsetType &ind)
bool operator<(const Index< VDimension > &one, const Index< VDimension > &two)
bool operator>=(const Index< VDimension > &one, const Index< VDimension > &two)