<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta name="robots" content="noindex"> <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>ITK: itkImageRegionReverseConstIterator.h Source File</title> <link href="DoxygenStyle.css" rel="stylesheet" type="text/css"> </head><body bgcolor="#ffffff"> <!-- Section customized for INSIGHT : Tue Jul 17 01:02:45 2001 --> <center> <a href="index.html" class="qindex">Main Page</a> <a href="modules.html" class="qindex">Groups</a> <a href="namespaces.html" class="qindex">Namespace List</a> <a href="hierarchy.html" class="qindex">Class Hierarchy</a> <a href="classes.html" class="qindex">Alphabetical List</a> <a href="annotated.html" class="qindex">Compound List</a> <a href="files.html" class="qindex">File List</a> <a href="namespacemembers.html" class="qindex">Namespace Members</a> <a href="functions.html" class="qindex">Compound Members</a> <a href="globals.html" class="qindex">File Members</a> <a href="pages.html" class="qindex">Concepts</a></center> <!-- Generated by Doxygen 1.5.9 --> <div class="navpath"><a class="el" href="dir_02e23d841c198393a6e961e9a0678fff.html">Code</a> » <a class="el" href="dir_ea7fc529ede9a38b0438cf13831ae873.html">Common</a> </div> <div class="contents"> <h1>itkImageRegionReverseConstIterator.h</h1><a href="itkImageRegionReverseConstIterator_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*=========================================================================</span> <a name="l00002"></a>00002 <span class="comment"></span> <a name="l00003"></a>00003 <span class="comment"> Program: Insight Segmentation & Registration Toolkit</span> <a name="l00004"></a>00004 <span class="comment"> Module: $RCSfile: itkImageRegionReverseConstIterator.h,v $</span> <a name="l00005"></a>00005 <span class="comment"> Language: C++</span> <a name="l00006"></a>00006 <span class="comment"> Date: $Date: 2008-10-18 21:13:25 $</span> <a name="l00007"></a>00007 <span class="comment"> Version: $Revision: 1.8 $</span> <a name="l00008"></a>00008 <span class="comment"></span> <a name="l00009"></a>00009 <span class="comment"> Copyright (c) Insight Software Consortium. All rights reserved.</span> <a name="l00010"></a>00010 <span class="comment"> See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.</span> <a name="l00011"></a>00011 <span class="comment"></span> <a name="l00012"></a>00012 <span class="comment"> This software is distributed WITHOUT ANY WARRANTY; without even </span> <a name="l00013"></a>00013 <span class="comment"> the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR </span> <a name="l00014"></a>00014 <span class="comment"> PURPOSE. See the above copyright notices for more information.</span> <a name="l00015"></a>00015 <span class="comment"></span> <a name="l00016"></a>00016 <span class="comment">=========================================================================*/</span> <a name="l00017"></a>00017 <span class="preprocessor">#ifndef __itkImageRegionReverseConstIterator_h</span> <a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#define __itkImageRegionReverseConstIterator_h</span> <a name="l00019"></a>00019 <span class="preprocessor"></span> <a name="l00020"></a>00020 <span class="preprocessor">#include "<a class="code" href="itkImageReverseConstIterator_8h.html">itkImageReverseConstIterator.h</a>"</span> <a name="l00021"></a>00021 <span class="preprocessor">#include "<a class="code" href="itkImageRegionIterator_8h.html">itkImageRegionIterator.h</a>"</span> <a name="l00022"></a>00022 <a name="l00023"></a>00023 <span class="keyword">namespace </span>itk <a name="l00024"></a>00024 { <a name="l00025"></a>00025 <a name="l00100"></a>00100 <span class="keyword">template</span><<span class="keyword">typename</span> TImage> <a name="l00101"></a><a class="code" href="classitk_1_1ImageRegionReverseConstIterator.html">00101</a> <span class="keyword">class </span><a class="code" href="itkWin32Header_8h.html#7d4384322557205d75f0719c012dded6">ITK_EXPORT</a> <a class="code" href="classitk_1_1ImageRegionReverseConstIterator.html" title="A multi-dimensional image iterator designed to walk a specified image region in reverse...">ImageRegionReverseConstIterator</a> : <span class="keyword">public</span> <a class="code" href="classitk_1_1ImageReverseConstIterator.html" title="Multi-dimensional image iterator.">ImageReverseConstIterator</a><TImage> <a name="l00102"></a>00102 { <a name="l00103"></a>00103 <span class="keyword">public</span>: <a name="l00104"></a>00104 <a name="l00106"></a><a class="code" href="classitk_1_1ImageRegionReverseConstIterator.html#8e70f2be4ae8788f0113e419abbe25ff">00106</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1ImageRegionReverseConstIterator.html" title="A multi-dimensional image iterator designed to walk a specified image region in reverse...">ImageRegionReverseConstIterator</a> <a class="code" href="classitk_1_1ImageRegionReverseConstIterator.html" title="A multi-dimensional image iterator designed to walk a specified image region in reverse...">Self</a>; <a name="l00107"></a><a class="code" href="classitk_1_1ImageRegionReverseConstIterator.html#88d0239001721e29085e8fa1eb286504">00107</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1ImageReverseConstIterator.html">ImageReverseConstIterator<TImage></a> <a class="code" href="classitk_1_1ImageReverseConstIterator.html">Superclass</a>; <a name="l00108"></a>00108 <a name="l00113"></a><a class="code" href="classitk_1_1ImageRegionReverseConstIterator.html#339f9e080e32075402fda794bea31c31ba59bb8e50c1ed098a42ca00e2fc4e7f">00113</a> <span class="keyword">enum</span> { ImageIteratorDimension = Superclass::ImageIteratorDimension }; <a name="l00114"></a>00114 <a name="l00117"></a><a class="code" href="classitk_1_1ImageRegionReverseConstIterator.html#af2f14190ae28db7f1ca6ce7930e5f9d">00117</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#be32dc19e71d40322ad9828b9ab40853">Superclass::IndexType</a> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#be32dc19e71d40322ad9828b9ab40853">IndexType</a>; <a name="l00118"></a><a class="code" href="classitk_1_1ImageRegionReverseConstIterator.html#cc70e1cf5dde5d1753b18e786bbfe2b6">00118</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> Superclass::IndexValueType IndexValueType; <a name="l00119"></a>00119 <a name="l00122"></a><a class="code" href="classitk_1_1ImageRegionReverseConstIterator.html#5227ce983e9a5547779d29ce9f954020">00122</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#5bf82236e1e50e653de84c8ead448599">Superclass::SizeType</a> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#5bf82236e1e50e653de84c8ead448599">SizeType</a>; <a name="l00123"></a><a class="code" href="classitk_1_1ImageRegionReverseConstIterator.html#6530052232b99bdf9f23e241cfae9ad0">00123</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> Superclass::SizeValueType SizeValueType; <a name="l00124"></a>00124 <a name="l00127"></a><a class="code" href="classitk_1_1ImageRegionReverseConstIterator.html#5da8ac6495ea6b3315406def062666ae">00127</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> Superclass::OffsetType OffsetType; <a name="l00128"></a><a class="code" href="classitk_1_1ImageRegionReverseConstIterator.html#621bb67ebd0f2919d8f7e625089dec3c">00128</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> Superclass::OffsetValueType OffsetValueType; <a name="l00129"></a>00129 <a name="l00131"></a><a class="code" href="classitk_1_1ImageRegionReverseConstIterator.html#e58c297bdcb66f2eabac1478b3b7de2f">00131</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#ed8c4a40607d317c666eb96ea265e126">Superclass::RegionType</a> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#ed8c4a40607d317c666eb96ea265e126">RegionType</a>; <a name="l00132"></a>00132 <a name="l00135"></a><a class="code" href="classitk_1_1ImageRegionReverseConstIterator.html#ed44d1db2e517009be9de19e2c6104a1">00135</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> Superclass::ImageType ImageType; <a name="l00136"></a>00136 <a name="l00140"></a><a class="code" href="classitk_1_1ImageRegionReverseConstIterator.html#ad9e6b7a89b0046feced39fc45ee362d">00140</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> Superclass::PixelContainer PixelContainer; <a name="l00141"></a><a class="code" href="classitk_1_1ImageRegionReverseConstIterator.html#349dbfc569d7e864ff646a244246b278">00141</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="itkFEMMacro_8h.html#539cce1a3282ba59952dedcbf9cdb23f">PixelContainer::Pointer</a> PixelContainerPointer; <a name="l00142"></a>00142 <a name="l00144"></a><a class="code" href="classitk_1_1ImageRegionReverseConstIterator.html#5ba529a925cd280fce28174cae796ea9">00144</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> Superclass::InternalPixelType InternalPixelType; <a name="l00145"></a>00145 <a name="l00147"></a><a class="code" href="classitk_1_1ImageRegionReverseConstIterator.html#6414034ee11f429d089aa1fe46c9d054">00147</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> Superclass::PixelType PixelType; <a name="l00148"></a>00148 <a name="l00151"></a><a class="code" href="classitk_1_1ImageRegionReverseConstIterator.html#e89093a3a6a344ece9658981597baf73">00151</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> Superclass::AccessorType AccessorType; <a name="l00152"></a>00152 <a name="l00154"></a>00154 <a class="code" href="itkMacro_8h.html#574c1f86661d409dd32c742307a0e96a">itkTypeMacro</a>(<a class="code" href="classitk_1_1ImageRegionReverseConstIterator.html" title="A multi-dimensional image iterator designed to walk a specified image region in reverse...">ImageRegionReverseConstIterator</a>, <a class="code" href="classitk_1_1ImageReverseConstIterator.html" title="Multi-dimensional image iterator.">ImageReverseConstIterator</a>); <a name="l00155"></a>00155 <a name="l00157"></a><a class="code" href="classitk_1_1ImageRegionReverseConstIterator.html#145b8389edb92645e75b7799bcedeb35">00157</a> <a class="code" href="classitk_1_1ImageRegionReverseConstIterator.html" title="A multi-dimensional image iterator designed to walk a specified image region in reverse...">ImageRegionReverseConstIterator</a>() : <a class="code" href="classitk_1_1ImageReverseConstIterator.html">Superclass</a>() <a name="l00158"></a>00158 { <a name="l00159"></a>00159 m_SpanBeginOffset = 0; <a name="l00160"></a>00160 m_SpanEndOffset = 0; <a name="l00161"></a>00161 } <a name="l00162"></a>00162 <a name="l00165"></a><a class="code" href="classitk_1_1ImageRegionReverseConstIterator.html#e08f49ecfeeb0b0ea6bdee281e5de67b">00165</a> <a class="code" href="classitk_1_1ImageRegionReverseConstIterator.html" title="A multi-dimensional image iterator designed to walk a specified image region in reverse...">ImageRegionReverseConstIterator</a>(ImageType *ptr, <span class="keyword">const</span> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#ed8c4a40607d317c666eb96ea265e126">RegionType</a> &region) <a name="l00166"></a>00166 : <a class="code" href="classitk_1_1ImageReverseConstIterator.html">Superclass</a>(ptr, region) <a name="l00167"></a>00167 { <a name="l00168"></a>00168 m_SpanBeginOffset = this->m_BeginOffset; <a name="l00169"></a>00169 m_SpanEndOffset = this->m_BeginOffset - <span class="keyword">static_cast<</span><span class="keywordtype">long</span><span class="keyword">></span>(this->m_Region.GetSize()[0]); <a name="l00170"></a>00170 } <a name="l00172"></a>00172 <a name="l00180"></a><a class="code" href="classitk_1_1ImageRegionReverseConstIterator.html#ef1f4e049d70c5abfcaa00216fde4cab">00180</a> <a class="code" href="classitk_1_1ImageRegionReverseConstIterator.html" title="A multi-dimensional image iterator designed to walk a specified image region in reverse...">ImageRegionReverseConstIterator</a>( <span class="keyword">const</span> <a class="code" href="classitk_1_1ImageConstIterator.html">ImageConstIterator<TImage></a> &it):<a class="code" href="classitk_1_1ImageReverseConstIterator.html">Superclass</a>(it) <a name="l00181"></a>00181 { <a name="l00182"></a>00182 <a class="code" href="namespaceHardConnectedComponentImageFilter.html#be32dc19e71d40322ad9828b9ab40853">IndexType</a> ind = this->GetIndex(); <a name="l00183"></a>00183 m_SpanBeginOffset = this->m_Offset + <span class="keyword">static_cast<</span><span class="keywordtype">long</span><span class="keyword">></span>(this->m_Region.GetSize()[0]) <a name="l00184"></a>00184 - (ind[0] - this->m_Region.GetIndex()[0]); <a name="l00185"></a>00185 m_SpanEndOffset = m_SpanBeginOffset - <span class="keyword">static_cast<</span><span class="keywordtype">long</span><span class="keyword">></span>(this->m_Region.GetSize()[0]); <a name="l00186"></a>00186 } <a name="l00188"></a>00188 <a name="l00191"></a><a class="code" href="classitk_1_1ImageRegionReverseConstIterator.html#dbeaee2277a287ccdd90ae75bf2e5c08">00191</a> <a class="code" href="classitk_1_1ImageRegionReverseConstIterator.html" title="A multi-dimensional image iterator designed to walk a specified image region in reverse...">ImageRegionReverseConstIterator</a>( <span class="keyword">const</span> <a class="code" href="classitk_1_1ImageReverseConstIterator.html">ImageReverseConstIterator<TImage></a> &it):<a class="code" href="classitk_1_1ImageReverseConstIterator.html">Superclass</a>(it) <a name="l00192"></a>00192 { <a name="l00193"></a>00193 <a class="code" href="namespaceHardConnectedComponentImageFilter.html#be32dc19e71d40322ad9828b9ab40853">IndexType</a> ind = this->GetIndex(); <a name="l00194"></a>00194 m_SpanBeginOffset = this->m_Offset + <span class="keyword">static_cast<</span><span class="keywordtype">long</span><span class="keyword">></span>(this->m_Region.GetSize()[0]) <a name="l00195"></a>00195 - (ind[0] - this->m_Region.GetIndex()[0]); <a name="l00196"></a>00196 m_SpanEndOffset = m_SpanBeginOffset - <span class="keyword">static_cast<</span><span class="keywordtype">long</span><span class="keyword">></span>(this->m_Region.GetSize()[0]); <a name="l00197"></a>00197 } <a name="l00199"></a>00199 <a name="l00202"></a><a class="code" href="classitk_1_1ImageRegionReverseConstIterator.html#531c2c6ffc9f6229f20f6126bdcd3b12">00202</a> <a class="code" href="classitk_1_1ImageRegionReverseConstIterator.html" title="A multi-dimensional image iterator designed to walk a specified image region in reverse...">ImageRegionReverseConstIterator</a>( <span class="keyword">const</span> <a class="code" href="classitk_1_1ImageRegionIterator.html" title="A multi-dimensional iterator templated over image type that walks a region of pixels...">ImageRegionIterator<TImage></a> &it):<a class="code" href="classitk_1_1ImageReverseConstIterator.html">Superclass</a>(it) <a name="l00203"></a>00203 { <a name="l00204"></a>00204 <a class="code" href="namespaceHardConnectedComponentImageFilter.html#be32dc19e71d40322ad9828b9ab40853">IndexType</a> ind = this->GetIndex(); <a name="l00205"></a>00205 m_SpanBeginOffset = this->m_Offset + <span class="keyword">static_cast<</span><span class="keywordtype">long</span><span class="keyword">></span>(this->m_Region.GetSize()[0]) <a name="l00206"></a>00206 - (ind[0] - this->m_Region.GetIndex()[0]); <a name="l00207"></a>00207 m_SpanEndOffset = m_SpanBeginOffset - <span class="keyword">static_cast<</span><span class="keywordtype">long</span><span class="keyword">></span>(this->m_Region.GetSize()[0]); <a name="l00208"></a>00208 } <a name="l00210"></a>00210 <a name="l00213"></a><a class="code" href="classitk_1_1ImageRegionReverseConstIterator.html#c46d7ba272c32f77f89fad36e1d53bc0">00213</a> <span class="keywordtype">void</span> GoToBegin() <a name="l00214"></a>00214 { <a name="l00215"></a>00215 Superclass::GoToBegin(); <a name="l00216"></a>00216 <a name="l00217"></a>00217 <span class="comment">// reset the span offsets</span> <a name="l00218"></a>00218 m_SpanBeginOffset = this->m_BeginOffset; <a name="l00219"></a>00219 m_SpanEndOffset = this->m_BeginOffset - <span class="keyword">static_cast<</span><span class="keywordtype">long</span><span class="keyword">></span>(this->m_Region.GetSize()[0]); <a name="l00220"></a>00220 } <a name="l00221"></a>00221 <a name="l00224"></a><a class="code" href="classitk_1_1ImageRegionReverseConstIterator.html#41f3b40e37dde813222e5135cb1e3071">00224</a> <span class="keywordtype">void</span> GoToEnd() <a name="l00225"></a>00225 { <a name="l00226"></a>00226 Superclass::GoToEnd(); <a name="l00227"></a>00227 <a name="l00228"></a>00228 <span class="comment">// reset the span offsets</span> <a name="l00229"></a>00229 m_SpanEndOffset = this->m_EndOffset; <a name="l00230"></a>00230 m_SpanBeginOffset = m_SpanEndOffset + <span class="keyword">static_cast<</span><span class="keywordtype">long</span><span class="keyword">></span>(this->m_Region.GetSize()[0]); <a name="l00231"></a>00231 } <a name="l00232"></a>00232 <a name="l00236"></a>00236 <a class="code" href="namespaceHardConnectedComponentImageFilter.html#ac7d0120fe5292cdcdddb6163b8cb150">Self</a> Begin(<span class="keywordtype">void</span>) <span class="keyword">const</span>; <a name="l00237"></a>00237 <a name="l00242"></a>00242 <a class="code" href="namespaceHardConnectedComponentImageFilter.html#ac7d0120fe5292cdcdddb6163b8cb150">Self</a> End(<span class="keywordtype">void</span>) <span class="keyword">const</span>; <a name="l00243"></a>00243 <a name="l00244"></a>00244 <a name="l00248"></a><a class="code" href="classitk_1_1ImageRegionReverseConstIterator.html#3d170ec9d1adeeb015d65c02c589e89c">00248</a> <span class="keywordtype">void</span> SetIndex(<span class="keyword">const</span> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#be32dc19e71d40322ad9828b9ab40853">IndexType</a> &ind) <a name="l00249"></a>00249 { <a name="l00250"></a>00250 Superclass::SetIndex(ind); <a name="l00251"></a>00251 m_SpanBeginOffset = this->m_Offset + <span class="keyword">static_cast<</span><span class="keywordtype">long</span><span class="keyword">></span>(this->m_Region.GetSize()[0]) <a name="l00252"></a>00252 - (ind[0] - this->m_Region.GetIndex()[0]); <a name="l00253"></a>00253 m_SpanEndOffset = m_SpanBeginOffset - <span class="keyword">static_cast<</span><span class="keywordtype">long</span><span class="keyword">></span>(this->m_Region.GetSize()[0]); <a name="l00254"></a>00254 } <a name="l00256"></a>00256 <a name="l00265"></a>00265 <a class="code" href="namespaceHardConnectedComponentImageFilter.html#ac7d0120fe5292cdcdddb6163b8cb150">Self</a> & <a name="l00266"></a><a class="code" href="classitk_1_1ImageRegionReverseConstIterator.html#6f7a7d0b8554faaf7a65fb861a7bf4b3">00266</a> operator++() <a name="l00267"></a>00267 { <a name="l00268"></a>00268 <span class="keywordflow">if</span> (--this->m_Offset <= m_SpanEndOffset) <a name="l00269"></a>00269 { <a name="l00270"></a>00270 <span class="comment">// We have past the beginning of the span (row), need to wrap around.</span> <a name="l00271"></a>00271 <a name="l00272"></a>00272 <span class="comment">// First move forward one pixel, because we are going to use a different</span> <a name="l00273"></a>00273 <span class="comment">// algorithm to compute the next pixel</span> <a name="l00274"></a>00274 this->m_Offset++; <a name="l00275"></a>00275 <a name="l00276"></a>00276 <span class="comment">// Get the index of the first pixel on the span (row)</span> <a name="l00277"></a>00277 <span class="keyword">typename</span> <a class="code" href="classitk_1_1ImageConstIterator.html" title="A multi-dimensional image iterator templated over image type.">ImageConstIterator<TImage>::IndexType</a> <a name="l00278"></a>00278 ind = this->m_Image->ComputeIndex( static_cast<OffsetValueType>(this->m_Offset) ); <a name="l00279"></a>00279 <a name="l00280"></a>00280 <span class="keyword">const</span> <span class="keyword">typename</span> <a class="code" href="classitk_1_1ImageConstIterator.html" title="A multi-dimensional image iterator templated over image type.">ImageConstIterator<TImage>::IndexType</a>& <a name="l00281"></a>00281 startIndex = this->m_Region.GetIndex(); <a name="l00282"></a>00282 <span class="keyword">const</span> <span class="keyword">typename</span> <a class="code" href="classitk_1_1ImageConstIterator.html" title="A multi-dimensional image iterator templated over image type.">ImageConstIterator<TImage>::SizeType</a>& <a name="l00283"></a>00283 size = this->m_Region.GetSize(); <a name="l00284"></a>00284 <a name="l00285"></a>00285 <span class="comment">// Deccrement along a row, then wrap at the beginning of the region row.</span> <a name="l00286"></a>00286 <span class="keywordtype">bool</span> done; <a name="l00287"></a>00287 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> dim; <a name="l00288"></a>00288 <a name="l00289"></a>00289 <span class="comment">// Check to see if we are past the first pixel in the region</span> <a name="l00290"></a>00290 <span class="comment">// Note that --ind[0] moves to the previous pixel along the row.</span> <a name="l00291"></a>00291 done = (--ind[0] == startIndex[0] - 1); <a name="l00292"></a>00292 <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=1; done && i < ImageIteratorDimension; i++) <a name="l00293"></a>00293 { <a name="l00294"></a>00294 done = (ind[i] == startIndex[i]); <a name="l00295"></a>00295 } <a name="l00296"></a>00296 <a name="l00297"></a>00297 <span class="comment">// if the iterator is outside the region (but not past region begin) then</span> <a name="l00298"></a>00298 <span class="comment">// we need to wrap around the region</span> <a name="l00299"></a>00299 dim = 0; <a name="l00300"></a>00300 <span class="keywordflow">if</span> (!done) <a name="l00301"></a>00301 { <a name="l00302"></a>00302 <span class="keywordflow">while</span> ( (dim < ImageIteratorDimension - 1) <a name="l00303"></a>00303 && (ind[dim] < startIndex[dim]) ) <a name="l00304"></a>00304 { <a name="l00305"></a>00305 ind[dim] = startIndex[dim] + <span class="keyword">static_cast<</span><span class="keywordtype">long</span><span class="keyword">></span>(size[dim]) - 1; <a name="l00306"></a>00306 ind[++dim]--; <a name="l00307"></a>00307 } <a name="l00308"></a>00308 } <a name="l00309"></a>00309 this->m_Offset = this->m_Image->ComputeOffset( ind ); <a name="l00310"></a>00310 m_SpanBeginOffset = this->m_Offset; <a name="l00311"></a>00311 m_SpanEndOffset = m_SpanBeginOffset - <span class="keyword">static_cast<</span><span class="keywordtype">long</span><span class="keyword">></span>(size[0]); <a name="l00312"></a>00312 } <a name="l00313"></a>00313 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00314"></a>00314 } <a name="l00315"></a>00315 <a name="l00324"></a><a class="code" href="classitk_1_1ImageRegionReverseConstIterator.html#0f5cde0f8a7e378c0a5017e8da6fa89c">00324</a> <a class="code" href="classitk_1_1ImageRegionReverseConstIterator.html" title="A multi-dimensional image iterator designed to walk a specified image region in reverse...">Self</a> & operator--() <a name="l00325"></a>00325 { <a name="l00326"></a>00326 <span class="keywordflow">if</span> (++this->m_Offset >= m_SpanBeginOffset) <a name="l00327"></a>00327 { <a name="l00328"></a>00328 <span class="comment">// We have reached the end of the span (row), need to wrap around.</span> <a name="l00329"></a>00329 <a name="l00330"></a>00330 <span class="comment">// First back up one pixel, because we are going to use a different</span> <a name="l00331"></a>00331 <span class="comment">// algorithm to compute the next pixel</span> <a name="l00332"></a>00332 --this->m_Offset; <a name="l00333"></a>00333 <a name="l00334"></a>00334 <span class="comment">// Get the index of the last pixel on the span (row)</span> <a name="l00335"></a>00335 <span class="keyword">typename</span> <a class="code" href="classitk_1_1ImageConstIterator.html" title="A multi-dimensional image iterator templated over image type.">ImageConstIterator<TImage>::IndexType</a> <a name="l00336"></a>00336 ind = this->m_Image->ComputeIndex( static_cast<OffsetValueType>(this->m_Offset) ); <a name="l00337"></a>00337 <a name="l00338"></a>00338 <span class="keyword">const</span> <span class="keyword">typename</span> <a class="code" href="classitk_1_1ImageIterator.html" title="A multi-dimensional iterator templated over image type.">ImageIterator<TImage>::IndexType</a>& <a name="l00339"></a>00339 startIndex = this->m_Region.<a class="code" href="classitk_1_1ImageConstIterator.html#ae11801c25a113360119ef69ec62b1d0">GetIndex</a>(); <a name="l00340"></a>00340 <span class="keyword">const</span> <span class="keyword">typename</span> <a class="code" href="classitk_1_1ImageIterator.html" title="A multi-dimensional iterator templated over image type.">ImageIterator<TImage>::SizeType</a>& <a name="l00341"></a>00341 size = this->m_Region.GetSize(); <a name="l00342"></a>00342 <a name="l00343"></a>00343 <span class="comment">// Increment along a row, then wrap at the end of the region row.</span> <a name="l00344"></a>00344 <span class="keywordtype">bool</span> done; <a name="l00345"></a>00345 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> dim; <a name="l00346"></a>00346 <a name="l00347"></a>00347 <span class="comment">// Check to see if we are past the last pixel in the region</span> <a name="l00348"></a>00348 <span class="comment">// Note that ++ind[0] moves to the next pixel along the row.</span> <a name="l00349"></a>00349 done = (++ind[0] == startIndex[0] + <span class="keyword">static_cast<</span><span class="keywordtype">long</span><span class="keyword">></span>(size[0])); <a name="l00350"></a>00350 <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=1; done && i < ImageIteratorDimension; i++) <a name="l00351"></a>00351 { <a name="l00352"></a>00352 done = (ind[i] == startIndex[i] + <span class="keyword">static_cast<</span><span class="keywordtype">long</span><span class="keyword">></span>(size[i]) - 1); <a name="l00353"></a>00353 } <a name="l00354"></a>00354 <a name="l00355"></a>00355 <span class="comment">// if the iterator is outside the region (but not past region end) then</span> <a name="l00356"></a>00356 <span class="comment">// we need to wrap around the region</span> <a name="l00357"></a>00357 dim = 0; <a name="l00358"></a>00358 <span class="keywordflow">if</span> (!done) <a name="l00359"></a>00359 { <a name="l00360"></a>00360 <span class="keywordflow">while</span> ( (dim < ImageIteratorDimension - 1) <a name="l00361"></a>00361 && (ind[dim] > startIndex[dim] + <span class="keyword">static_cast<</span><span class="keywordtype">long</span><span class="keyword">></span>(size[dim]) - 1) ) <a name="l00362"></a>00362 { <a name="l00363"></a>00363 ind[dim] = startIndex[dim]; <a name="l00364"></a>00364 ind[++dim]++; <a name="l00365"></a>00365 } <a name="l00366"></a>00366 } <a name="l00367"></a>00367 this->m_Offset = this->m_Image->ComputeOffset( ind ); <a name="l00368"></a>00368 m_SpanBeginOffset = this->m_Offset; <a name="l00369"></a>00369 m_SpanEndOffset = this->m_Offset - <span class="keyword">static_cast<</span><span class="keywordtype">long</span><span class="keyword">></span>(size[0]); <a name="l00370"></a>00370 } <a name="l00371"></a>00371 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00372"></a>00372 } <a name="l00373"></a>00373 <a name="l00374"></a>00374 <span class="keyword">protected</span>: <a name="l00375"></a><a class="code" href="classitk_1_1ImageRegionReverseConstIterator.html#8f423d09f5368bb90a9fc074c477fb3c">00375</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> m_SpanBeginOffset; <span class="comment">// offset to last pixel in the row</span> <a name="l00376"></a><a class="code" href="classitk_1_1ImageRegionReverseConstIterator.html#997e62ad58253a0a62a56dffb2f874ae">00376</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> m_SpanEndOffset; <span class="comment">// offset to one pixel before the row</span> <a name="l00377"></a>00377 <a name="l00378"></a>00378 }; <a name="l00379"></a>00379 <a name="l00380"></a>00380 } <span class="comment">// end namespace itk</span> <a name="l00381"></a>00381 <a name="l00382"></a>00382 <span class="comment">// Define instantiation macro for this template.</span> <a name="l00383"></a><a class="code" href="itkImageRegionReverseConstIterator_8h.html#1b68ad7982098e7010c5706c1a90fa7c">00383</a> <span class="preprocessor">#define ITK_TEMPLATE_ImageRegionReverseConstIterator(_, EXPORT, x, y) namespace itk { \</span> <a name="l00384"></a>00384 <span class="preprocessor"> _(1(class EXPORT ImageRegionReverseConstIterator< ITK_TEMPLATE_1 x >)) \</span> <a name="l00385"></a>00385 <span class="preprocessor"> namespace Templates { typedef ImageRegionReverseConstIterator< ITK_TEMPLATE_1 x > ImageRegionReverseConstIterator##y; } \</span> <a name="l00386"></a>00386 <span class="preprocessor"> }</span> <a name="l00387"></a>00387 <span class="preprocessor"></span> <a name="l00388"></a>00388 <span class="preprocessor">#if ITK_TEMPLATE_EXPLICIT</span> <a name="l00389"></a>00389 <span class="preprocessor"></span><span class="preprocessor"># include "Templates/itkImageRegionReverseConstIterator+-.h"</span> <a name="l00390"></a>00390 <span class="preprocessor">#endif</span> <a name="l00391"></a>00391 <span class="preprocessor"></span> <a name="l00392"></a>00392 <span class="preprocessor">#if ITK_TEMPLATE_TXX</span> <a name="l00393"></a>00393 <span class="preprocessor"></span><span class="preprocessor"># include "itkImageRegionReverseConstIterator.txx"</span> <a name="l00394"></a>00394 <span class="preprocessor">#endif</span> <a name="l00395"></a>00395 <span class="preprocessor"></span> <a name="l00396"></a>00396 <span class="preprocessor">#endif </span> <a name="l00397"></a>00397 <span class="preprocessor"></span> </pre></div></div> <hr><address><small> Generated at Thu May 7 23:10:29 2009 for ITK by <a href="http://www.stack.nl/~dimitri/doxygen/index.html"> <img src="http://www.stack.nl/~dimitri/doxygen/doxygen.png" alt="doxygen" align="middle" border=0 width=110 height=53> </a> 1.5.9 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>, © 1997-2000</small></address> </body> </html>