<!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: itkSubsample.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_2c33022d19e8077162952ea9ed57656d.html">Numerics</a> » <a class="el" href="dir_e82fe55e9fab4124d6625d716e091a5f.html">Statistics</a> </div> <div class="contents"> <h1>itkSubsample.h</h1><a href="itkSubsample_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: itkSubsample.h,v $</span> <a name="l00005"></a>00005 <span class="comment"> Language: C++</span> <a name="l00006"></a>00006 <span class="comment"> Date: $Date: 2006-08-17 17:57:22 $</span> <a name="l00007"></a>00007 <span class="comment"> Version: $Revision: 1.31 $</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 __itkSubsample_h</span> <a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#define __itkSubsample_h</span> <a name="l00019"></a>00019 <span class="preprocessor"></span> <a name="l00020"></a>00020 <span class="preprocessor">#include "<a class="code" href="itkSample_8h.html">itkSample.h</a>"</span> <a name="l00021"></a>00021 <span class="preprocessor">#include "<a class="code" href="itkMacro_8h.html">itkMacro.h</a>"</span> <a name="l00022"></a>00022 <span class="preprocessor">#include "<a class="code" href="itkObjectFactory_8h.html">itkObjectFactory.h</a>"</span> <a name="l00023"></a>00023 <a name="l00024"></a>00024 <span class="keyword">namespace </span>itk{ <a name="l00025"></a>00025 <span class="keyword">namespace </span>Statistics{ <a name="l00026"></a>00026 <a name="l00037"></a>00037 <span class="keyword">template</span>< <span class="keyword">class</span> TSample > <a name="l00038"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample.html">00038</a> <span class="keyword">class </span><a class="code" href="itkWin32Header_8h.html#7d4384322557205d75f0719c012dded6">ITK_EXPORT</a> <a class="code" href="classitk_1_1Statistics_1_1Subsample.html" title="This class stores a subset of instance identifiers from another sample object. You...">Subsample</a> : <a name="l00039"></a>00039 <span class="keyword">public</span> <a class="code" href="classitk_1_1Statistics_1_1Sample.html" title="A collection of measurements for statistical analysis.">Sample</a>< typename TSample::MeasurementVectorType > <a name="l00040"></a>00040 { <a name="l00041"></a>00041 <span class="keyword">public</span>: <a name="l00043"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample.html#dfa92dcc9600517db9a67f5ab5759885">00043</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1Statistics_1_1Subsample.html" title="This class stores a subset of instance identifiers from another sample object. You...">Subsample</a> <a class="code" href="classitk_1_1LightObject.html" title="Light weight base class for most itk classes.">Self</a>; <a name="l00044"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample.html#0648adb9facf71c7163f732cb2f7ddc1">00044</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1Statistics_1_1Sample.html" title="A collection of measurements for statistical analysis.">Sample< typename TSample::MeasurementVectorType ></a> <a class="code" href="classitk_1_1LightObject.html" title="Light weight base class for most itk classes.">Superclass</a> ; <a name="l00045"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample.html#0d32883f0560e204dde8de96263963c1">00045</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1SmartPointer.html">SmartPointer< Self ></a> <a class="code" href="classitk_1_1SmartPointer.html">Pointer</a> ; <a name="l00046"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample.html#193fc52fada99d7f655b66007d42cdbb">00046</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1SmartPointer.html">SmartPointer<const Self></a> <a class="code" href="classitk_1_1SmartPointer.html">ConstPointer</a>; <a name="l00047"></a>00047 <a name="l00049"></a>00049 <a class="code" href="itkMacro_8h.html#574c1f86661d409dd32c742307a0e96a">itkTypeMacro</a>(<a class="code" href="classitk_1_1Statistics_1_1Subsample.html" title="This class stores a subset of instance identifiers from another sample object. You...">Subsample</a>, <a class="code" href="classitk_1_1Statistics_1_1Sample.html" title="A collection of measurements for statistical analysis.">Sample</a>); <a name="l00050"></a>00050 <a name="l00052"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample.html#fe1cdb67e402e9980270d8e49673e3b3">00052</a> <a class="code" href="itkMacro_8h.html#0fdc15685afa271857c57e7cd482f30c">itkNewMacro</a>(<a class="code" href="classitk_1_1LightObject.html" title="Light weight base class for most itk classes.">Self</a>) ; <a name="l00053"></a>00053 <a name="l00055"></a>00055 <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="itkFEMMacro_8h.html#539cce1a3282ba59952dedcbf9cdb23f">TSample::Pointer</a> SamplePointer ; <a name="l00056"></a>00056 <a name="l00059"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample.html#97331da5742d27663b1ccf08d4acc0b4">00059</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> TSample::MeasurementVectorType MeasurementVectorType; <a name="l00060"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample.html#459e5572f0599ac9b99c380f39995c8d">00060</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> TSample::MeasurementType MeasurementType; <a name="l00061"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample.html#1798a856a8007cded0c7b9c1081f175d">00061</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> TSample::InstanceIdentifier InstanceIdentifier; <a name="l00062"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample.html#50fb7d07c0086ec9d6bc275010caa972">00062</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> TSample::FrequencyType FrequencyType ; <a name="l00063"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample.html#642a4359e3c1900a64d2e864ff60a1f2">00063</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> TSample::TotalFrequencyType TotalFrequencyType ; <a name="l00064"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample.html#5be1703c995ec43471ab01248a136f34">00064</a> <span class="keyword">typedef</span> MeasurementVectorType ValueType ; <a name="l00065"></a>00065 <a name="l00070"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample.html#8e8e9d5088379ab279d12e1b019d73a7">00070</a> <span class="keyword">typedef</span> std::vector< InstanceIdentifier > InstanceIdentifierHolder ; <a name="l00071"></a>00071 <a name="l00073"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample.html#f846c54fdb28947cc59bee7748f7827e">00073</a> <span class="keywordtype">void</span> SetSample(<span class="keyword">const</span> TSample* sample) <a name="l00074"></a>00074 { <a name="l00075"></a>00075 m_Sample = sample ; <a name="l00076"></a>00076 this->SetMeasurementVectorSize( m_Sample->GetMeasurementVectorSize() ); <a name="l00077"></a>00077 } <a name="l00079"></a>00079 <a name="l00080"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample.html#788f4f1a04e7cdb118841055daa7db14">00080</a> <span class="keyword">const</span> TSample* GetSample()<span class="keyword"> const</span> <a name="l00081"></a>00081 <span class="keyword"> </span>{ <span class="keywordflow">return</span> m_Sample ; } <a name="l00082"></a>00082 <a name="l00083"></a>00083 <a name="l00084"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample.html#6979217f34cafbe727a3020d2cff9ee9">00084</a> <span class="keywordtype">void</span> InitializeWithAllInstances() <a name="l00085"></a>00085 { <a name="l00086"></a>00086 m_IdHolder.resize(m_Sample->Size()) ; <a name="l00087"></a>00087 <span class="keyword">typename</span> InstanceIdentifierHolder::iterator idIter = m_IdHolder.begin() ; <a name="l00088"></a>00088 <span class="keyword">typename</span> TSample::ConstIterator iter = m_Sample->Begin() ; <a name="l00089"></a>00089 <span class="keyword">typename</span> TSample::ConstIterator last = m_Sample->End() ; <a name="l00090"></a>00090 m_TotalFrequency = NumericTraits< FrequencyType >::Zero ; <a name="l00091"></a>00091 <span class="keywordflow">while</span> (iter != last) <a name="l00092"></a>00092 { <a name="l00093"></a>00093 *idIter++ = iter.GetInstanceIdentifier() ; <a name="l00094"></a>00094 m_TotalFrequency += iter.GetFrequency() ; <a name="l00095"></a>00095 ++iter ; <a name="l00096"></a>00096 } <a name="l00097"></a>00097 } <a name="l00098"></a>00098 <a name="l00099"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample.html#e64cf7c969c6ce21c25001d6e75c3610">00099</a> <span class="keywordtype">void</span> AddInstance(InstanceIdentifier <span class="keywordtype">id</span>) <a name="l00100"></a>00100 { <a name="l00101"></a>00101 m_IdHolder.push_back(<span class="keywordtype">id</span>) ; <a name="l00102"></a>00102 m_TotalFrequency += m_Sample->GetFrequency(<span class="keywordtype">id</span>) ; <a name="l00103"></a>00103 } <a name="l00104"></a>00104 <a name="l00107"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample.html#6202c1cf1bba617c82b439de0c8c9b1a">00107</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classitk_1_1Size.html" title="Represent the size (bounds) of a n-dimensional image.">Size</a>()<span class="keyword"> const</span> <a name="l00108"></a>00108 <span class="keyword"> </span>{ <a name="l00109"></a>00109 <span class="keywordflow">return</span> <span class="keyword">static_cast<</span><span class="keywordtype">unsigned</span> <span class="keywordtype">int</span><span class="keyword">></span>( m_IdHolder.size() ); <a name="l00110"></a>00110 } <a name="l00111"></a>00111 <a name="l00112"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample.html#816d49927ca24a6b9624399dbb06d62c">00112</a> <span class="keywordtype">void</span> Clear() <a name="l00113"></a>00113 { <a name="l00114"></a>00114 m_IdHolder.clear() ; <a name="l00115"></a>00115 m_TotalFrequency = NumericTraits< FrequencyType >::Zero ; <a name="l00116"></a>00116 } <a name="l00117"></a>00117 <a name="l00120"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample.html#7a683c7075e08d5bfc365e7d245fa77f">00120</a> <span class="keyword">const</span> MeasurementVectorType & GetMeasurementVector(<span class="keyword">const</span> InstanceIdentifier &<span class="keywordtype">id</span>)<span class="keyword"> const</span> <a name="l00121"></a>00121 <span class="keyword"> </span>{ <span class="keywordflow">return</span> m_Sample->GetMeasurementVector(<span class="keywordtype">id</span>) ; } <a name="l00122"></a>00122 <a name="l00124"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample.html#108e01aaca2ab89aa39563528b44d80d">00124</a> FrequencyType GetFrequency(<span class="keyword">const</span> InstanceIdentifier &<span class="keywordtype">id</span>)<span class="keyword"> const</span> <a name="l00125"></a>00125 <span class="keyword"> </span>{ <span class="keywordflow">return</span> m_Sample->GetFrequency(<span class="keywordtype">id</span>) ; } <a name="l00126"></a>00126 <a name="l00128"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample.html#8a82f7385ecdbd627d9f5ba2d5373f38">00128</a> TotalFrequencyType GetTotalFrequency()<span class="keyword"> const</span> <a name="l00129"></a>00129 <span class="keyword"> </span>{ <span class="keywordflow">return</span> m_TotalFrequency ; } <a name="l00130"></a>00130 <a name="l00131"></a>00131 <span class="keywordtype">void</span> Swap(<span class="keywordtype">int</span> index1, <span class="keywordtype">int</span> index2) ; <a name="l00132"></a>00132 <a name="l00133"></a>00133 MeasurementVectorType GetMeasurementVectorByIndex(<span class="keywordtype">int</span> index) <span class="keyword">const</span> ; <a name="l00134"></a>00134 <a name="l00135"></a>00135 FrequencyType GetFrequencyByIndex(<span class="keywordtype">int</span> index) <span class="keyword">const</span>; <a name="l00136"></a>00136 <a name="l00137"></a>00137 InstanceIdentifier GetInstanceIdentifier(<span class="keywordtype">int</span> index) <span class="keyword">const</span>; <a name="l00138"></a>00138 <a name="l00139"></a>00139 <span class="keyword">class </span>ConstIterator; <a name="l00140"></a>00140 <a name="l00141"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1Iterator.html">00141</a> <span class="keyword">class </span><a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1Iterator.html">Iterator</a> <a name="l00142"></a>00142 { <a name="l00143"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1Iterator.html#5485970bb9da6b5d782fa28638b5658f">00143</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1ConstIterator.html">ConstIterator</a>; <a name="l00144"></a>00144 <a name="l00145"></a>00145 <span class="keyword">public</span>: <a name="l00146"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1Iterator.html#c8ada60701ee2f49739870dc5541ee76">00146</a> <a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1Iterator.html">Iterator</a>(<span class="keyword">typename</span> InstanceIdentifierHolder::iterator iter, <a name="l00147"></a>00147 <a class="code" href="classitk_1_1LightObject.html" title="Light weight base class for most itk classes.">Self</a>* classSample) <a name="l00148"></a>00148 :m_Iter(iter), m_Subsample(classSample), <a name="l00149"></a>00149 m_Sample(classSample->GetSample()) <a name="l00150"></a>00150 {} <a name="l00151"></a>00151 <a name="l00152"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1Iterator.html#d3520fabeac810c719ce020872f2c8e1">00152</a> FrequencyType GetFrequency()<span class="keyword"> const</span> <a name="l00153"></a>00153 <span class="keyword"> </span>{ <span class="keywordflow">return</span> m_Sample->GetFrequency(*m_Iter) ; } <a name="l00154"></a>00154 <a name="l00155"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1Iterator.html#bad0c9a51a7a781602e9eb76cb786d7e">00155</a> <span class="keyword">const</span> MeasurementVectorType & GetMeasurementVector()<span class="keyword"> const</span> <a name="l00156"></a>00156 <span class="keyword"> </span>{ <span class="keywordflow">return</span> m_Sample->GetMeasurementVector(*m_Iter) ; } <a name="l00157"></a>00157 <a name="l00158"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1Iterator.html#b9c91c9cdffbddd3872d0fdf43d99a5f">00158</a> InstanceIdentifier GetInstanceIdentifier()<span class="keyword"> const </span> <a name="l00159"></a>00159 <span class="keyword"> </span>{ <span class="keywordflow">return</span> *m_Iter ; } <a name="l00160"></a>00160 <a name="l00161"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1Iterator.html#cd2f73608f17ab0d9957a10b36a8cffa">00161</a> <a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1Iterator.html">Iterator</a>& operator++() <a name="l00162"></a>00162 { <a name="l00163"></a>00163 ++m_Iter ; <a name="l00164"></a>00164 <span class="keywordflow">return</span> *this ; <a name="l00165"></a>00165 } <a name="l00166"></a>00166 <a name="l00167"></a>00167 <span class="comment">//Iterator& operator+()</span> <a name="l00168"></a>00168 <span class="comment">//{ m_Iter += n; return *this ;}</span> <a name="l00169"></a>00169 <a name="l00170"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1Iterator.html#5de9abc772e49b446f4fb9656b770509">00170</a> <a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1Iterator.html">Iterator</a>& <a class="code" href="namespaceitk.html#f9ab0997c93bed50c850f0874931f1a1">operator+</a>(<span class="keywordtype">int</span> n) <a name="l00171"></a>00171 { m_Iter += n; <span class="keywordflow">return</span> *this ;} <a name="l00172"></a>00172 <a name="l00173"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1Iterator.html#0061dd8c5e5c72996ab5be67f40559c0">00173</a> <a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1Iterator.html">Iterator</a>& <a class="code" href="namespaceitk.html#86980caba0abbe85b61177a4c1bf5869">operator-</a>(<span class="keywordtype">int</span> n) <a name="l00174"></a>00174 { m_Iter -= n; <span class="keywordflow">return</span> *this ;} <a name="l00175"></a>00175 <a name="l00176"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1Iterator.html#ab96ee9e595e7dfbee72abcb1fbd12f7">00176</a> <span class="keywordtype">bool</span> <a class="code" href="namespaceitk_1_1ImageToImageFilterDetail.html#7bf30438b5d3bdc0eddbecd9b17baa3b">operator!=</a>(<span class="keyword">const</span> <a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1Iterator.html">Iterator</a>& it) <a name="l00177"></a>00177 { <span class="keywordflow">return</span> (m_Iter != it.m_Iter) ; } <a name="l00178"></a>00178 <a name="l00179"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1Iterator.html#bf591fba33c96e95ecccb95fe2a7f316">00179</a> <span class="keywordtype">bool</span> <a class="code" href="namespaceitk.html#e1c1b02c301187419478f5126c789a01">operator==</a>(<span class="keyword">const</span> <a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1Iterator.html">Iterator</a>& it) <a name="l00180"></a>00180 { <span class="keywordflow">return</span> (m_Iter == it.m_Iter) ; } <a name="l00181"></a>00181 <a name="l00182"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1Iterator.html#5b1f5331abb534502c75ecb2828ff849">00182</a> <a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1Iterator.html">Iterator</a>& operator=(<span class="keyword">const</span> <a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1Iterator.html">Iterator</a>& iter) <a name="l00183"></a>00183 { <a name="l00184"></a>00184 m_Iter = iter.m_Iter; <a name="l00185"></a>00185 m_Subsample = iter.m_Subsample ; <a name="l00186"></a>00186 m_Sample = iter.m_Sample ; <a name="l00187"></a>00187 <span class="keywordflow">return</span> *this ; <a name="l00188"></a>00188 } <a name="l00189"></a>00189 <a name="l00190"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1Iterator.html#c327d96fdd21e3fcef8007eefa8afb38">00190</a> <a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1Iterator.html">Iterator</a>(<span class="keyword">const</span> <a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1Iterator.html">Iterator</a>& iter) <a name="l00191"></a>00191 { <a name="l00192"></a>00192 m_Iter = iter.m_Iter; <a name="l00193"></a>00193 m_Subsample = iter.m_Subsample ; <a name="l00194"></a>00194 m_Sample = iter.m_Sample ; <a name="l00195"></a>00195 } <a name="l00196"></a>00196 <a name="l00197"></a>00197 <span class="keyword">private</span>: <a name="l00198"></a>00198 <span class="comment">// Iterator pointing to ImageToListAdaptor</span> <a name="l00199"></a>00199 <span class="keyword">typename</span> InstanceIdentifierHolder::iterator m_Iter ; <a name="l00200"></a>00200 <span class="comment">// Pointer to Subsample object</span> <a name="l00201"></a>00201 <a class="code" href="classitk_1_1LightObject.html" title="Light weight base class for most itk classes.">Self</a>* m_Subsample ; <a name="l00202"></a>00202 <span class="keyword">const</span> TSample* m_Sample ; <a name="l00203"></a>00203 } ; <a name="l00204"></a>00204 <a name="l00205"></a>00205 <a name="l00206"></a>00206 <a name="l00207"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1ConstIterator.html">00207</a> <span class="keyword">class </span><a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1ConstIterator.html">ConstIterator</a> <a name="l00208"></a>00208 { <a name="l00209"></a>00209 <span class="keyword">public</span>: <a name="l00210"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1ConstIterator.html#e8eb6d85763893ed5a9c69ab7ae29710">00210</a> <a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1ConstIterator.html">ConstIterator</a>(<span class="keyword">typename</span> InstanceIdentifierHolder::const_iterator iter, <a name="l00211"></a>00211 <span class="keyword">const</span> <a class="code" href="classitk_1_1LightObject.html" title="Light weight base class for most itk classes.">Self</a>* classSample) <a name="l00212"></a>00212 :m_Iter(iter), m_Subsample(classSample), <a name="l00213"></a>00213 m_Sample(classSample->GetSample()) <a name="l00214"></a>00214 {} <a name="l00215"></a>00215 <a name="l00216"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1ConstIterator.html#4ba25ae8c887a77aadff51d83f3d30df">00216</a> FrequencyType GetFrequency()<span class="keyword"> const</span> <a name="l00217"></a>00217 <span class="keyword"> </span>{ <span class="keywordflow">return</span> m_Sample->GetFrequency(*m_Iter) ; } <a name="l00218"></a>00218 <a name="l00219"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1ConstIterator.html#bb55415066cb4f006c46a6a2e8ff877c">00219</a> <span class="keyword">const</span> MeasurementVectorType & GetMeasurementVector()<span class="keyword"> const</span> <a name="l00220"></a>00220 <span class="keyword"> </span>{ <span class="keywordflow">return</span> m_Sample->GetMeasurementVector(*m_Iter) ; } <a name="l00221"></a>00221 <a name="l00222"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1ConstIterator.html#8f07efa91f742df98c52cee17aaa4229">00222</a> InstanceIdentifier GetInstanceIdentifier()<span class="keyword"> const </span> <a name="l00223"></a>00223 <span class="keyword"> </span>{ <span class="keywordflow">return</span> *m_Iter ; } <a name="l00224"></a>00224 <a name="l00225"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1ConstIterator.html#3449572d2ba1c2f53cd9aa22fb9d06af">00225</a> <a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1ConstIterator.html">ConstIterator</a>& operator++() <a name="l00226"></a>00226 { <a name="l00227"></a>00227 ++m_Iter ; <a name="l00228"></a>00228 <span class="keywordflow">return</span> *this ; <a name="l00229"></a>00229 } <a name="l00230"></a>00230 <a name="l00231"></a>00231 <span class="comment">//ConstIterator& operator+()</span> <a name="l00232"></a>00232 <span class="comment">//{ m_Iter += n; return *this ;}</span> <a name="l00233"></a>00233 <a name="l00234"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1ConstIterator.html#07c9f2cbfee77e6927839bbbb076c0b2">00234</a> <a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1ConstIterator.html">ConstIterator</a>& <a class="code" href="namespaceitk.html#f9ab0997c93bed50c850f0874931f1a1">operator+</a>(<span class="keywordtype">int</span> n) <a name="l00235"></a>00235 { m_Iter += n; <span class="keywordflow">return</span> *this ;} <a name="l00236"></a>00236 <a name="l00237"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1ConstIterator.html#e359522007485950282545fcbf222355">00237</a> <a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1ConstIterator.html">ConstIterator</a>& <a class="code" href="namespaceitk.html#86980caba0abbe85b61177a4c1bf5869">operator-</a>(<span class="keywordtype">int</span> n) <a name="l00238"></a>00238 { m_Iter -= n; <span class="keywordflow">return</span> *this ;} <a name="l00239"></a>00239 <a name="l00240"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1ConstIterator.html#28f627a573806427b69a781b139a582c">00240</a> <span class="keywordtype">bool</span> <a class="code" href="namespaceitk_1_1ImageToImageFilterDetail.html#7bf30438b5d3bdc0eddbecd9b17baa3b">operator!=</a>(<span class="keyword">const</span> <a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1ConstIterator.html">ConstIterator</a>& it) <a name="l00241"></a>00241 { <span class="keywordflow">return</span> (m_Iter != it.m_Iter) ; } <a name="l00242"></a>00242 <a name="l00243"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1ConstIterator.html#df6d89afdd810c2b14075a1be2f87ec2">00243</a> <span class="keywordtype">bool</span> <a class="code" href="namespaceitk.html#e1c1b02c301187419478f5126c789a01">operator==</a>(<span class="keyword">const</span> <a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1ConstIterator.html">ConstIterator</a>& it) <a name="l00244"></a>00244 { <span class="keywordflow">return</span> (m_Iter == it.m_Iter) ; } <a name="l00245"></a>00245 <a name="l00246"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1ConstIterator.html#0c18d4a98bd3fc0f69b076206648f361">00246</a> <a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1ConstIterator.html">ConstIterator</a>& operator=(<span class="keyword">const</span> <a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1ConstIterator.html">ConstIterator</a>& iter) <a name="l00247"></a>00247 { <a name="l00248"></a>00248 m_Iter = iter.m_Iter; <a name="l00249"></a>00249 m_Subsample = iter.m_Subsample ; <a name="l00250"></a>00250 m_Sample = iter.m_Sample ; <a name="l00251"></a>00251 <span class="keywordflow">return</span> *this ; <a name="l00252"></a>00252 } <a name="l00253"></a>00253 <a name="l00254"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1ConstIterator.html#3a16f17b341226b06b3f949b0eed91ba">00254</a> <a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1ConstIterator.html">ConstIterator</a>& operator=(<span class="keyword">const</span> <a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1Iterator.html">Iterator</a>& iter) <a name="l00255"></a>00255 { <a name="l00256"></a>00256 m_Iter = iter.m_Iter; <a name="l00257"></a>00257 m_Subsample = iter.m_Subsample ; <a name="l00258"></a>00258 m_Sample = iter.m_Sample ; <a name="l00259"></a>00259 <span class="keywordflow">return</span> *this ; <a name="l00260"></a>00260 } <a name="l00261"></a>00261 <a name="l00262"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1ConstIterator.html#b7df23c49d8718eb2d023ca53a381956">00262</a> <a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1ConstIterator.html">ConstIterator</a>(<span class="keyword">const</span> <a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1ConstIterator.html">ConstIterator</a>& iter) <a name="l00263"></a>00263 { <a name="l00264"></a>00264 m_Iter = iter.m_Iter; <a name="l00265"></a>00265 m_Subsample = iter.m_Subsample ; <a name="l00266"></a>00266 m_Sample = iter.m_Sample ; <a name="l00267"></a>00267 } <a name="l00268"></a>00268 <a name="l00269"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1ConstIterator.html#55a1474810ca8e4959ef992afbe5efd7">00269</a> <a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1ConstIterator.html">ConstIterator</a>(<span class="keyword">const</span> <a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1Iterator.html">Iterator</a>& iter) <a name="l00270"></a>00270 { <a name="l00271"></a>00271 m_Iter = iter.m_Iter; <a name="l00272"></a>00272 m_Subsample = iter.m_Subsample ; <a name="l00273"></a>00273 m_Sample = iter.m_Sample ; <a name="l00274"></a>00274 } <a name="l00275"></a>00275 <a name="l00276"></a>00276 <span class="keyword">private</span>: <a name="l00277"></a>00277 <span class="comment">// ConstIterator pointing to ImageToListAdaptor</span> <a name="l00278"></a>00278 <span class="keyword">typename</span> InstanceIdentifierHolder::const_iterator m_Iter ; <a name="l00279"></a>00279 <span class="comment">// Pointer to Subsample object</span> <a name="l00280"></a>00280 <span class="keyword">const</span> <a class="code" href="classitk_1_1LightObject.html" title="Light weight base class for most itk classes.">Self</a>* m_Subsample ; <a name="l00281"></a>00281 <span class="keyword">const</span> TSample* m_Sample ; <a name="l00282"></a>00282 } ; <a name="l00283"></a>00283 <a name="l00284"></a>00284 <a name="l00285"></a>00285 <a name="l00286"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample.html#375992dede40cb2fb8a437c155330350">00286</a> <a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1Iterator.html">Iterator</a> Begin() <a name="l00287"></a>00287 { <a name="l00288"></a>00288 <a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1Iterator.html">Iterator</a> iter(m_IdHolder.begin(), <span class="keyword">this</span>) ; <a name="l00289"></a>00289 <span class="keywordflow">return</span> iter; <a name="l00290"></a>00290 } <a name="l00291"></a>00291 <a name="l00292"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample.html#f3ad7b2d80467f8dd8813624c3e05dc3">00292</a> <a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1Iterator.html">Iterator</a> End() <a name="l00293"></a>00293 { <a name="l00294"></a>00294 <a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1Iterator.html">Iterator</a> iter(m_IdHolder.end(), <span class="keyword">this</span>) ; <a name="l00295"></a>00295 <span class="keywordflow">return</span> iter; <a name="l00296"></a>00296 } <a name="l00297"></a>00297 <a name="l00298"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample.html#6a16ba6b4f117ff61318447015f68baa">00298</a> <a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1ConstIterator.html">ConstIterator</a> Begin()<span class="keyword"> const</span> <a name="l00299"></a>00299 <span class="keyword"> </span>{ <a name="l00300"></a>00300 <a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1ConstIterator.html">ConstIterator</a> iter(m_IdHolder.begin(), <span class="keyword">this</span>) ; <a name="l00301"></a>00301 <span class="keywordflow">return</span> iter; <a name="l00302"></a>00302 } <a name="l00303"></a>00303 <a name="l00304"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample.html#319afe3bfdebe982030d802d978b872d">00304</a> <a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1ConstIterator.html">ConstIterator</a> End()<span class="keyword"> const</span> <a name="l00305"></a>00305 <span class="keyword"> </span>{ <a name="l00306"></a>00306 <a class="code" href="classitk_1_1Statistics_1_1Subsample_1_1ConstIterator.html">ConstIterator</a> iter(m_IdHolder.end(), <span class="keyword">this</span>) ; <a name="l00307"></a>00307 <span class="keywordflow">return</span> iter; <a name="l00308"></a>00308 } <a name="l00309"></a>00309 <a name="l00310"></a>00310 <span class="keyword">protected</span>: <a name="l00311"></a>00311 <a class="code" href="classitk_1_1Statistics_1_1Subsample.html" title="This class stores a subset of instance identifiers from another sample object. You...">Subsample</a>() ; <a name="l00312"></a><a class="code" href="classitk_1_1Statistics_1_1Subsample.html#788697d3c800a786d2f205d95466ecd6">00312</a> <span class="keyword">virtual</span> <a class="code" href="classitk_1_1Statistics_1_1Subsample.html#788697d3c800a786d2f205d95466ecd6">~Subsample</a>() {} <a name="l00313"></a>00313 <span class="keywordtype">void</span> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#920ae03048a5ad715d803ca2e92b52de">PrintSelf</a>(std::ostream& os, <a class="code" href="classitk_1_1Indent.html" title="Control indentation during Print() invocation.">Indent</a> indent) <span class="keyword">const</span>; <a name="l00314"></a>00314 <a name="l00315"></a>00315 <span class="keyword">private</span>: <a name="l00316"></a>00316 <a class="code" href="classitk_1_1Statistics_1_1Subsample.html" title="This class stores a subset of instance identifiers from another sample object. You...">Subsample</a>(<span class="keyword">const</span> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#ac7d0120fe5292cdcdddb6163b8cb150">Self</a>&) ; <span class="comment">//purposely not implemented</span> <a name="l00317"></a>00317 <span class="keywordtype">void</span> operator=(<span class="keyword">const</span> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#ac7d0120fe5292cdcdddb6163b8cb150">Self</a>&) ; <span class="comment">//purposely not implemented</span> <a name="l00318"></a>00318 <a name="l00319"></a>00319 <span class="keyword">const</span> TSample* m_Sample ; <a name="l00320"></a>00320 InstanceIdentifierHolder m_IdHolder ; <a name="l00321"></a>00321 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> m_ActiveDimension ; <a name="l00322"></a>00322 FrequencyType m_TotalFrequency ; <a name="l00323"></a>00323 } ; <span class="comment">// end of class</span> <a name="l00324"></a>00324 <a name="l00325"></a>00325 <a name="l00326"></a>00326 } <span class="comment">// end of namespace Statistics </span> <a name="l00327"></a>00327 } <span class="comment">// end of namespace itk</span> <a name="l00328"></a>00328 <a name="l00329"></a>00329 <a name="l00330"></a>00330 <span class="preprocessor">#ifndef ITK_MANUAL_INSTANTIATION</span> <a name="l00331"></a>00331 <span class="preprocessor"></span><span class="preprocessor">#include "itkSubsample.txx"</span> <a name="l00332"></a>00332 <span class="preprocessor">#endif</span> <a name="l00333"></a>00333 <span class="preprocessor"></span> <a name="l00334"></a>00334 <span class="preprocessor">#endif</span> <a name="l00335"></a>00335 <span class="preprocessor"></span> <a name="l00336"></a>00336 <a name="l00337"></a>00337 <a name="l00338"></a>00338 <a name="l00339"></a>00339 <a name="l00340"></a>00340 <a name="l00341"></a>00341 <a name="l00342"></a>00342 </pre></div></div> <hr><address><small> Generated at Fri May 8 00:18:58 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>