18 #ifndef __itkImageConstIterator_h
19 #define __itkImageConstIterator_h
83 template<
typename TImage >
94 itkStaticConstMacro(ImageIteratorDimension,
unsigned int,
95 TImage::ImageDimension);
134 m_PixelAccessorFunctor()
141 m_PixelAccessorFunctor.SetBegin(m_Buffer);
162 m_PixelAccessorFunctor.SetBegin(m_Buffer);
168 const RegionType & region)
171 m_Buffer = m_Image->GetBufferPointer();
176 m_PixelAccessor = ptr->GetPixelAccessor();
177 m_PixelAccessorFunctor.SetPixelAccessor(m_PixelAccessor);
178 m_PixelAccessorFunctor.SetBegin(m_Buffer);
197 m_PixelAccessorFunctor.SetBegin(m_Buffer);
203 virtual void SetRegion(
const RegionType & region)
207 if ( region.GetNumberOfPixels() > 0 )
209 const RegionType & bufferedRegion = m_Image->GetBufferedRegion();
210 itkAssertOrThrowMacro( ( bufferedRegion.IsInside(m_Region) ),
211 "Region " << m_Region <<
" is outside of buffered region " << bufferedRegion );
215 m_Offset = m_Image->ComputeOffset( m_Region.GetIndex() );
216 m_BeginOffset = m_Offset;
222 if ( m_Region.GetNumberOfPixels() == 0 )
225 m_EndOffset = m_BeginOffset;
230 SizeType size( m_Region.GetSize() );
231 for (
unsigned int i = 0; i < TImage::ImageDimension; ++i )
235 m_EndOffset = m_Image->ComputeOffset(ind);
241 static unsigned int GetImageIteratorDimension()
242 {
return TImage::ImageDimension; }
256 operator==(
const Self & it)
const
265 operator<=(
const Self & it)
const
275 operator<(
const Self & it)
const
285 operator>=(
const Self & it)
const
295 operator>(
const Self & it)
const
307 {
return m_Image->ComputeIndex( static_cast< OffsetValueType >( m_Offset ) ); }
312 { m_Offset = m_Image->ComputeOffset(ind); }
316 const RegionType & GetRegion()
const
321 {
return m_Image.GetPointer(); }
325 {
return m_PixelAccessorFunctor.Get( *( m_Buffer + m_Offset ) ); }
331 {
return *( m_Buffer + m_Offset ); }
337 itkLegacyMacro(Self Begin(
void)
const);
343 m_Offset = m_BeginOffset;
350 itkLegacyMacro(Self End(
void)
const);
356 m_Offset = m_EndOffset;
361 bool IsAtBegin(
void)
const
363 return ( m_Offset == m_BeginOffset );
368 bool IsAtEnd(
void)
const
370 return ( m_Offset == m_EndOffset );
389 #ifndef ITK_MANUAL_INSTANTIATION
390 #include "itkImageConstIterator.hxx"