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);
194 m_PixelAccessorFunctor.SetBegin(m_Buffer);
200 virtual void SetRegion(
const RegionType & region)
204 if ( region.GetNumberOfPixels() > 0 )
206 const RegionType & bufferedRegion = m_Image->GetBufferedRegion();
207 itkAssertOrThrowMacro( ( bufferedRegion.IsInside(m_Region) ),
208 "Region " << m_Region <<
" is outside of buffered region " << bufferedRegion );
212 m_Offset = m_Image->ComputeOffset( m_Region.GetIndex() );
213 m_BeginOffset = m_Offset;
219 if ( m_Region.GetNumberOfPixels() == 0 )
222 m_EndOffset = m_BeginOffset;
227 SizeType size( m_Region.GetSize() );
228 for (
unsigned int i = 0; i < TImage::ImageDimension; ++i )
232 m_EndOffset = m_Image->ComputeOffset(ind);
238 static unsigned int GetImageIteratorDimension()
239 {
return TImage::ImageDimension; }
253 operator==(
const Self & it)
const
262 operator<=(
const Self & it)
const
272 operator<(
const Self & it)
const
282 operator>=(
const Self & it)
const
292 operator>(
const Self & it)
const
304 {
return m_Image->ComputeIndex( static_cast< OffsetValueType >( m_Offset ) ); }
309 { m_Offset = m_Image->ComputeOffset(ind); }
313 const RegionType & GetRegion()
const
318 {
return m_Image.GetPointer(); }
322 {
return m_PixelAccessorFunctor.Get( *( m_Buffer + m_Offset ) ); }
328 {
return *( m_Buffer + m_Offset ); }
334 itkLegacyMacro(Self Begin(
void)
const);
340 m_Offset = m_BeginOffset;
347 itkLegacyMacro(Self End(
void)
const);
353 m_Offset = m_EndOffset;
358 bool IsAtBegin(
void)
const
360 return ( m_Offset == m_BeginOffset );
365 bool IsAtEnd(
void)
const
367 return ( m_Offset == m_EndOffset );
386 #ifndef ITK_MANUAL_INSTANTIATION
387 #include "itkImageConstIterator.hxx"