18 #ifndef __itkImageLinearConstIteratorWithIndex_h
19 #define __itkImageLinearConstIteratorWithIndex_h
102 template<
typename TImage >
152 inline void NextLine(
void);
156 inline void PreviousLine(
void);
160 void GoToBeginOfLine(
void);
164 void GoToReverseBeginOfLine(
void);
168 void GoToEndOfLine(
void);
171 inline bool IsAtEndOfLine(
void)
173 return this->m_PositionIndex[m_Direction] >= this->m_EndIndex[m_Direction];
177 inline bool IsAtReverseEndOfLine(
void)
179 return this->m_PositionIndex[m_Direction] < this->m_BeginIndex[m_Direction];
183 inline void SetDirection(
unsigned int direction)
185 if ( direction >= TImage::ImageDimension )
187 itkGenericExceptionMacro(
188 <<
"In image of dimension " << TImage::ImageDimension <<
" Direction " << direction <<
" sas selected");
190 m_Direction = direction;
191 m_Jump = this->m_OffsetTable[m_Direction];
196 unsigned int GetDirection()
205 this->m_PositionIndex[m_Direction]++;
206 this->m_Position += m_Jump;
215 this->m_PositionIndex[m_Direction]--;
216 this->m_Position -= m_Jump;
229 template<
class TImage >
235 this->m_Position -= this->m_OffsetTable[m_Direction]
236 * ( this->m_PositionIndex[m_Direction] - this->m_BeginIndex[m_Direction] );
238 this->m_PositionIndex[m_Direction] = this->m_BeginIndex[m_Direction];
240 for (
unsigned int n = 0; n < TImage::ImageDimension; n++ )
242 this->m_Remaining =
false;
244 if ( n == m_Direction )
249 this->m_PositionIndex[n]++;
250 if ( this->m_PositionIndex[n] < this->m_EndIndex[n] )
252 this->m_Position += this->m_OffsetTable[n];
253 this->m_Remaining =
true;
258 this->m_Position -= this->m_OffsetTable[n] * ( this->m_Region.GetSize()[n] - 1 );
259 this->m_PositionIndex[n] = this->m_BeginIndex[n];
267 template<
class TImage >
273 this->m_Position += this->m_OffsetTable[m_Direction]
274 * ( this->m_EndIndex[m_Direction] - 1 - this->m_PositionIndex[m_Direction] );
276 this->m_PositionIndex[m_Direction] = this->m_EndIndex[m_Direction] - 1;
278 for (
unsigned int n = 0; n < TImage::ImageDimension; n++ )
280 this->m_Remaining =
false;
282 if ( n == m_Direction )
287 this->m_PositionIndex[n]--;
288 if ( this->m_PositionIndex[n] >= this->m_BeginIndex[n] )
290 this->m_Position -= this->m_OffsetTable[n];
291 this->m_Remaining =
true;
296 this->m_Position += this->m_OffsetTable[n] * ( this->m_Region.GetSize()[n] - 1 );
297 this->m_PositionIndex[n] = this->m_EndIndex[n] - 1;
304 #define ITK_TEMPLATE_ImageLinearConstIteratorWithIndex(_, EXPORT, TypeX, TypeY) \
307 _( 1 ( class EXPORT ImageLinearConstIteratorWithIndex< ITK_TEMPLATE_1 TypeX > ) ) \
308 namespace Templates \
310 typedef ImageLinearConstIteratorWithIndex< ITK_TEMPLATE_1 TypeX > \
311 ImageLinearConstIteratorWithIndex##TypeY; \
315 #if ITK_TEMPLATE_EXPLICIT
316 #include "Templates/itkImageLinearConstIteratorWithIndex+-.h"
320 #include "itkImageLinearConstIteratorWithIndex.hxx"