<!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: itkImageRegionConstIterator.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>itkImageRegionConstIterator.h</h1><a href="itkImageRegionConstIterator_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: itkImageRegionConstIterator.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.23 $</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 __itkImageRegionConstIterator_h</span> <a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#define __itkImageRegionConstIterator_h</span> <a name="l00019"></a>00019 <span class="preprocessor"></span> <a name="l00020"></a>00020 <span class="preprocessor">#include "<a class="code" href="itkImageConstIterator_8h.html">itkImageConstIterator.h</a>"</span> <a name="l00021"></a>00021 <span class="preprocessor">#include "<a class="code" href="itkImageIterator_8h.html">itkImageIterator.h</a>"</span> <a name="l00022"></a>00022 <a name="l00023"></a>00023 <span class="preprocessor">#if defined(_MSC_VER) && !defined(ITK_LEAN_AND_MEAN)</span> <a name="l00024"></a>00024 <span class="preprocessor"></span><span class="preprocessor">#define ITK_LEAN_AND_MEAN</span> <a name="l00025"></a>00025 <span class="preprocessor"></span><span class="preprocessor">#endif</span> <a name="l00026"></a>00026 <span class="preprocessor"></span> <a name="l00027"></a>00027 <span class="keyword">namespace </span>itk <a name="l00028"></a>00028 { <a name="l00029"></a>00029 <a name="l00107"></a>00107 <span class="keyword">template</span><<span class="keyword">typename</span> TImage> <a name="l00108"></a><a class="code" href="classitk_1_1ImageRegionConstIterator.html">00108</a> <span class="keyword">class </span><a class="code" href="itkWin32Header_8h.html#7d4384322557205d75f0719c012dded6">ITK_EXPORT</a> <a class="code" href="classitk_1_1ImageRegionConstIterator.html" title="A multi-dimensional iterator templated over image type that walks a region of pixels...">ImageRegionConstIterator</a> : <span class="keyword">public</span> <a class="code" href="classitk_1_1ImageConstIterator.html" title="A multi-dimensional image iterator templated over image type.">ImageConstIterator</a><TImage> <a name="l00109"></a>00109 { <a name="l00110"></a>00110 <span class="keyword">public</span>: <a name="l00112"></a><a class="code" href="classitk_1_1ImageRegionConstIterator.html#4bcb0f8b19ee9a4e83ebdb0f4936f457">00112</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1ImageRegionConstIterator.html" title="A multi-dimensional iterator templated over image type that walks a region of pixels...">ImageRegionConstIterator</a> <a class="code" href="classitk_1_1ImageConstIterator.html" title="A multi-dimensional image iterator templated over image type.">Self</a>; <a name="l00113"></a><a class="code" href="classitk_1_1ImageRegionConstIterator.html#6050421ebc44ec1f6155823b1f1022e6">00113</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1ImageConstIterator.html">ImageConstIterator<TImage></a> <a class="code" href="classitk_1_1ImageConstIterator.html">Superclass</a>; <a name="l00114"></a>00114 <a name="l00119"></a>00119 <a class="code" href="itkMacro_8h.html#1905cf6b2e88235996fa7ff73b2fb0eb">itkStaticConstMacro</a>(ImageIteratorDimension, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>, <a name="l00120"></a>00120 Superclass::ImageIteratorDimension); <a name="l00121"></a>00121 <a name="l00124"></a><a class="code" href="classitk_1_1ImageRegionConstIterator.html#8a0e4a4ee30eca07d2ce2561ba582244">00124</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="l00125"></a>00125 <a name="l00128"></a><a class="code" href="classitk_1_1ImageRegionConstIterator.html#5c00fb967902773c6b4b028f6974138b">00128</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="l00129"></a>00129 <a name="l00131"></a><a class="code" href="classitk_1_1ImageRegionConstIterator.html#9656a69ccc51feb299822b4fe44380c2">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_1ImageRegionConstIterator.html#099c14c6debbf03343c71796fac86dd0">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_1ImageRegionConstIterator.html#7d383297c6ad69b1151cadefebab592a">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_1ImageRegionConstIterator.html#fa997bf6d99350454f329105823f4cd7">00141</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> Superclass::PixelContainerPointer PixelContainerPointer; <a name="l00142"></a>00142 <a name="l00144"></a><a class="code" href="classitk_1_1ImageRegionConstIterator.html#7ad4606b3576156bffba4cfddb36153a">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_1ImageRegionConstIterator.html#285b74850bece3c2c79e4e2e9f1149e2">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_1ImageRegionConstIterator.html#a53f0beb066ea490623a258f64b69c08">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_1ImageRegionConstIterator.html" title="A multi-dimensional iterator templated over image type that walks a region of pixels...">ImageRegionConstIterator</a>, <a class="code" href="classitk_1_1ImageIterator.html" title="A multi-dimensional iterator templated over image type.">ImageIterator</a>); <a name="l00155"></a>00155 <a name="l00157"></a><a class="code" href="classitk_1_1ImageRegionConstIterator.html#c322e66ca024b57061f177c57c66f9db">00157</a> <a class="code" href="classitk_1_1ImageRegionConstIterator.html" title="A multi-dimensional iterator templated over image type that walks a region of pixels...">ImageRegionConstIterator</a>() : <a class="code" href="classitk_1_1ImageConstIterator.html" title="A multi-dimensional image iterator templated over image type.">ImageConstIterator</a><TImage>() <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_1ImageRegionConstIterator.html#93c7c30d77bee58342562a7bc88b2b04">00165</a> <a class="code" href="classitk_1_1ImageRegionConstIterator.html" title="A multi-dimensional iterator templated over image type that walks a region of pixels...">ImageRegionConstIterator</a>(<span class="keyword">const</span> ImageType *ptr, <a name="l00166"></a>00166 <span class="keyword">const</span> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#ed8c4a40607d317c666eb96ea265e126">RegionType</a> &region) <a name="l00167"></a>00167 : <a class="code" href="classitk_1_1ImageConstIterator.html" title="A multi-dimensional image iterator templated over image type.">ImageConstIterator</a><TImage>(ptr, region) <a name="l00168"></a>00168 { <a name="l00169"></a>00169 m_SpanBeginOffset = this->m_BeginOffset; <a name="l00170"></a>00170 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="l00171"></a>00171 } <a name="l00173"></a>00173 <a name="l00180"></a><a class="code" href="classitk_1_1ImageRegionConstIterator.html#b0246e4dd15182034a4b4cdb8765198d">00180</a> <a class="code" href="classitk_1_1ImageRegionConstIterator.html" title="A multi-dimensional iterator templated over image type that walks a region of pixels...">ImageRegionConstIterator</a>( <span class="keyword">const</span> <a class="code" href="classitk_1_1ImageIterator.html" title="A multi-dimensional iterator templated over image type.">ImageIterator<TImage></a> &it) <a name="l00181"></a>00181 { <a name="l00182"></a>00182 this-><a class="code" href="classitk_1_1ImageConstIterator.html" title="A multi-dimensional image iterator templated over image type.">ImageConstIterator<TImage>::operator=</a>(it); <a name="l00183"></a>00183 <a class="code" href="namespaceHardConnectedComponentImageFilter.html#be32dc19e71d40322ad9828b9ab40853">IndexType</a> ind = this->GetIndex(); <a name="l00184"></a>00184 m_SpanEndOffset = 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="l00185"></a>00185 - (ind[0] - this->m_Region.GetIndex()[0]); <a name="l00186"></a>00186 m_SpanBeginOffset = m_SpanEndOffset <a name="l00187"></a>00187 - <span class="keyword">static_cast<</span><span class="keywordtype">long</span><span class="keyword">></span>(this->m_Region.GetSize()[0]); <a name="l00188"></a>00188 } <a name="l00190"></a>00190 <a name="l00197"></a><a class="code" href="classitk_1_1ImageRegionConstIterator.html#01fe5de88ce705f36931dbe55405ad86">00197</a> <a class="code" href="classitk_1_1ImageRegionConstIterator.html" title="A multi-dimensional iterator templated over image type that walks a region of pixels...">ImageRegionConstIterator</a>( <span class="keyword">const</span> <a class="code" href="classitk_1_1ImageConstIterator.html">ImageConstIterator<TImage></a> &it) <a name="l00198"></a>00198 { <a name="l00199"></a>00199 this-><a class="code" href="classitk_1_1ImageConstIterator.html" title="A multi-dimensional image iterator templated over image type.">ImageConstIterator<TImage>::operator=</a>(it); <a name="l00200"></a>00200 <a class="code" href="namespaceHardConnectedComponentImageFilter.html#be32dc19e71d40322ad9828b9ab40853">IndexType</a> ind = this->GetIndex(); <a name="l00201"></a>00201 m_SpanEndOffset = 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="l00202"></a>00202 - (ind[0] - this->m_Region.GetIndex()[0]); <a name="l00203"></a>00203 m_SpanBeginOffset = m_SpanEndOffset <a name="l00204"></a>00204 - <span class="keyword">static_cast<</span><span class="keywordtype">long</span><span class="keyword">></span>(this->m_Region.GetSize()[0]); <a name="l00205"></a>00205 } <a name="l00207"></a>00207 <a name="l00210"></a><a class="code" href="classitk_1_1ImageRegionConstIterator.html#3f06a7f90f5a36eb8a215fa1ddf68165">00210</a> <span class="keywordtype">void</span> GoToBegin() <a name="l00211"></a>00211 { <a name="l00212"></a>00212 Superclass::GoToBegin(); <a name="l00213"></a>00213 <a name="l00214"></a>00214 <span class="comment">// reset the span offsets</span> <a name="l00215"></a>00215 m_SpanBeginOffset = this->m_BeginOffset; <a name="l00216"></a>00216 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="l00217"></a>00217 } <a name="l00218"></a>00218 <a name="l00221"></a><a class="code" href="classitk_1_1ImageRegionConstIterator.html#e026f3b861594331039b33953ab1b6fc">00221</a> <span class="keywordtype">void</span> GoToEnd() <a name="l00222"></a>00222 { <a name="l00223"></a>00223 Superclass::GoToEnd(); <a name="l00224"></a>00224 <a name="l00225"></a>00225 <span class="comment">// reset the span offsets</span> <a name="l00226"></a>00226 m_SpanEndOffset = this->m_EndOffset; <a name="l00227"></a>00227 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="l00228"></a>00228 } <a name="l00229"></a>00229 <a name="l00233"></a>00233 <a class="code" href="namespaceHardConnectedComponentImageFilter.html#ac7d0120fe5292cdcdddb6163b8cb150">Self</a> Begin(<span class="keywordtype">void</span>) <span class="keyword">const</span>; <a name="l00234"></a>00234 <a name="l00238"></a>00238 <a class="code" href="namespaceHardConnectedComponentImageFilter.html#ac7d0120fe5292cdcdddb6163b8cb150">Self</a> End(<span class="keywordtype">void</span>) <span class="keyword">const</span>; <a name="l00239"></a>00239 <a name="l00240"></a>00240 <a name="l00244"></a><a class="code" href="classitk_1_1ImageRegionConstIterator.html#308bf1948035070f7cc8fad2fe5cb654">00244</a> <span class="keywordtype">void</span> SetIndex(<span class="keyword">const</span> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#be32dc19e71d40322ad9828b9ab40853">IndexType</a> &ind) <a name="l00245"></a>00245 { <a name="l00246"></a>00246 Superclass::SetIndex(ind); <a name="l00247"></a>00247 m_SpanEndOffset = 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="l00248"></a>00248 - (ind[0] - this->m_Region.GetIndex()[0]); <a name="l00249"></a>00249 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="l00250"></a>00250 } <a name="l00252"></a>00252 <a name="l00260"></a>00260 <a class="code" href="namespaceHardConnectedComponentImageFilter.html#ac7d0120fe5292cdcdddb6163b8cb150">Self</a> & <a name="l00261"></a><a class="code" href="classitk_1_1ImageRegionConstIterator.html#b435a6022ff568d6ec33a8cdb053be11">00261</a> operator++() <a name="l00262"></a>00262 { <a name="l00263"></a>00263 <span class="keywordflow">if</span> (++this->m_Offset >= m_SpanEndOffset) <a name="l00264"></a>00264 { <a name="l00265"></a>00265 this->Increment(); <a name="l00266"></a>00266 } <a name="l00267"></a>00267 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00268"></a>00268 } <a name="l00270"></a>00270 <a name="l00278"></a><a class="code" href="classitk_1_1ImageRegionConstIterator.html#6262f01473ea6a5f6fcd6084513ace75">00278</a> <a class="code" href="classitk_1_1ImageConstIterator.html" title="A multi-dimensional image iterator templated over image type.">Self</a> & operator--() <a name="l00279"></a>00279 { <a name="l00280"></a>00280 <span class="keywordflow">if</span> (--this->m_Offset < m_SpanBeginOffset) <a name="l00281"></a>00281 { <a name="l00282"></a>00282 this->Decrement(); <a name="l00283"></a>00283 } <a name="l00284"></a>00284 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00285"></a>00285 } <a name="l00287"></a>00287 <a name="l00288"></a>00288 <a name="l00289"></a>00289 <span class="keyword">protected</span>: <a name="l00290"></a><a class="code" href="classitk_1_1ImageRegionConstIterator.html#4c9672a39109efbf2c1f13afb29b8a3f">00290</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> m_SpanBeginOffset; <span class="comment">// one pixel before the beginning of the span (row)</span> <a name="l00291"></a><a class="code" href="classitk_1_1ImageRegionConstIterator.html#30e966efb692a94c1eab3c40ce2579ed">00291</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> m_SpanEndOffset; <span class="comment">// one pixel past the end of the span (row)</span> <a name="l00292"></a>00292 <a name="l00293"></a>00293 <span class="keyword">private</span>: <a name="l00294"></a>00294 <span class="keywordtype">void</span> Increment(); <span class="comment">// advance in a direction other than the fastest moving</span> <a name="l00295"></a>00295 <span class="keywordtype">void</span> Decrement(); <span class="comment">// go back in a direction other than the fastest moving</span> <a name="l00296"></a>00296 <a name="l00297"></a>00297 }; <a name="l00298"></a>00298 <a name="l00299"></a>00299 } <span class="comment">// end namespace itk</span> <a name="l00300"></a>00300 <a name="l00301"></a>00301 <span class="comment">// Define instantiation macro for this template.</span> <a name="l00302"></a><a class="code" href="itkImageRegionConstIterator_8h.html#721fa8e214fc0474889c65d6fe5e7714">00302</a> <span class="preprocessor">#define ITK_TEMPLATE_ImageRegionConstIterator(_, EXPORT, x, y) namespace itk { \</span> <a name="l00303"></a>00303 <span class="preprocessor"> _(1(class EXPORT ImageRegionConstIterator< ITK_TEMPLATE_1 x >)) \</span> <a name="l00304"></a>00304 <span class="preprocessor"> namespace Templates { typedef ImageRegionConstIterator< ITK_TEMPLATE_1 x > ImageRegionConstIterator##y; } \</span> <a name="l00305"></a>00305 <span class="preprocessor"> }</span> <a name="l00306"></a>00306 <span class="preprocessor"></span> <a name="l00307"></a>00307 <a name="l00308"></a>00308 <span class="preprocessor">#if ITK_TEMPLATE_EXPLICIT</span> <a name="l00309"></a>00309 <span class="preprocessor"></span><span class="preprocessor"># include "Templates/itkImageRegionConstIterator+-.h"</span> <a name="l00310"></a>00310 <span class="preprocessor">#endif</span> <a name="l00311"></a>00311 <span class="preprocessor"></span> <a name="l00312"></a>00312 <span class="preprocessor">#if ITK_TEMPLATE_TXX</span> <a name="l00313"></a>00313 <span class="preprocessor"></span><span class="preprocessor"># include "itkImageRegionConstIterator.txx"</span> <a name="l00314"></a>00314 <span class="preprocessor">#endif</span> <a name="l00315"></a>00315 <span class="preprocessor"></span> <a name="l00316"></a>00316 <span class="preprocessor">#if defined(_MSC_VER)</span> <a name="l00317"></a>00317 <span class="preprocessor"></span><span class="preprocessor">#undef ITK_LEAN_AND_MEAN</span> <a name="l00318"></a>00318 <span class="preprocessor"></span><span class="preprocessor">#endif</span> <a name="l00319"></a>00319 <span class="preprocessor"></span> <a name="l00320"></a>00320 <span class="preprocessor">#endif </span> <a name="l00321"></a>00321 <span class="preprocessor"></span> </pre></div></div> <hr><address><small> Generated at Thu May 7 23:07:38 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>