18 #ifndef itkImageConstIterator_h
19 #define itkImageConstIterator_h
83 template <
typename TImage>
94 static constexpr
unsigned int ImageIteratorDimension = TImage::ImageDimension;
121 using InternalPixelType =
typename TImage::InternalPixelType;
128 using AccessorType =
typename TImage::AccessorType;
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;
315 return m_Image->ComputeIndex(static_cast<OffsetValueType>(m_Offset));
323 m_Offset = m_Image->ComputeOffset(ind);
338 return m_Image.GetPointer();
345 return m_PixelAccessorFunctor.Get(*(m_Buffer + m_Offset));
354 return *(m_Buffer + m_Offset);
362 m_Offset = m_BeginOffset;
370 m_Offset = m_EndOffset;
378 return (m_Offset == m_BeginOffset);
386 return (m_Offset == m_EndOffset);