18#ifndef itkImageLinearConstIteratorWithIndex_h
19#define itkImageLinearConstIteratorWithIndex_h
100template <
typename TImage>
182 return this->m_PositionIndex[m_Direction] >= this->m_EndIndex[m_Direction];
189 return this->m_PositionIndex[m_Direction] < this->m_BeginIndex[m_Direction];
196 if (direction >= TImage::ImageDimension)
198 itkGenericExceptionMacro(
"In image of dimension " << TImage::ImageDimension <<
" Direction " << direction
201 m_Direction = direction;
202 m_Jump = this->m_OffsetTable[m_Direction];
218 this->m_PositionIndex[m_Direction]++;
219 this->m_Position += m_Jump;
229 this->m_PositionIndex[m_Direction]--;
230 this->m_Position -= m_Jump;
237 unsigned int m_Direction{ 0 };
243template <
typename TImage>
248 this->m_OffsetTable[m_Direction] * (this->m_PositionIndex[m_Direction] - this->m_BeginIndex[m_Direction]);
250 this->m_PositionIndex[m_Direction] = this->m_BeginIndex[m_Direction];
252 for (
unsigned int n = 0; n < TImage::ImageDimension; ++n)
254 this->m_Remaining =
false;
256 if (n == m_Direction)
261 this->m_PositionIndex[n]++;
262 if (this->m_PositionIndex[n] < this->m_EndIndex[n])
264 this->m_Position += this->m_OffsetTable[n];
265 this->m_Remaining =
true;
270 this->m_Position -= this->m_OffsetTable[n] * (this->m_Region.GetSize()[n] - 1);
271 this->m_PositionIndex[n] = this->m_BeginIndex[n];
279template <
typename TImage>
284 this->m_OffsetTable[m_Direction] * (this->m_EndIndex[m_Direction] - 1 - this->m_PositionIndex[m_Direction]);
286 this->m_PositionIndex[m_Direction] = this->m_EndIndex[m_Direction] - 1;
288 for (
unsigned int n = 0; n < TImage::ImageDimension; ++n)
290 this->m_Remaining =
false;
292 if (n == m_Direction)
297 this->m_PositionIndex[n]--;
298 if (this->m_PositionIndex[n] >= this->m_BeginIndex[n])
300 this->m_Position -= this->m_OffsetTable[n];
301 this->m_Remaining =
true;
306 this->m_Position += this->m_OffsetTable[n] * (this->m_Region.GetSize()[n] - 1);
307 this->m_PositionIndex[n] = this->m_EndIndex[n] - 1;
313#ifndef ITK_MANUAL_INSTANTIATION
314# include "itkImageLinearConstIteratorWithIndex.hxx"
Pixel-wise addition of two images.
A base class for multi-dimensional iterators templated over image type that are designed to efficient...
typename OffsetType::OffsetValueType OffsetValueType
Self & operator=(const Self &it)
typename TImage::RegionType RegionType
typename PixelContainer::Pointer PixelContainerPointer
typename TImage::IndexType IndexType
typename TImage::PixelContainer PixelContainer
A multi-dimensional image iterator that visits image pixels within a region in a "scan-line" order.
ImageLinearConstIteratorWithIndex()
bool IsAtReverseEndOfLine() const
void GoToReverseBeginOfLine()
ImageLinearConstIteratorWithIndex(const ImageType *ptr, const RegionType ®ion)
ImageLinearConstIteratorWithIndex(const ImageConstIteratorWithIndex< TImage > &it)
void SetDirection(unsigned int direction)
bool IsAtEndOfLine() const
unsigned int GetDirection()
SmartPointer< Self > Pointer
ImageBaseType::RegionType RegionType
ImageBaseType::IndexType IndexType
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....