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();
175 if ( region.GetNumberOfPixels() > 0 )
177 const RegionType & bufferedRegion = m_Image->GetBufferedRegion();
178 itkAssertOrThrowMacro( ( bufferedRegion.IsInside(m_Region) ),
179 "Region " << m_Region <<
" is outside of buffered region " << bufferedRegion );
183 m_Offset = m_Image->ComputeOffset( m_Region.GetIndex() );
184 m_BeginOffset = m_Offset;
190 if ( m_Region.GetNumberOfPixels() == 0 )
193 m_EndOffset = m_BeginOffset;
198 SizeType size( m_Region.GetSize() );
199 for (
unsigned int i = 0; i < TImage::ImageDimension; ++i )
203 m_EndOffset = m_Image->ComputeOffset(ind);
207 m_PixelAccessor = ptr->GetPixelAccessor();
208 m_PixelAccessorFunctor.SetPixelAccessor(m_PixelAccessor);
209 m_PixelAccessorFunctor.SetBegin(m_Buffer);
225 m_PixelAccessorFunctor.SetBegin(m_Buffer);
231 static unsigned int GetImageIteratorDimension()
232 {
return TImage::ImageDimension; }
246 operator==(
const Self & it)
const
255 operator<=(
const Self & it)
const
265 operator<(
const Self & it)
const
275 operator>=(
const Self & it)
const
285 operator>(
const Self & it)
const
297 {
return m_Image->ComputeIndex( static_cast< OffsetValueType >( m_Offset ) ); }
302 { m_Offset = m_Image->ComputeOffset(ind); }
306 const RegionType & GetRegion()
const
311 {
return m_Image.GetPointer(); }
315 {
return m_PixelAccessorFunctor.Get( *( m_Buffer + m_Offset ) ); }
321 {
return *( m_Buffer + m_Offset ); }
327 itkLegacyMacro(Self Begin(
void)
const);
333 m_Offset = m_BeginOffset;
340 itkLegacyMacro(Self End(
void)
const);
346 m_Offset = m_EndOffset;
351 bool IsAtBegin(
void)
const
353 return ( m_Offset == m_BeginOffset );
358 bool IsAtEnd(
void)
const
360 return ( m_Offset == m_EndOffset );
380 #define ITK_TEMPLATE_ImageConstIterator(_, EXPORT, TypeX, TypeY) \
383 _( 1 ( class EXPORT ImageConstIterator< ITK_TEMPLATE_1 TypeX > ) ) \
384 namespace Templates \
386 typedef ImageConstIterator< ITK_TEMPLATE_1 TypeX > ImageConstIterator##TypeY; \
390 #if ITK_TEMPLATE_EXPLICIT
391 #include "Templates/itkImageConstIterator+-.h"
395 #include "itkImageConstIterator.hxx"