18 #ifndef itkImageConstIterator_h
19 #define itkImageConstIterator_h
83 template<
typename TImage >
94 static constexpr
unsigned int ImageIteratorDimension = TImage::ImageDimension;
136 m_PixelAccessorFunctor()
143 m_PixelAccessorFunctor.SetBegin(m_Buffer);
164 m_PixelAccessorFunctor.SetBegin(m_Buffer);
173 m_Buffer = m_Image->GetBufferPointer();
178 m_PixelAccessor = ptr->GetPixelAccessor();
179 m_PixelAccessorFunctor.SetPixelAccessor(m_PixelAccessor);
180 m_PixelAccessorFunctor.SetBegin(m_Buffer);
199 m_PixelAccessorFunctor.SetBegin(m_Buffer);
209 if ( region.GetNumberOfPixels() > 0 )
211 const RegionType & bufferedRegion = m_Image->GetBufferedRegion();
212 itkAssertOrThrowMacro( ( bufferedRegion.IsInside(m_Region) ),
213 "Region " << m_Region <<
" is outside of buffered region " << bufferedRegion );
217 m_Offset = m_Image->ComputeOffset( m_Region.GetIndex() );
218 m_BeginOffset = m_Offset;
225 SizeType size( m_Region.GetSize() );
226 if ( m_Region.GetNumberOfPixels() == 0 )
229 m_EndOffset = m_BeginOffset;
233 for (
unsigned int i = 0; i < TImage::ImageDimension; ++i )
237 m_EndOffset = m_Image->ComputeOffset(ind);
244 {
return TImage::ImageDimension; }
309 {
return m_Image->ComputeIndex( static_cast< OffsetValueType >( m_Offset ) ); }
314 { m_Offset = m_Image->ComputeOffset(ind); }
323 {
return m_Image.GetPointer(); }
327 {
return m_PixelAccessorFunctor.Get( *( m_Buffer + m_Offset ) ); }
333 {
return *( m_Buffer + m_Offset ); }
339 m_Offset = m_BeginOffset;
346 m_Offset = m_EndOffset;
353 return ( m_Offset == m_BeginOffset );
360 return ( m_Offset == m_EndOffset );
bool operator!=(const Self &it) const
const RegionType & GetRegion() const
OffsetValueType m_BeginOffset
typename BufferType::OffsetType OffsetType
typename BufferType::InternalPixelType InternalPixelType
typename PixelContainer::Pointer PixelContainerPointer
const IndexType GetIndex() const
typename BufferType::PixelType PixelType
OffsetValueType m_EndOffset
typename BufferType::AccessorFunctorType AccessorFunctorType
typename BufferType::PixelContainer PixelContainer
AccessorType m_PixelAccessor
A multi-dimensional image iterator templated over image type.
Self & operator=(const Self &it)
AccessorFunctorType m_PixelAccessorFunctor
ImageConstIterator(const Self &it)
bool operator<=(const Index< VDimension > &one, const Index< VDimension > &two)
virtual void SetIndex(const IndexType &ind)
ImageBaseType::SizeType SizeType
const InternalPixelType * m_Buffer
ImageBaseType::IndexType IndexType
const PixelType & Value() const
ImageConstIterator(const ImageType *ptr, const RegionType ®ion)
signed long IndexValueType
typename BufferType::IndexType IndexType
TImage::ConstWeakPointer m_Image
bool operator==(const Self &it) const
typename BufferType::SizeType SizeType
bool operator<(const Index< VDimension > &one, const Index< VDimension > &two)
static unsigned int GetImageIteratorDimension()
bool operator>(const Self &it) const
typename BufferType::AccessorType AccessorType
typename BufferType::RegionType RegionType
ImageBaseType::RegionType RegionType
signed long OffsetValueType
virtual void SetRegion(const RegionType ®ion)
bool operator>=(const Self &it) const
const ImageType * GetImage() const