18 #ifndef itkRLEImageConstIterator_h
19 #define itkRLEImageConstIterator_h
30 class MultiLabelMeshPipeline;
41 template<
typename TPixel,
unsigned int VImageDimension,
typename CounterType >
44 friend class ::MultiLabelMeshPipeline;
103 m_SegmentRemainder = 0;
115 m_RunLengthLine = it.m_RunLengthLine;
117 m_Index0 = it.m_Index0;
118 this->m_BI = it.m_BI;
121 m_RealIndex = it.m_RealIndex;
122 m_SegmentRemainder = it.m_SegmentRemainder;
123 m_BeginIndex0 = it.m_BeginIndex0;
124 m_EndIndex0 = it.m_EndIndex0;
145 m_RunLengthLine = it.m_RunLengthLine;
147 m_Index0 = it.m_Index0;
151 m_RealIndex = it.m_RealIndex;
152 m_SegmentRemainder = it.m_SegmentRemainder;
153 m_BeginIndex0 = it.m_BeginIndex0;
154 m_EndIndex0 = it.m_EndIndex0;
168 itkAssertOrThrowMacro( ( bufferedRegion.
IsInside( region ) ),
169 "Region " << region <<
" is outside of buffered region " << bufferedRegion );
174 m_BeginIndex0 = m_Index0 -
m_Image->GetBufferedRegion().GetIndex( 0 );
175 m_EndIndex0 = m_BeginIndex0 + region.
GetSize( 0 );
176 SetIndexInternal( m_BeginIndex0 );
183 return VImageDimension;
191 return m_BI != it.m_BI || m_Index0 + m_BeginIndex0 != it.m_Index0 + it.m_BeginIndex0;
199 return m_BI == it.m_BI && m_Index0 + m_BeginIndex0 == it.m_Index0 + it.m_BeginIndex0;
207 if ( m_BI < it.m_BI )
211 else if ( m_BI > it.m_BI )
215 return m_Index0 + m_BeginIndex0 <= it.m_Index0 + it.m_BeginIndex0;
224 if ( m_BI < it.m_BI )
228 else if ( m_BI > it.m_BI )
232 return m_Index0 + m_BeginIndex0 < it.m_Index0 + it.m_BeginIndex0;
241 if ( m_BI > it.m_BI )
245 else if ( m_BI < it.m_BI )
249 return m_Index0 + m_BeginIndex0 >= it.m_Index0 + it.m_BeginIndex0;
258 if ( m_BI > it.m_BI )
262 else if ( m_BI < it.m_BI )
266 return m_Index0 + m_BeginIndex0 > it.m_Index0 + it.m_BeginIndex0;
280 indR[i] = bufInd[i - 1];
292 bufInd[i - 1] = ind[i];
295 SetIndexInternal( ind[0] -
m_Image->GetBufferedRegion().GetIndex( 0 ) );
306 r.
SetIndex( 0, m_BeginIndex0 +
m_Image->GetBufferedRegion().GetIndex( 0 ) );
307 r.
SetSize( 0, m_EndIndex0 - m_BeginIndex0 );
311 r.
SetIndex( i, ir.GetIndex( i - 1 ) );
312 r.
SetSize( i, ir.GetSize( i - 1 ) );
339 return line[m_RealIndex].second;
348 SetIndexInternal( m_BeginIndex0 );
358 m_Index0 = m_BeginIndex0;
367 return m_Index0 == m_BeginIndex0 && m_BI.IsAtBegin();
375 return m_Index0 == m_BeginIndex0 && m_BI.IsAtEnd();
384 m_RunLengthLine = &m_BI.Value();
389 for (; x < ( *m_RunLengthLine ).size(); x++ )
391 t += ( *m_RunLengthLine )[x].first;
398 m_SegmentRemainder = t - m_Index0;
417 template<
typename TPixel,
unsigned int VImageDimension,
typename CounterType >
432 this->m_BI.GoToReverseBegin();
433 this->m_Index0 = this->m_EndIndex0 - 1;
434 SetIndexInternal( this->m_Index0 );
440 return this->m_BI.IsAtReverseEnd();
464 template<
typename TPixel,
unsigned int VImageDimension,
typename CounterType >
498 #endif // itkRLEImageConstIterator_h
void SetSize(const SizeType &size)
itk::ImageConstIterator< RLEImage< TPixel, VImageDimension, CounterType > >::RegionType RegionType
const IndexValueType * GetIndex() const
Superclass::RegionType RegionType
virtual void SetRegion(const RegionType ®ion)
bool operator!=(const Self &it) const
const IndexType & GetIndex() const
bool operator==(const Self &it) const
ImageType::IndexType IndexType
ImageType::InternalPixelType InternalPixelType
Superclass::OffsetType OffsetType
bool IsInside(const IndexType &index) const
itk::ImageConstIterator< RLEImage< TPixel, VImageDimension, CounterType > >::RegionType RegionType
Self & operator=(const Self &it)
ImageType::ConstWeakPointer m_Image
ImageConstIteratorWithIndex(const ImageType *ptr, const RegionType ®ion)
ImageConstIteratorWithOnlyIndex()
IndexValueType m_EndIndex0
An image region represents a structured region of data.
itkTypeMacroNoParent(ImageConstIterator)
ImageType::RegionType RegionType
Superclass::SizeType SizeType
ImageType::BufferType BufferType
ImageConstIteratorWithIndex()
SizeValueType m_RealIndex
Implements a weak reference to an object.
virtual void SetIndex(const IndexType &ind)
unsigned long SizeValueType
ImageType::SizeType SizeType
const RLLine * m_RunLengthLine
const ImageType * GetImage() const
bool operator>=(const Self &it) const
A multi-dimensional image iterator templated over image type.
Self & operator=(const Self &it)
A base class for multi-dimensional iterators templated over image type that are designed to efficient...
ImageConstIteratorWithOnlyIndex(const ImageType *ptr, const RegionType ®ion)
ImageType::PixelType PixelType
virtual ~ImageConstIterator()
const IndexType GetIndex() const
Superclass::IndexType IndexType
const InternalPixelType * m_Buffer
A base class for multi-dimensional iterators templated over image type that are designed to provide o...
RLEImage< TPixel, VImageDimension, CounterType > ImageType
bool IsAtBegin(void) const
TImage::ConstWeakPointer m_Image
RLEImage< TPixel, VImageDimension, CounterType > ImageType
BufferType::Pointer m_Buffer
const SizeType & GetSize() const
static unsigned int GetImageIteratorDimension()
ImageConstIteratorWithIndex(const ImageConstIteratorWithIndex &it)
ImageType::OffsetType OffsetType
bool operator>(const Self &it) const
bool operator<(const Self &it) const
TImage::IndexType IndexType
TImage::PixelType PixelType
IndexValueType m_SegmentRemainder
static const unsigned int ImageIteratorDimension
PixelType Get(void) const
RLEImage< TPixel, VImageDimension, CounterType > ImageType
virtual void SetIndexInternal(const IndexValueType ind0)
const PixelType & Value(void) const
TImage::RegionType RegionType
Run-Length Encoded image. It saves memory for label images at the expense of processing times...
ImageType::IndexValueType IndexValueType
ImageConstIteratorWithOnlyIndex(const ImageConstIteratorWithOnlyIndex &it)
SizeValueType GetNumberOfPixels() const
std::vector< RLSegment > RLLine
void SetIndex(const IndexType &index)
ImageRegionIterator< BufferType > BufferIterator
ImageConstIterator(const Self &it)
void SetIndex(const IndexValueType val[VIndexDimension])
virtual void SetRegion(const RegionType ®ion)
ImageConstIterator(const ImageType *ptr, const RegionType ®ion)
Superclass::IndexValueType IndexValueType
Templated n-dimensional image class.
bool operator<=(const Self &it) const
const RegionType GetRegion() const
IndexValueType m_BeginIndex0
const ImageType * GetImage() const
const PixelType & Value(void) const