<!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: itkImageToListAdaptor.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>itkImageToListAdaptor.h</h1><a href="itkImageToListAdaptor_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: itkImageToListAdaptor.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-08-19 22:27:57 $</span> <a name="l00007"></a>00007 <span class="comment"> Version: $Revision: 1.38 $</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 __itkImageToListAdaptor_h</span> <a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#define __itkImageToListAdaptor_h</span> <a name="l00019"></a>00019 <span class="preprocessor"></span> <a name="l00020"></a>00020 <span class="preprocessor">#include <typeinfo></span> <a name="l00021"></a>00021 <a name="l00022"></a>00022 <span class="preprocessor">#include "<a class="code" href="itkImage_8h.html">itkImage.h</a>"</span> <a name="l00023"></a>00023 <span class="preprocessor">#include "itkPixelTraits.h"</span> <a name="l00024"></a>00024 <span class="preprocessor">#include "<a class="code" href="itkListSampleBase_8h.html">itkListSampleBase.h</a>"</span> <a name="l00025"></a>00025 <span class="preprocessor">#include "<a class="code" href="itkSmartPointer_8h.html">itkSmartPointer.h</a>"</span> <a name="l00026"></a>00026 <span class="preprocessor">#include "<a class="code" href="itkImageRegionIterator_8h.html">itkImageRegionIterator.h</a>"</span> <a name="l00027"></a>00027 <span class="preprocessor">#include "<a class="code" href="itkFixedArray_8h.html">itkFixedArray.h</a>"</span> <a name="l00028"></a>00028 <span class="preprocessor">#include "<a class="code" href="itkMacro_8h.html">itkMacro.h</a>"</span> <a name="l00029"></a>00029 <a name="l00030"></a>00030 <span class="keyword">namespace </span>itk{ <a name="l00031"></a>00031 <span class="keyword">namespace </span>Statistics{ <a name="l00032"></a>00032 <a name="l00062"></a>00062 <span class="keyword">template</span> < <span class="keyword">class </span>TImage, <a name="l00063"></a>00063 <span class="keyword">class </span>TMeasurementVector = <a name="l00064"></a>00064 <a class="code" href="itkWin32Header_8h.html#140a5da12f0043ba181c7ae0109c31bf">ITK_TYPENAME</a> TImage::PixelType > <a name="l00065"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor.html">00065</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_1ImageToListAdaptor.html" title="This class provides ListSampleBase interfaces to ITK Image.">ImageToListAdaptor</a> : <a name="l00066"></a>00066 <span class="keyword">public</span> <a class="code" href="classitk_1_1Statistics_1_1ListSampleBase.html" title="This class is the base class for Samples that store measurements in a list.">ListSampleBase</a>< TMeasurementVector > <a name="l00067"></a>00067 { <a name="l00068"></a>00068 <span class="keyword">public</span>: <a name="l00070"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor.html#5cc99db44b4498bdac8a3034b6225a58">00070</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor.html" title="This class provides ListSampleBase interfaces to ITK Image.">ImageToListAdaptor</a> <a class="code" href="classitk_1_1LightObject.html" title="Light weight base class for most itk classes.">Self</a>; <a name="l00071"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor.html#f23c1d44d06ba623960890a601cd0c38">00071</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1Statistics_1_1ListSampleBase.html" title="This class is the base class for Samples that store measurements in a list.">ListSampleBase< TMeasurementVector ></a> <a class="code" href="classitk_1_1LightObject.html" title="Light weight base class for most itk classes.">Superclass</a>; <a name="l00072"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor.html#7611e8ad897be7078c456c3b7d3e1a3a">00072</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="l00073"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor.html#ea58b075041017940e5771bf5aa0c285">00073</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="l00074"></a>00074 <a name="l00076"></a>00076 <a class="code" href="itkMacro_8h.html#574c1f86661d409dd32c742307a0e96a">itkTypeMacro</a>(<a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor.html" title="This class provides ListSampleBase interfaces to ITK Image.">ImageToListAdaptor</a>, <a class="code" href="classitk_1_1Statistics_1_1ListSampleBase.html" title="This class is the base class for Samples that store measurements in a list.">ListSampleBase</a>); <a name="l00077"></a>00077 <a name="l00079"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor.html#e556f31fec4e1d1a89b2848368aafcd9">00079</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="l00080"></a>00080 <a name="l00082"></a>00082 <span class="keyword">typedef</span> TImage ImageType; <a name="l00083"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor.html#802f88b44d0184b4a6e2712ba7de12aa">00083</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="itkFEMMacro_8h.html#539cce1a3282ba59952dedcbf9cdb23f">ImageType::Pointer</a> ImagePointer; <a name="l00084"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor.html#2ece4c05f188bcb38b53d3cac4ab517f">00084</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="itkFEMMacro_8h.html#68fafcc6909430ccd70cbc4aeee0107c">ImageType::ConstPointer</a> ImageConstPointer; <a name="l00085"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor.html#b4425b277b2dea7ee87c7f2e3f0f0ebb">00085</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#be32dc19e71d40322ad9828b9ab40853">ImageType::IndexType</a> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#be32dc19e71d40322ad9828b9ab40853">IndexType</a>; <a name="l00086"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor.html#aff0490243a080d1e710f97d9aeaa31c">00086</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> ImageType::PixelType PixelType; <a name="l00087"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor.html#f19451e5b9255deef1fdd9030e704d48">00087</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> ImageType::PixelContainerConstPointer PixelContainerConstPointer; <a name="l00088"></a>00088 <span class="keyword">typedef</span> <span class="keyword">typename</span> ImageType::PixelContainer::ElementIdentifier <a name="l00089"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor.html#1161136189932b2e8bbd9d089cce67fd">00089</a> InstanceIdentifier; <a name="l00090"></a>00090 <a name="l00092"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor.html#22ab0858652ed716e3dcbd726368bd45">00092</a> <span class="keyword">typedef</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< ImageType ></a> <a class="code" href="classitk_1_1ImageRegionIterator.html" title="A multi-dimensional iterator templated over image type that walks a region of pixels...">IteratorType</a>; <a name="l00093"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor.html#30bdd506bfd40f3cc34e266fb4287d35">00093</a> <span class="keyword">typedef</span> PixelTraits< typename TImage::PixelType > PixelTraitsType; <a name="l00094"></a>00094 <a name="l00097"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor.html#09d9d3ebe3a4994b5eb9b01d5544f95c">00097</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> PixelTraitsType::ValueType MeasurementType; <a name="l00098"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor.html#559e2f6b621624f760c3dc33544a9567">00098</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> Superclass::FrequencyType FrequencyType; <a name="l00099"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor.html#a1e72ae9409ccb65962e13b3a3ad7ebf">00099</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> Superclass::TotalFrequencyType TotalFrequencyType; <a name="l00100"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor.html#f0418ac9303d08fba57ef1cde2d7461e">00100</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> Superclass::MeasurementVectorSizeType MeasurementVectorSizeType; <a name="l00101"></a>00101 <a name="l00103"></a>00103 <a class="code" href="itkMacro_8h.html#1905cf6b2e88235996fa7ff73b2fb0eb">itkStaticConstMacro</a>(MeasurementVectorSize, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>, <a name="l00104"></a>00104 PixelTraitsType::Dimension); <a name="l00105"></a>00105 <a name="l00106"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor.html#9e8a1e431a73600f9449a53bec79d4e2">00106</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> SetMeasurementVectorSize( <span class="keyword">const</span> MeasurementVectorSizeType s ) <a name="l00107"></a>00107 { <a name="l00108"></a>00108 <span class="comment">// Measurement vector size for this class is fixed as the pixel's </span> <a name="l00109"></a>00109 <span class="comment">// dimension. This method should throw an exception if the user tries to </span> <a name="l00110"></a>00110 <span class="comment">// set the dimension to a different value. </span> <a name="l00111"></a>00111 <span class="keywordflow">if</span>( s != MeasurementVectorSize ) <a name="l00112"></a>00112 { <a name="l00113"></a>00113 <a class="code" href="itkMacro_8h.html#c51de1a715471e7fd0f2e481a70fa1f8">itkExceptionMacro</a>( << <span class="stringliteral">"Measurement vector size for the image adaptor obtained"</span> <a name="l00114"></a>00114 << <span class="stringliteral">" from the pixel dimension is: "</span> << MeasurementVectorSize << <span class="stringliteral">" but you "</span> <a name="l00115"></a>00115 << <span class="stringliteral">"are setting it to "</span> << s); <a name="l00116"></a>00116 } <a name="l00117"></a>00117 } <a name="l00118"></a>00118 <a name="l00119"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor.html#ca40b5d7827051d20e153bcda89b6218">00119</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> GetMeasurementVectorSize()<span class="keyword"> const </span> <a name="l00120"></a>00120 <span class="keyword"> </span>{ <a name="l00121"></a>00121 <span class="keywordflow">return</span> MeasurementVectorSize; <a name="l00122"></a>00122 } <a name="l00123"></a>00123 <a name="l00124"></a>00124 <a name="l00125"></a>00125 <a name="l00126"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor.html#dd8dce98a8a0d87812d6549c90bca7d6">00126</a> <span class="keyword">typedef</span> TMeasurementVector <a class="code" href="classitk_1_1FixedArray.html" title="Simulate a standard C array with copy semnatics.">MeasurementVectorType</a>; <a name="l00127"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor.html#84497227bc061ad507ab93400d436110">00127</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1FixedArray.html" title="Simulate a standard C array with copy semnatics.">MeasurementVectorType</a> <a class="code" href="classitk_1_1FixedArray.html" title="Simulate a standard C array with copy semnatics.">ValueType</a>; <a name="l00128"></a>00128 <a name="l00130"></a>00130 <span class="keywordtype">void</span> SetImage(<span class="keyword">const</span> TImage* image); <a name="l00131"></a>00131 <a name="l00133"></a>00133 <span class="keyword">const</span> TImage* GetImage() <span class="keyword">const</span>; <a name="l00134"></a>00134 <a name="l00136"></a>00136 <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="l00137"></a>00137 <a name="l00138"></a>00138 <span class="keyword">inline</span> <span class="keyword">virtual</span> <span class="keyword">const</span> <a class="code" href="classitk_1_1FixedArray.html" title="Simulate a standard C array with copy semnatics.">MeasurementVectorType</a> & GetMeasurementVector(<span class="keyword">const</span> InstanceIdentifier &<span class="keywordtype">id</span>) <span class="keyword">const</span>; <a name="l00139"></a>00139 <a name="l00140"></a>00140 <span class="keyword">inline</span> FrequencyType GetFrequency(<span class="keyword">const</span> InstanceIdentifier &<span class="keywordtype">id</span>) <span class="keyword">const</span>; <a name="l00141"></a>00141 <a name="l00142"></a>00142 TotalFrequencyType GetTotalFrequency() <span class="keyword">const</span>; <a name="l00143"></a>00143 <a name="l00144"></a>00144 <a name="l00145"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_1_1Iterator.html">00145</a> <span class="keyword">class </span><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_1_1Iterator.html">Iterator</a> <a name="l00146"></a>00146 { <a name="l00147"></a>00147 <span class="keyword">public</span>: <a name="l00148"></a>00148 <a name="l00149"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_1_1Iterator.html#62b14ed1c4ce6e9911e2f739b59d118b">00149</a> <a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_1_1Iterator.html#62b14ed1c4ce6e9911e2f739b59d118b">Iterator</a>(){} <a name="l00150"></a>00150 <a name="l00151"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_1_1Iterator.html#6776c2a1bdeb6f1d78140418af576a6a">00151</a> <a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_1_1Iterator.html">Iterator</a>(InstanceIdentifier <span class="keywordtype">id</span>, <a class="code" href="classitk_1_1SmartPointer.html">Pointer</a> pContainer) <a name="l00152"></a>00152 :m_Id(id),m_Container(pContainer) <a name="l00153"></a>00153 {} <a name="l00154"></a>00154 <a name="l00155"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_1_1Iterator.html#f8e6e21fc7ae837e65824c93dd5ab135">00155</a> FrequencyType GetFrequency()<span class="keyword"> const</span> <a name="l00156"></a>00156 <span class="keyword"> </span>{ <span class="keywordflow">return</span> 1;} <a name="l00157"></a>00157 <a name="l00158"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_1_1Iterator.html#a39a44aba7ea3a832a9e68a97bcb0a31">00158</a> <span class="keyword">const</span> MeasurementVectorType & GetMeasurementVector()<span class="keyword"> const</span> <a name="l00159"></a>00159 <span class="keyword"> </span>{ <span class="keywordflow">return</span> m_Container->GetMeasurementVector(m_Id);} <a name="l00160"></a>00160 <a name="l00161"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_1_1Iterator.html#3fb8caa5ff7355701b796a6f73752d5c">00161</a> InstanceIdentifier GetInstanceIdentifier()<span class="keyword"> const</span> <a name="l00162"></a>00162 <span class="keyword"> </span>{ <span class="keywordflow">return</span> m_Id;} <a name="l00163"></a>00163 <a name="l00164"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_1_1Iterator.html#1285b05a7a4ada21566a07bd1127a1f4">00164</a> <a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_1_1Iterator.html">Iterator</a>& operator++() <a name="l00165"></a>00165 { ++m_Id; <span class="keywordflow">return</span> *<span class="keyword">this</span>;} <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_Id += n; return *this;}*/</span> <a name="l00169"></a>00169 <a name="l00170"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_1_1Iterator.html#029ab13a5b27ff0b8dc2b293ab3af257">00170</a> <a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_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_Id += n; <span class="keywordflow">return</span> *<span class="keyword">this</span>;} <a name="l00172"></a>00172 <a name="l00173"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_1_1Iterator.html#053c505aadcb18f81fe7266250ffc4b9">00173</a> <a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_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_Id -= n; <span class="keywordflow">return</span> *<span class="keyword">this</span>;} <a name="l00175"></a>00175 <a name="l00176"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_1_1Iterator.html#7ddbc9c681c4e8479fc203d6b37c1555">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_1ImageToListAdaptor_1_1Iterator.html">Iterator</a> &it) <a name="l00177"></a>00177 { <a name="l00178"></a>00178 <span class="keywordflow">if</span> (m_Id != it.m_Id) <a name="l00179"></a>00179 {<span class="keywordflow">return</span> <span class="keyword">true</span>;} <a name="l00180"></a>00180 <a name="l00181"></a>00181 <span class="keywordflow">if</span> (m_Container != it.m_Container) <a name="l00182"></a>00182 { <span class="keywordflow">return</span> <span class="keyword">true</span>;} <a name="l00183"></a>00183 <a name="l00184"></a>00184 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00185"></a>00185 } <a name="l00186"></a>00186 <a name="l00187"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_1_1Iterator.html#e8bb98df848175bcf4833b3f56dab9a2">00187</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_1ImageToListAdaptor_1_1Iterator.html">Iterator</a> &it) <a name="l00188"></a>00188 { <span class="keywordflow">return</span> !(*<span class="keyword">this</span> != it);} <a name="l00189"></a>00189 <a name="l00190"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_1_1Iterator.html#d4097dee9c50e7d77e810333bd38afaa">00190</a> <a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_1_1Iterator.html">Iterator</a>& operator = (<span class="keyword">const</span> <a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_1_1Iterator.html">Iterator</a> &iter) <a name="l00191"></a>00191 { <a name="l00192"></a>00192 m_Id = iter.m_Id; <a name="l00193"></a>00193 m_Container = iter.m_Container; <a name="l00194"></a>00194 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00195"></a>00195 } <a name="l00196"></a>00196 <a name="l00197"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_1_1Iterator.html#27b7937688b959c2b9f557ba139a7c02">00197</a> <a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_1_1Iterator.html">Iterator</a>(<span class="keyword">const</span> <a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_1_1Iterator.html">Iterator</a> &iter) <a name="l00198"></a>00198 { <a name="l00199"></a>00199 m_Id = iter.m_Id; <a name="l00200"></a>00200 m_Container = iter.m_Container; <a name="l00201"></a>00201 } <a name="l00202"></a>00202 <a name="l00203"></a>00203 <span class="keyword">private</span>: <a name="l00204"></a>00204 InstanceIdentifier m_Id; <span class="comment">// Current id </span> <a name="l00205"></a>00205 <a class="code" href="classitk_1_1SmartPointer.html">Pointer</a> m_Container; <a name="l00206"></a>00206 }; <a name="l00207"></a>00207 <a name="l00208"></a>00208 <a name="l00209"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_1_1ConstIterator.html">00209</a> <span class="keyword">class </span><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_1_1ConstIterator.html">ConstIterator</a> <a name="l00210"></a>00210 { <a name="l00211"></a>00211 <span class="keyword">public</span>: <a name="l00212"></a>00212 <a name="l00213"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_1_1ConstIterator.html#396f376b54ff10422f02d2587f88a6d1">00213</a> <a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_1_1ConstIterator.html#396f376b54ff10422f02d2587f88a6d1">ConstIterator</a>(){} <a name="l00214"></a>00214 <a name="l00215"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_1_1ConstIterator.html#b2f9ced6eecc704c6f43686a654cbde3">00215</a> <a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_1_1ConstIterator.html">ConstIterator</a>(InstanceIdentifier <span class="keywordtype">id</span>, <a class="code" href="classitk_1_1SmartPointer.html">ConstPointer</a> pContainer) <a name="l00216"></a>00216 :m_Id(id),m_Container(pContainer) <a name="l00217"></a>00217 {} <a name="l00218"></a>00218 <a name="l00219"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_1_1ConstIterator.html#df442a5a119f716c8127dd8b2831396b">00219</a> FrequencyType GetFrequency()<span class="keyword"> const</span> <a name="l00220"></a>00220 <span class="keyword"> </span>{ <span class="keywordflow">return</span> 1;} <a name="l00221"></a>00221 <a name="l00222"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_1_1ConstIterator.html#0e606e06b3f2dcc1f3af4f4e4322c468">00222</a> <span class="keyword">const</span> MeasurementVectorType & GetMeasurementVector()<span class="keyword"> const</span> <a name="l00223"></a>00223 <span class="keyword"> </span>{ <span class="keywordflow">return</span> m_Container->GetMeasurementVector(m_Id);} <a name="l00224"></a>00224 <a name="l00225"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_1_1ConstIterator.html#03b4f4a74ac40aab1fed5b44cdb44b55">00225</a> InstanceIdentifier GetInstanceIdentifier()<span class="keyword"> const</span> <a name="l00226"></a>00226 <span class="keyword"> </span>{ <span class="keywordflow">return</span> m_Id;} <a name="l00227"></a>00227 <a name="l00228"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_1_1ConstIterator.html#30b380e85590966d39ebdc05a13e44ba">00228</a> <a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_1_1ConstIterator.html">ConstIterator</a>& operator++() <a name="l00229"></a>00229 { ++m_Id; <span class="keywordflow">return</span> *<span class="keyword">this</span>;} <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_Id += n; return *this;}*/</span> <a name="l00233"></a>00233 <a name="l00234"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_1_1ConstIterator.html#4fb4e7bf42400876be56133b23ca1814">00234</a> <a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_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_Id += n; <span class="keywordflow">return</span> *<span class="keyword">this</span>;} <a name="l00236"></a>00236 <a name="l00237"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_1_1ConstIterator.html#8be15df858966cad8045384c47408e10">00237</a> <a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_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_Id -= n; <span class="keywordflow">return</span> *<span class="keyword">this</span>;} <a name="l00239"></a>00239 <a name="l00240"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_1_1ConstIterator.html#771b8e294bd98d2d9b8aabff8edad959">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_1ImageToListAdaptor_1_1ConstIterator.html">ConstIterator</a> &it) <a name="l00241"></a>00241 { <a name="l00242"></a>00242 <span class="keywordflow">if</span> (m_Id != it.m_Id) <a name="l00243"></a>00243 {<span class="keywordflow">return</span> <span class="keyword">true</span>;} <a name="l00244"></a>00244 <a name="l00245"></a>00245 <span class="keywordflow">if</span> (m_Container != it.m_Container) <a name="l00246"></a>00246 { <span class="keywordflow">return</span> <span class="keyword">true</span>;} <a name="l00247"></a>00247 <a name="l00248"></a>00248 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00249"></a>00249 } <a name="l00250"></a>00250 <a name="l00251"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_1_1ConstIterator.html#82ea6afa0f4aceadd5c4315c63a898db">00251</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_1ImageToListAdaptor_1_1ConstIterator.html">ConstIterator</a> &it) <a name="l00252"></a>00252 { <span class="keywordflow">return</span> !(*<span class="keyword">this</span> != it);} <a name="l00253"></a>00253 <a name="l00254"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_1_1ConstIterator.html#f1d59af8e924274731ba2a205c1c582b">00254</a> <a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_1_1ConstIterator.html">ConstIterator</a>& operator = (<span class="keyword">const</span> <a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_1_1ConstIterator.html">ConstIterator</a> &iter) <a name="l00255"></a>00255 { <a name="l00256"></a>00256 m_Id = iter.m_Id; <a name="l00257"></a>00257 m_Container = iter.m_Container; <a name="l00258"></a>00258 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00259"></a>00259 } <a name="l00260"></a>00260 <a name="l00261"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_1_1ConstIterator.html#50a527a8240fd3188e721e9df9500b37">00261</a> <a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_1_1ConstIterator.html">ConstIterator</a>(<span class="keyword">const</span> <a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor_1_1ConstIterator.html">ConstIterator</a> &iter) <a name="l00262"></a>00262 { <a name="l00263"></a>00263 m_Id = iter.m_Id; <a name="l00264"></a>00264 m_Container = iter.m_Container; <a name="l00265"></a>00265 } <a name="l00266"></a>00266 <a name="l00267"></a>00267 <span class="keyword">private</span>: <a name="l00268"></a>00268 InstanceIdentifier m_Id; <span class="comment">// Current id </span> <a name="l00269"></a>00269 <a class="code" href="classitk_1_1SmartPointer.html">ConstPointer</a> m_Container; <a name="l00270"></a>00270 }; <a name="l00271"></a>00271 <a name="l00272"></a>00272 <a name="l00273"></a>00273 <a name="l00274"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor.html#aaacebc5acce179349b9da9325b21d6b">00274</a> Iterator Begin() <a name="l00275"></a>00275 { <a name="l00276"></a>00276 Iterator iter(0, <span class="keyword">this</span>); <a name="l00277"></a>00277 <span class="keywordflow">return</span> iter; <a name="l00278"></a>00278 } <a name="l00279"></a>00279 <a name="l00280"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor.html#63eecf901a849b7d990ccc8ccdccef52">00280</a> Iterator End() <a name="l00281"></a>00281 { <a name="l00282"></a>00282 Iterator iter(this-><a class="code" href="classitk_1_1Size.html" title="Represent the size (bounds) of a n-dimensional image.">Size</a>(), <span class="keyword">this</span>); <a name="l00283"></a>00283 <span class="keywordflow">return</span> iter; <a name="l00284"></a>00284 } <a name="l00285"></a>00285 <a name="l00286"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor.html#171a86f021535fae4e2cd476df317a61">00286</a> ConstIterator Begin()<span class="keyword"> const</span> <a name="l00287"></a>00287 <span class="keyword"> </span>{ <a name="l00288"></a>00288 ConstIterator iter(0, <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_1ImageToListAdaptor.html#7ae4e3a53c0fd8d281d85e542dbc791c">00292</a> ConstIterator End()<span class="keyword"> const</span> <a name="l00293"></a>00293 <span class="keyword"> </span>{ <a name="l00294"></a>00294 ConstIterator iter(this-><a class="code" href="classitk_1_1Size.html" title="Represent the size (bounds) of a n-dimensional image.">Size</a>(), <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>00298 <span class="keyword">protected</span>: <a name="l00299"></a>00299 <a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor.html" title="This class provides ListSampleBase interfaces to ITK Image.">ImageToListAdaptor</a>(); <a name="l00300"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor.html#bf3540e44045ae409d25363b8010318d">00300</a> <span class="keyword">virtual</span> <a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor.html#bf3540e44045ae409d25363b8010318d">~ImageToListAdaptor</a>() {} <a name="l00301"></a>00301 <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="l00302"></a>00302 <a name="l00303"></a>00303 <a class="code" href="itkMacro_8h.html#7d989c13a1a213168db99ae0f84185d4">itkGetConstReferenceMacro</a>(PixelContainer,PixelContainerConstPointer); <a name="l00304"></a>00304 <a class="code" href="itkMacro_8h.html#7d989c13a1a213168db99ae0f84185d4">itkGetConstReferenceMacro</a>(UseBuffer,<span class="keywordtype">bool</span>); <a name="l00305"></a>00305 <a class="code" href="itkMacro_8h.html#7d989c13a1a213168db99ae0f84185d4">itkGetConstReferenceMacro</a>(ImageBeginIndex,<a class="code" href="namespaceHardConnectedComponentImageFilter.html#be32dc19e71d40322ad9828b9ab40853">IndexType</a>); <a name="l00306"></a>00306 <a class="code" href="itkMacro_8h.html#7d989c13a1a213168db99ae0f84185d4">itkGetConstReferenceMacro</a>(ImageEndIndex,<a class="code" href="namespaceHardConnectedComponentImageFilter.html#be32dc19e71d40322ad9828b9ab40853">IndexType</a>); <a name="l00307"></a>00307 <a name="l00308"></a>00308 <a name="l00309"></a>00309 <span class="keyword">private</span>: <a name="l00310"></a>00310 <a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor.html" title="This class provides ListSampleBase interfaces to ITK Image.">ImageToListAdaptor</a>(<span class="keyword">const</span> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#ac7d0120fe5292cdcdddb6163b8cb150">Self</a>&); <span class="comment">//purposely not implemented</span> <a name="l00311"></a>00311 <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="l00312"></a>00312 <a name="l00313"></a>00313 PixelContainerConstPointer m_PixelContainer; <a name="l00314"></a>00314 <span class="keywordtype">bool</span> m_UseBuffer; <a name="l00315"></a>00315 <a class="code" href="namespaceHardConnectedComponentImageFilter.html#be32dc19e71d40322ad9828b9ab40853">IndexType</a> m_ImageBeginIndex; <a name="l00316"></a>00316 <a class="code" href="namespaceHardConnectedComponentImageFilter.html#be32dc19e71d40322ad9828b9ab40853">IndexType</a> m_ImageEndIndex; <a name="l00317"></a>00317 <a name="l00318"></a>00318 ImageConstPointer m_Image; <a name="l00319"></a>00319 }; <span class="comment">// end of class ImageToListAdaptor</span> <a name="l00320"></a>00320 <a name="l00321"></a>00321 <span class="keyword">template</span> < <span class="keyword">class</span> TImage, <span class="keyword">class</span> TMeasurementVector > <a name="l00322"></a>00322 <span class="keyword">inline</span> <span class="keyword">const</span> TMeasurementVector & <a name="l00323"></a>00323 <a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor.html#425960c153bfb968c3b038e6388d786b">ImageToListAdaptor< TImage, TMeasurementVector ></a> <a name="l00324"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor.html#425960c153bfb968c3b038e6388d786b">00324</a> <a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor.html#425960c153bfb968c3b038e6388d786b">::GetMeasurementVector</a>(<span class="keyword">const</span> InstanceIdentifier &<span class="keywordtype">id</span>)<span class="keyword"> const</span> <a name="l00325"></a>00325 <span class="keyword"></span>{ <a name="l00326"></a>00326 <span class="keywordflow">if</span> ( m_UseBuffer ) <a name="l00327"></a>00327 { <a name="l00328"></a>00328 <span class="keywordflow">return</span> *( <span class="keyword">reinterpret_cast<</span> <span class="keyword">const </span>MeasurementVectorType* <span class="keyword">></span>(&(*m_PixelContainer)[id]) ); <a name="l00329"></a>00329 } <a name="l00330"></a>00330 <span class="keywordflow">else</span> <a name="l00331"></a>00331 { <a name="l00332"></a>00332 <span class="keywordflow">return</span> *(<span class="keyword">reinterpret_cast<</span> <span class="keyword">const </span>MeasurementVectorType* <span class="keyword">></span> <a name="l00333"></a>00333 ( &(m_Image->GetPixel( m_Image->ComputeIndex( <span class="keywordtype">id</span> ) ) ) ) ); <a name="l00334"></a>00334 } <a name="l00335"></a>00335 } <a name="l00336"></a>00336 <a name="l00338"></a>00338 <span class="keyword">template</span> < <span class="keyword">class</span> TImage, <span class="keyword">class</span> TMeasurementVector > <a name="l00339"></a>00339 <span class="keyword">inline</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a name="l00340"></a>00340 <a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor.html#71347fdb1c6034b4dcff1794d55e61eb">ImageToListAdaptor< TImage, TMeasurementVector ></a> <a name="l00341"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor.html#71347fdb1c6034b4dcff1794d55e61eb">00341</a> <a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor.html#71347fdb1c6034b4dcff1794d55e61eb">::Size</a>()<span class="keyword"> const</span> <a name="l00342"></a>00342 <span class="keyword"></span>{ <a name="l00343"></a>00343 <span class="keywordflow">return</span> m_PixelContainer->Size(); <a name="l00344"></a>00344 } <a name="l00345"></a>00345 <a name="l00346"></a>00346 <span class="keyword">template</span> < <span class="keyword">class</span> TImage, <span class="keyword">class</span> TMeasurementVector > <a name="l00347"></a>00347 <span class="keyword">inline</span> <span class="keyword">typename</span> <a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor.html" title="This class provides ListSampleBase interfaces to ITK Image.">ImageToListAdaptor< TImage, TMeasurementVector >::FrequencyType</a> <a name="l00348"></a>00348 <a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor.html#c8f85d9a3caa70abf5f388ea92db7aea">ImageToListAdaptor< TImage, TMeasurementVector ></a> <a name="l00349"></a><a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor.html#c8f85d9a3caa70abf5f388ea92db7aea">00349</a> <a class="code" href="classitk_1_1Statistics_1_1ImageToListAdaptor.html#c8f85d9a3caa70abf5f388ea92db7aea">::GetFrequency</a>(<span class="keyword">const</span> InstanceIdentifier &)<span class="keyword"> const </span> <a name="l00350"></a>00350 <span class="keyword"></span>{ <a name="l00351"></a>00351 <span class="keywordflow">return</span> NumericTraits< FrequencyType >::One; <a name="l00352"></a>00352 } <a name="l00353"></a>00353 <a name="l00354"></a>00354 <a name="l00355"></a>00355 <a name="l00356"></a>00356 } <span class="comment">// end of namespace Statistics</span> <a name="l00357"></a>00357 } <span class="comment">// end of namespace itk</span> <a name="l00358"></a>00358 <a name="l00359"></a>00359 <span class="preprocessor">#ifndef ITK_MANUAL_INSTANTIATION</span> <a name="l00360"></a>00360 <span class="preprocessor"></span><span class="preprocessor">#include "itkImageToListAdaptor.txx"</span> <a name="l00361"></a>00361 <span class="preprocessor">#endif</span> <a name="l00362"></a>00362 <span class="preprocessor"></span> <a name="l00363"></a>00363 <span class="preprocessor">#endif</span> <a name="l00364"></a>00364 <span class="preprocessor"></span> </pre></div></div> <hr><address><small> Generated at Thu May 7 23:14:37 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>