KWStyle - itkImageRegionConstIteratorWithIndex.txx
 
Matrix View
Description

1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkImageRegionConstIteratorWithIndex.txx.html,v $
5   Language:  C++
6   Date:      $Date: 2006/01/17 19:15:39 $
7   Version:   $Revision: 1.4 $
8
9   Copyright (c) Insight Software Consortium. All rights reserved.
10   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11
12      This software is distributed WITHOUT ANY WARRANTY; without even 
13      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14      PURPOSE.  See the above copyright notices for more information.
15
16 =========================================================================*/
17 DEF #ifndef _itkImageRegionConstIteratorWithIndex_txx
18 DEF #define _itkImageRegionConstIteratorWithIndex_txx
19
20 #include "itkImageRegionConstIteratorWithIndex.h"
21
22 namespace itk
23 {
24   
25 //----------------------------------------------------------------------
26 //  Advance along the line
27 //----------------------------------------------------------------------
28 template<class TImage>
29 ImageRegionConstIteratorWithIndex<TImage> &
30 ImageRegionConstIteratorWithIndex<TImage>
31 ::operator++()
32 {
33   
34   this->m_Remaining = false;
35   for( unsigned int in=0; in<TImage::ImageDimension; in++ )
36     {
37     this->m_PositionIndex[ in  ]++;
38     if( this->m_PositionIndex[ in ] < this->m_EndIndex[ in ] )
39       {
40       this->m_Position += this->m_OffsetTable[in];
41       this->m_Remaining = true;
42       break;
43       }
44     else 
45       {
46       this->m_Position -= this->m_OffsetTable[ in ]
47 IND ********* ( static_cast<long>(this->m_Region.GetSize()[in])-1 );
48       this->m_PositionIndex[ in ] = this->m_BeginIndex[ in ]; 
49       }
50     }
51
52   if( !this->m_Remaining ) // It will not advance here otherwise
53     {
54     this->m_Position = this->m_End;
55     }
56
57   return *this;
58 }
59
60
61 //----------------------------------------------------------------------
62 //  Advance along the line in reverse direction
63 //----------------------------------------------------------------------
64 template<class TImage>
65 ImageRegionConstIteratorWithIndex<TImage> &
66 ImageRegionConstIteratorWithIndex<TImage>
67 ::operator--()
68 {
69   
70   this->m_Remaining = false;
71   for( unsigned int in=0; in<TImage::ImageDimension; in++ )
72     {
73       
74     if( this->m_PositionIndex[ in ] > this->m_BeginIndex[ in ] )
75       {
76       this->m_PositionIndex[ in  ]--;
77       this->m_Position -= this->m_OffsetTable[in];
78       this->m_Remaining = true;
79       break;
80       }
81     else 
82       {
83       this->m_PositionIndex[ in  ]--;
84       this->m_Position += this->m_OffsetTable[ in ]
85 IND ********* ( static_cast<long>(this->m_Region.GetSize()[in])-1 );
86       this->m_PositionIndex[ in ] = this->m_EndIndex[ in ] - 1; 
87       }
88
89     }
90
91   if( !this->m_Remaining ) // It will not advance here otherwise
92     {
93     this->m_Position = this->m_End;
94     }
95
96   return *this;
97 }
98
99 // end namespace itk
100
101 #endif
102

Generated by KWStyle 1.0b on Tuesday January,17 at 02:14:14PM
© Kitware Inc.