18 #ifndef itkImageConstIterator_h
19 #define itkImageConstIterator_h
83 template<
typename TImage >
94 itkStaticConstMacro(ImageIteratorDimension,
unsigned int,
95 TImage::ImageDimension);
137 m_PixelAccessorFunctor()
139 m_Image = ITK_NULLPTR;
140 m_Buffer = ITK_NULLPTR;
144 m_PixelAccessorFunctor.SetBegin(m_Buffer);
165 m_PixelAccessorFunctor.SetBegin(m_Buffer);
174 m_Buffer = m_Image->GetBufferPointer();
179 m_PixelAccessor = ptr->GetPixelAccessor();
180 m_PixelAccessorFunctor.SetPixelAccessor(m_PixelAccessor);
181 m_PixelAccessorFunctor.SetBegin(m_Buffer);
200 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;
226 SizeType size( m_Region.GetSize() );
227 if ( m_Region.GetNumberOfPixels() == 0 )
230 m_EndOffset = m_BeginOffset;
234 for (
unsigned int i = 0; i < TImage::ImageDimension; ++i )
238 m_EndOffset = m_Image->ComputeOffset(ind);
245 {
return TImage::ImageDimension; }
268 operator<=(
const Self & it)
const
278 operator<(
const Self & it)
const
310 {
return m_Image->ComputeIndex( static_cast< OffsetValueType >( m_Offset ) ); }
315 { m_Offset = m_Image->ComputeOffset(ind); }
324 {
return m_Image.GetPointer(); }
328 {
return m_PixelAccessorFunctor.Get( *( m_Buffer + m_Offset ) ); }
334 {
return *( m_Buffer + m_Offset ); }
340 itkLegacyMacro(Self Begin(
void)
const);
346 m_Offset = m_BeginOffset;
353 itkLegacyMacro(Self End(
void)
const);
359 m_Offset = m_EndOffset;
366 return ( m_Offset == m_BeginOffset );
373 return ( m_Offset == m_EndOffset );
392 #ifndef ITK_MANUAL_INSTANTIATION
393 #include "itkImageConstIterator.hxx"
bool operator!=(const Self &it) const
PixelContainer::Pointer PixelContainerPointer
const RegionType & GetRegion() const
virtual ~ImageConstIterator()
OffsetValueType m_BeginOffset
signed long OffsetValueType
signed long IndexValueType
const IndexType GetIndex() const
OffsetValueType m_EndOffset
bool IsAtBegin(void) const
AccessorType m_PixelAccessor
TImage::AccessorFunctorType AccessorFunctorType
A multi-dimensional image iterator templated over image type.
Self & operator=(const Self &it)
AccessorFunctorType m_PixelAccessorFunctor
ImageConstIterator(const Self &it)
TImage::AccessorType AccessorType
TImage::InternalPixelType InternalPixelType
virtual void SetIndex(const IndexType &ind)
const InternalPixelType * m_Buffer
ImageConstIterator(const ImageType *ptr, const RegionType ®ion)
TImage::ConstWeakPointer m_Image
bool operator==(const Self &it) const
TImage::IndexType IndexType
TImage::PixelType PixelType
static unsigned int GetImageIteratorDimension()
ImageBaseType::SizeType SizeType
bool operator>(const Self &it) const
TImage::RegionType RegionType
TImage::PixelContainer PixelContainer
PixelType Get(void) const
virtual void SetRegion(const RegionType ®ion)
bool operator>=(const Self &it) const
TImage::OffsetType OffsetType
TImage::SizeType SizeType
const ImageType * GetImage() const
ImageBaseType::IndexType IndexType
const PixelType & Value(void) const