18 #ifndef itkImageConstIterator_h
19 #define itkImageConstIterator_h
83 template <
typename TImage>
94 static constexpr
unsigned int ImageIteratorDimension = TImage::ImageDimension;
129 using AccessorFunctorType =
typename TImage::AccessorFunctorType;
136 , m_PixelAccessorFunctor()
143 m_PixelAccessorFunctor.SetBegin(m_Buffer);
164 m_PixelAccessorFunctor.SetBegin(m_Buffer);
172 m_Buffer = m_Image->GetBufferPointer();
177 m_PixelAccessor = ptr->GetPixelAccessor();
178 m_PixelAccessorFunctor.SetPixelAccessor(m_PixelAccessor);
179 m_PixelAccessorFunctor.SetBegin(m_Buffer);
199 m_PixelAccessorFunctor.SetBegin(m_Buffer);
210 if (region.GetNumberOfPixels() > 0)
212 const RegionType & bufferedRegion = m_Image->GetBufferedRegion();
213 itkAssertOrThrowMacro((bufferedRegion.IsInside(m_Region)),
214 "Region " << m_Region <<
" is outside of buffered region " << bufferedRegion);
218 m_Offset = m_Image->ComputeOffset(m_Region.GetIndex());
219 m_BeginOffset = m_Offset;
227 if (m_Region.GetNumberOfPixels() == 0)
230 m_EndOffset = m_BeginOffset;
234 for (
unsigned int i = 0; i < TImage::ImageDimension; ++i)
236 ind[i] += (static_cast<IndexValueType>(size[i]) - 1);
238 m_EndOffset = m_Image->ComputeOffset(ind);
247 return TImage::ImageDimension;
259 ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(
Self);
308 return m_Image->ComputeIndex(static_cast<OffsetValueType>(m_Offset));
316 m_Offset = m_Image->ComputeOffset(ind);
331 return m_Image.GetPointer();
338 return m_PixelAccessorFunctor.Get(*(m_Buffer + m_Offset));
347 return *(m_Buffer + m_Offset);
355 m_Offset = m_BeginOffset;
363 m_Offset = m_EndOffset;
371 return (m_Offset == m_BeginOffset);
379 return (m_Offset == m_EndOffset);
383 typename TImage::ConstWeakPointer m_Image{};
391 const InternalPixelType * m_Buffer{};
393 AccessorType m_PixelAccessor{};
394 AccessorFunctorType m_PixelAccessorFunctor{};