<!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: itkImageRandomConstIteratorWithIndex.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>itkImageRandomConstIteratorWithIndex.h</h1><a href="itkImageRandomConstIteratorWithIndex_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: itkImageRandomConstIteratorWithIndex.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.14 $</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 __itkImageRandomConstIteratorWithIndex_h</span> <a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#define __itkImageRandomConstIteratorWithIndex_h</span> <a name="l00019"></a>00019 <span class="preprocessor"></span> <a name="l00020"></a>00020 <span class="preprocessor">#include "<a class="code" href="itkImageConstIteratorWithIndex_8h.html">itkImageConstIteratorWithIndex.h</a>"</span> <a name="l00021"></a>00021 <span class="preprocessor">#include "<a class="code" href="itkMersenneTwisterRandomVariateGenerator_8h.html">itkMersenneTwisterRandomVariateGenerator.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="l00112"></a>00112 <span class="keyword">template</span><<span class="keyword">typename</span> TImage> <a name="l00113"></a><a class="code" href="classitk_1_1ImageRandomConstIteratorWithIndex.html">00113</a> <span class="keyword">class </span><a class="code" href="itkWin32Header_8h.html#7d4384322557205d75f0719c012dded6">ITK_EXPORT</a> <a class="code" href="classitk_1_1ImageRandomConstIteratorWithIndex.html" title="A multi-dimensional image iterator that visits a random set of pixels within an image...">ImageRandomConstIteratorWithIndex</a> : <span class="keyword">public</span> <a class="code" href="classitk_1_1ImageConstIteratorWithIndex.html" title="A base class for multi-dimensional iterators templated over image type that are designed...">ImageConstIteratorWithIndex</a><TImage> <a name="l00114"></a>00114 { <a name="l00115"></a>00115 <span class="keyword">public</span>: <a name="l00117"></a><a class="code" href="classitk_1_1ImageRandomConstIteratorWithIndex.html#bfe23db1f155be301295d642bbca220a">00117</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1ImageRandomConstIteratorWithIndex.html" title="A multi-dimensional image iterator that visits a random set of pixels within an image...">ImageRandomConstIteratorWithIndex</a> <a class="code" href="classitk_1_1ImageConstIteratorWithIndex.html" title="A base class for multi-dimensional iterators templated over image type that are designed...">Self</a>; <a name="l00118"></a><a class="code" href="classitk_1_1ImageRandomConstIteratorWithIndex.html#75b05af1e5192ef3034a0de5c31b7c4f">00118</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1ImageConstIteratorWithIndex.html">ImageConstIteratorWithIndex<TImage></a> <a class="code" href="classitk_1_1ImageConstIteratorWithIndex.html">Superclass</a>; <a name="l00119"></a>00119 <a name="l00124"></a><a class="code" href="classitk_1_1ImageRandomConstIteratorWithIndex.html#56ed20b165a97b7b6dc12fe104d47a9a">00124</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#be32dc19e71d40322ad9828b9ab40853">TImage::IndexType</a> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#be32dc19e71d40322ad9828b9ab40853">IndexType</a>; <a name="l00125"></a>00125 <a name="l00130"></a><a class="code" href="classitk_1_1ImageRandomConstIteratorWithIndex.html#9d0a41abc168dabc0f6adb41017ed2ad">00130</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#ed8c4a40607d317c666eb96ea265e126">TImage::RegionType</a> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#ed8c4a40607d317c666eb96ea265e126">RegionType</a>; <a name="l00131"></a>00131 <a name="l00136"></a><a class="code" href="classitk_1_1ImageRandomConstIteratorWithIndex.html#9100c8e66261515afafaa3b82c5fb434">00136</a> <span class="keyword">typedef</span> TImage ImageType; <a name="l00137"></a>00137 <a name="l00141"></a><a class="code" href="classitk_1_1ImageRandomConstIteratorWithIndex.html#5f45d12909273907fc2f34c8d3397b80">00141</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> TImage::PixelContainer PixelContainer; <a name="l00142"></a><a class="code" href="classitk_1_1ImageRandomConstIteratorWithIndex.html#d51870f2366309323fffe03c23bdb46d">00142</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="l00143"></a>00143 <a name="l00145"></a>00145 <a class="code" href="classitk_1_1ImageRandomConstIteratorWithIndex.html" title="A multi-dimensional image iterator that visits a random set of pixels within an image...">ImageRandomConstIteratorWithIndex</a>(); <a name="l00146"></a><a class="code" href="classitk_1_1ImageRandomConstIteratorWithIndex.html#3bfecc037066f6159d01a4305aadfd2d">00146</a> <a class="code" href="classitk_1_1ImageRandomConstIteratorWithIndex.html#3bfecc037066f6159d01a4305aadfd2d">~ImageRandomConstIteratorWithIndex</a>() {}; <a name="l00148"></a>00148 <a name="l00151"></a>00151 <a class="code" href="classitk_1_1ImageRandomConstIteratorWithIndex.html" title="A multi-dimensional image iterator that visits a random set of pixels within an image...">ImageRandomConstIteratorWithIndex</a>(<span class="keyword">const</span> ImageType *ptr, <span class="keyword">const</span> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#ed8c4a40607d317c666eb96ea265e126">RegionType</a>& region); <a name="l00152"></a>00152 <a name="l00159"></a><a class="code" href="classitk_1_1ImageRandomConstIteratorWithIndex.html#dfb70aa5b134109f8df6fee5ee1da63d">00159</a> <a class="code" href="classitk_1_1ImageRandomConstIteratorWithIndex.html" title="A multi-dimensional image iterator that visits a random set of pixels within an image...">ImageRandomConstIteratorWithIndex</a>( <span class="keyword">const</span> <a class="code" href="classitk_1_1ImageConstIteratorWithIndex.html">ImageConstIteratorWithIndex<TImage></a> &it) <a name="l00160"></a>00160 { this-><a class="code" href="classitk_1_1ImageConstIteratorWithIndex.html" title="A base class for multi-dimensional iterators templated over image type that are designed...">ImageConstIteratorWithIndex<TImage>::operator=</a>(it); } <a name="l00161"></a>00161 <a name="l00163"></a><a class="code" href="classitk_1_1ImageRandomConstIteratorWithIndex.html#91efcdd3296aed61d278e4046bdfbcd3">00163</a> <span class="keywordtype">void</span> GoToBegin(<span class="keywordtype">void</span>) <a name="l00164"></a>00164 { <a name="l00165"></a>00165 this->RandomJump(); <a name="l00166"></a>00166 m_NumberOfSamplesDone = 0L; <a name="l00167"></a>00167 } <a name="l00169"></a>00169 <a name="l00171"></a><a class="code" href="classitk_1_1ImageRandomConstIteratorWithIndex.html#c79d516c9f8952c8d105bbbc923ec6ce">00171</a> <span class="keywordtype">void</span> GoToEnd(<span class="keywordtype">void</span>) <a name="l00172"></a>00172 { <a name="l00173"></a>00173 this->RandomJump(); <a name="l00174"></a>00174 m_NumberOfSamplesDone = m_NumberOfSamplesRequested; <a name="l00175"></a>00175 } <a name="l00177"></a>00177 <a name="l00179"></a><a class="code" href="classitk_1_1ImageRandomConstIteratorWithIndex.html#3613e315ddad6a18b7474ceae3e8f1fe">00179</a> <span class="keywordtype">bool</span> IsAtBegin(<span class="keywordtype">void</span>)<span class="keyword"> const</span> <a name="l00180"></a>00180 <span class="keyword"> </span>{ <span class="keywordflow">return</span> (m_NumberOfSamplesDone == 0L); } <a name="l00181"></a>00181 <a name="l00183"></a><a class="code" href="classitk_1_1ImageRandomConstIteratorWithIndex.html#fde05f0988ac63805be3236c6f1aa3a4">00183</a> <span class="keywordtype">bool</span> IsAtEnd(<span class="keywordtype">void</span>)<span class="keyword"> const</span> <a name="l00184"></a>00184 <span class="keyword"> </span>{ <span class="keywordflow">return</span> (m_NumberOfSamplesDone >= m_NumberOfSamplesRequested); } <a name="l00185"></a>00185 <a name="l00188"></a><a class="code" href="classitk_1_1ImageRandomConstIteratorWithIndex.html#ee49d830770a72401bc62293101223de">00188</a> <a class="code" href="classitk_1_1ImageConstIteratorWithIndex.html" title="A base class for multi-dimensional iterators templated over image type that are designed...">Self</a> & operator++() <a name="l00189"></a>00189 { <a name="l00190"></a>00190 this->RandomJump(); <a name="l00191"></a>00191 m_NumberOfSamplesDone++; <a name="l00192"></a>00192 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00193"></a>00193 } <a name="l00195"></a>00195 <a name="l00198"></a><a class="code" href="classitk_1_1ImageRandomConstIteratorWithIndex.html#f385f05537d27e3a65f1959d0b23ef4f">00198</a> <a class="code" href="classitk_1_1ImageConstIteratorWithIndex.html" title="A base class for multi-dimensional iterators templated over image type that are designed...">Self</a> & operator--() <a name="l00199"></a>00199 { <a name="l00200"></a>00200 this->RandomJump(); <a name="l00201"></a>00201 m_NumberOfSamplesDone--; <a name="l00202"></a>00202 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00203"></a>00203 } <a name="l00205"></a>00205 <a name="l00207"></a>00207 <span class="keywordtype">void</span> SetNumberOfSamples( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> number ); <a name="l00208"></a>00208 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> GetNumberOfSamples( <span class="keywordtype">void</span> ) <span class="keyword">const</span>; <a name="l00210"></a>00210 <a name="l00212"></a>00212 <span class="keywordtype">void</span> ReinitializeSeed(); <a name="l00213"></a>00213 <span class="keywordtype">void</span> ReinitializeSeed(<span class="keywordtype">int</span>); <a name="l00215"></a>00215 <a name="l00216"></a>00216 <span class="keyword">private</span>: <a name="l00217"></a>00217 <span class="keywordtype">void</span> RandomJump(); <a name="l00218"></a>00218 <span class="keyword">typedef</span> <a class="code" href="classitk_1_1SmartPointer.html">Statistics::MersenneTwisterRandomVariateGenerator::Pointer</a> GeneratorPointer; <a name="l00219"></a>00219 GeneratorPointer m_Generator; <a name="l00220"></a>00220 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> m_NumberOfSamplesRequested; <a name="l00221"></a>00221 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> m_NumberOfSamplesDone; <a name="l00222"></a>00222 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> m_NumberOfPixelsInRegion; <a name="l00223"></a>00223 }; <a name="l00224"></a>00224 <a name="l00225"></a>00225 } <span class="comment">// end namespace itk</span> <a name="l00226"></a>00226 <a name="l00227"></a>00227 <span class="preprocessor">#ifndef ITK_MANUAL_INSTANTIATION</span> <a name="l00228"></a>00228 <span class="preprocessor"></span><span class="preprocessor">#include "itkImageRandomConstIteratorWithIndex.txx"</span> <a name="l00229"></a>00229 <span class="preprocessor">#endif</span> <a name="l00230"></a>00230 <span class="preprocessor"></span> <a name="l00231"></a>00231 <span class="preprocessor">#endif </span> <a name="l00232"></a>00232 <span class="preprocessor"></span> </pre></div></div> <hr><address><small> Generated at Thu May 7 23:05:25 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>