18 #ifndef __itkImageRegionReverseConstIterator_h
19 #define __itkImageRegionReverseConstIterator_h
102 template<
typename TImage >
115 enum { ImageIteratorDimension = Superclass::ImageIteratorDimension };
158 m_SpanBeginOffset = 0;
167 m_SpanBeginOffset = this->m_BeginOffset;
168 m_SpanEndOffset = this->m_BeginOffset -
static_cast< OffsetValueType >( this->m_Region.GetSize()[0] );
183 m_SpanBeginOffset = this->m_Offset +
static_cast< OffsetValueType >( this->m_Region.GetSize()[0] )
184 - ( ind[0] - this->m_Region.GetIndex()[0] );
185 m_SpanEndOffset = m_SpanBeginOffset -
static_cast< OffsetValueType >( this->m_Region.GetSize()[0] );
194 m_SpanBeginOffset = this->m_Offset +
static_cast< OffsetValueType >( this->m_Region.GetSize()[0] )
195 - ( ind[0] - this->m_Region.GetIndex()[0] );
196 m_SpanEndOffset = m_SpanBeginOffset -
static_cast< OffsetValueType >( this->m_Region.GetSize()[0] );
205 m_SpanBeginOffset = this->m_Offset +
static_cast< OffsetValueType >( this->m_Region.GetSize()[0] )
206 - ( ind[0] - this->m_Region.GetIndex()[0] );
207 m_SpanEndOffset = m_SpanBeginOffset -
static_cast< OffsetValueType >( this->m_Region.GetSize()[0] );
214 Superclass::GoToBegin();
217 m_SpanBeginOffset = this->m_BeginOffset;
218 m_SpanEndOffset = this->m_BeginOffset -
static_cast< OffsetValueType >( this->m_Region.GetSize()[0] );
225 Superclass::GoToEnd();
228 m_SpanEndOffset = this->m_EndOffset;
229 m_SpanBeginOffset = m_SpanEndOffset +
static_cast< OffsetValueType >( this->m_Region.GetSize()[0] );
235 itkLegacyMacro(Self Begin(
void)
const);
241 itkLegacyMacro(Self End(
void)
const);
248 Superclass::SetIndex(ind);
249 m_SpanBeginOffset = this->m_Offset +
static_cast< OffsetValueType >( this->m_Region.GetSize()[0] )
250 - ( ind[0] - this->m_Region.GetIndex()[0] );
251 m_SpanEndOffset = m_SpanBeginOffset -
static_cast< OffsetValueType >( this->m_Region.GetSize()[0] );
266 if ( --this->m_Offset <= m_SpanEndOffset )
276 ind = this->m_Image->ComputeIndex( static_cast< OffsetValueType >( this->m_Offset ) );
279 startIndex = this->m_Region.GetIndex();
281 size = this->m_Region.GetSize();
289 done = ( --ind[0] == startIndex[0] - 1 );
290 for (
unsigned int i = 1; done && i < ImageIteratorDimension; i++ )
292 done = ( ind[i] == startIndex[i] );
300 while ( ( dim < ImageIteratorDimension - 1 )
301 && ( ind[dim] < startIndex[dim] ) )
303 ind[dim] = startIndex[dim] +
static_cast< OffsetValueType >( size[dim] ) - 1;
307 this->m_Offset = this->m_Image->ComputeOffset(ind);
308 m_SpanBeginOffset = this->m_Offset;
309 m_SpanEndOffset = m_SpanBeginOffset -
static_cast< OffsetValueType >( size[0] );
324 if ( ++this->m_Offset >= m_SpanBeginOffset )
334 ind = this->m_Image->ComputeIndex( static_cast< OffsetValueType >( this->m_Offset ) );
337 startIndex = this->m_Region.
GetIndex();
339 size = this->m_Region.GetSize();
347 done = ( ++ind[0] == startIndex[0] +
static_cast< OffsetValueType >( size[0] ) );
348 for (
unsigned int i = 1; done && i < ImageIteratorDimension; i++ )
350 done = ( ind[i] == startIndex[i] +
static_cast< OffsetValueType >( size[i] ) - 1 );
358 while ( ( dim < ImageIteratorDimension - 1 )
359 && ( ind[dim] > startIndex[dim] +
static_cast< OffsetValueType >( size[dim] ) - 1 ) )
361 ind[dim] = startIndex[dim];
365 this->m_Offset = this->m_Image->ComputeOffset(ind);
366 m_SpanBeginOffset = this->m_Offset;
367 m_SpanEndOffset = this->m_Offset -
static_cast< OffsetValueType >( size[0] );
378 #ifndef ITK_MANUAL_INSTANTIATION
379 #include "itkImageRegionReverseConstIterator.hxx"