<!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: itkListSampleToHistogramGenerator.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>itkListSampleToHistogramGenerator.h</h1><a href="itkListSampleToHistogramGenerator_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: itkListSampleToHistogramGenerator.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-03-14 22:52:18 $</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 __itkListSampleToHistogramGenerator_h</span> <a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#define __itkListSampleToHistogramGenerator_h</span> <a name="l00019"></a>00019 <span class="preprocessor"></span> <a name="l00020"></a>00020 <span class="preprocessor">#include "<a class="code" href="itkObject_8h.html">itkObject.h</a>"</span> <a name="l00021"></a>00021 <span class="preprocessor">#include "<a class="code" href="itkListSampleBase_8h.html">itkListSampleBase.h</a>"</span> <a name="l00022"></a>00022 <span class="preprocessor">#include "<a class="code" href="itkHistogram_8h.html">itkHistogram.h</a>"</span> <a name="l00023"></a>00023 <span class="preprocessor">#include "<a class="code" href="itkStatisticsAlgorithm_8h.html">itkStatisticsAlgorithm.h</a>"</span> <a name="l00024"></a>00024 <span class="preprocessor">#include "<a class="code" href="itkDenseFrequencyContainer_8h.html">itkDenseFrequencyContainer.h</a>"</span> <a name="l00025"></a>00025 <span class="preprocessor">#include "itkNumericTraits.h"</span> <a name="l00026"></a>00026 <a name="l00027"></a>00027 <span class="keyword">namespace </span>itk{ <a name="l00028"></a>00028 <span class="keyword">namespace </span>Statistics{ <a name="l00029"></a>00029 <a name="l00067"></a>00067 <span class="keyword">template</span>< <span class="keyword">class </span>TListSample, <a name="l00068"></a>00068 <span class="keyword">class </span>THistogramMeasurement, <a name="l00069"></a>00069 <span class="keyword">class </span>TFrequencyContainer = DenseFrequencyContainer, <a name="l00070"></a>00070 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> TMeasurementVectorLength = 1 > <a name="l00071"></a><a class="code" href="classitk_1_1Statistics_1_1ListSampleToHistogramGenerator.html">00071</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_1ListSampleToHistogramGenerator.html" title="Generates a Histogram using the data from the ListSample object.">ListSampleToHistogramGenerator</a> : <a name="l00072"></a>00072 <span class="keyword">public</span> <a class="code" href="classitk_1_1Object.html" title="Base class for most itk classes.">Object</a> <a name="l00073"></a>00073 { <a name="l00074"></a>00074 <span class="keyword">public</span>: <a name="l00076"></a><a class="code" href="classitk_1_1Statistics_1_1ListSampleToHistogramGenerator.html#0a2079ab7901272fcc27acca74cc5965">00076</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1Statistics_1_1ListSampleToHistogramGenerator.html" title="Generates a Histogram using the data from the ListSample object.">ListSampleToHistogramGenerator</a> <a class="code" href="classitk_1_1LightObject.html" title="Light weight base class for most itk classes.">Self</a>; <a name="l00077"></a><a class="code" href="classitk_1_1Statistics_1_1ListSampleToHistogramGenerator.html#7676083a13ce77cf009fcec834ea7753">00077</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1Object.html" title="Base class for most itk classes.">Object</a> <a class="code" href="classitk_1_1LightObject.html" title="Light weight base class for most itk classes.">Superclass</a>; <a name="l00078"></a><a class="code" href="classitk_1_1Statistics_1_1ListSampleToHistogramGenerator.html#017565de8f044f6e64c93e247e523575">00078</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="l00079"></a><a class="code" href="classitk_1_1Statistics_1_1ListSampleToHistogramGenerator.html#9754284c2867bb5f616b3a24344e33ab">00079</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="l00080"></a>00080 <a name="l00082"></a>00082 <a class="code" href="itkMacro_8h.html#574c1f86661d409dd32c742307a0e96a">itkTypeMacro</a>(<a class="code" href="classitk_1_1Statistics_1_1ListSampleToHistogramGenerator.html" title="Generates a Histogram using the data from the ListSample object.">ListSampleToHistogramGenerator</a>, <a class="code" href="classitk_1_1Object.html" title="Base class for most itk classes.">Object</a>) ; <a name="l00083"></a>00083 <a name="l00085"></a>00085 <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="l00086"></a>00086 <a name="l00088"></a>00088 <a class="code" href="itkMacro_8h.html#1905cf6b2e88235996fa7ff73b2fb0eb">itkStaticConstMacro</a>(MeasurementVectorSize, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>, <a name="l00089"></a>00089 TMeasurementVectorLength); <a name="l00090"></a>00090 <a name="l00092"></a>00092 <span class="keyword">typedef</span> <span class="keyword">typename</span> NumericTraits< THistogramMeasurement >::RealType <a name="l00093"></a><a class="code" href="classitk_1_1Statistics_1_1ListSampleToHistogramGenerator.html#7695b4481f09f8e33a103af32f1b5128">00093</a> HistogramMeasurementRealType; <a name="l00094"></a>00094 <a name="l00095"></a>00095 <span class="keyword">typedef</span> <a class="code" href="classitk_1_1Statistics_1_1Histogram.html" title="This class stores measurement vectors in the context of n-dimensional histogram.">Histogram</a>< HistogramMeasurementRealType, <a name="l00096"></a>00096 <a class="code" href="itkMacro_8h.html#94ef2dc11d52c8ef0a78e34558feb8cb">itkGetStaticConstMacro</a>(MeasurementVectorSize), <a name="l00097"></a><a class="code" href="classitk_1_1Statistics_1_1ListSampleToHistogramGenerator.html#e7d62a781a3b463b33c1840f2c803e5a">00097</a> TFrequencyContainer > <a class="code" href="classitk_1_1Statistics_1_1Histogram.html" title="This class stores measurement vectors in the context of n-dimensional histogram.">HistogramType</a> ; <a name="l00098"></a>00098 <a name="l00099"></a><a class="code" href="classitk_1_1Statistics_1_1ListSampleToHistogramGenerator.html#d2cc4a11fb2bc881ffc1a0262cc730a2">00099</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="classitk_1_1Size.html">HistogramType::SizeType</a> <a class="code" href="classitk_1_1Size.html">HistogramSizeType</a> ; <a name="l00100"></a><a class="code" href="classitk_1_1Statistics_1_1ListSampleToHistogramGenerator.html#0a16e794e68f79adf1d3ac02415998c9">00100</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> HistogramType::MeasurementVectorType MeasurementVectorType; <a name="l00101"></a>00101 <a name="l00103"></a><a class="code" href="classitk_1_1Statistics_1_1ListSampleToHistogramGenerator.html#f858b9298103dff87acbdfeee552474b">00103</a> <span class="keywordtype">void</span> SetListSample(<span class="keyword">const</span> TListSample* <a class="code" href="classstd_1_1list.html">list</a>) <a name="l00104"></a>00104 { <a name="l00105"></a>00105 <span class="comment">// Throw exception if the length of measurement vectors in the list is not</span> <a name="l00106"></a>00106 <span class="comment">// equal to the dimension of the histogram.</span> <a name="l00107"></a>00107 <span class="keywordflow">if</span>( list->GetMeasurementVectorSize() != MeasurementVectorSize ) <a name="l00108"></a>00108 { <a name="l00109"></a>00109 <a class="code" href="itkMacro_8h.html#c51de1a715471e7fd0f2e481a70fa1f8">itkExceptionMacro</a>(<< <span class="stringliteral">"Length of measurement vectors in the list sample is "</span> <a name="l00110"></a>00110 << list->GetMeasurementVectorSize() << <span class="stringliteral">" but histogram dimension is "</span> <a name="l00111"></a>00111 << MeasurementVectorSize); <a name="l00112"></a>00112 } <a name="l00113"></a>00113 m_List = list ; <a name="l00114"></a>00114 } <a name="l00116"></a>00116 <a name="l00117"></a><a class="code" href="classitk_1_1Statistics_1_1ListSampleToHistogramGenerator.html#fa1365a07ffc3d9ddc9b13bb740553f2">00117</a> <span class="keywordtype">void</span> SetMarginalScale(<span class="keywordtype">float</span> scale) <a name="l00118"></a>00118 { m_MarginalScale = scale ; } <a name="l00119"></a>00119 <a name="l00120"></a><a class="code" href="classitk_1_1Statistics_1_1ListSampleToHistogramGenerator.html#20f9c7794a1b4ba07f10232f639d9939">00120</a> <span class="keywordtype">void</span> SetNumberOfBins(<a class="code" href="classitk_1_1Size.html">HistogramSizeType</a> sizes) <a name="l00121"></a>00121 { m_Sizes = sizes ; } <a name="l00122"></a>00122 <a name="l00123"></a><a class="code" href="classitk_1_1Statistics_1_1ListSampleToHistogramGenerator.html#6c09ee97195d71d5c320b7053cbb3df2">00123</a> <span class="keyword">const</span> <a class="code" href="classitk_1_1Statistics_1_1Histogram.html" title="This class stores measurement vectors in the context of n-dimensional histogram.">HistogramType</a>* GetOutput()<span class="keyword"> const</span> <a name="l00124"></a>00124 <span class="keyword"> </span>{ <span class="keywordflow">return</span> m_Histogram ; } <a name="l00125"></a>00125 <a name="l00126"></a><a class="code" href="classitk_1_1Statistics_1_1ListSampleToHistogramGenerator.html#b0305560d08e8d230e7e0fae089761e1">00126</a> <span class="keywordtype">void</span> Update() <a name="l00127"></a>00127 { this-><a class="code" href="namespaceHardConnectedComponentImageFilter.html#f75a5945cdd8315676941024a0b8c1e9">GenerateData</a>() ; } <a name="l00128"></a>00128 <a name="l00129"></a>00129 <a class="code" href="itkMacro_8h.html#7ebdd33cc5e7d74720ced9099c034faa">itkSetMacro</a>(AutoMinMax,<span class="keywordtype">bool</span>); <a name="l00130"></a>00130 <a class="code" href="itkMacro_8h.html#7d989c13a1a213168db99ae0f84185d4">itkGetConstReferenceMacro</a>(AutoMinMax,<span class="keywordtype">bool</span>); <a name="l00131"></a>00131 <a name="l00132"></a><a class="code" href="classitk_1_1Statistics_1_1ListSampleToHistogramGenerator.html#81b84052bcd1297ff9f67143402f5820">00132</a> <span class="keywordtype">void</span> SetHistogramMin(<span class="keyword">const</span> MeasurementVectorType & histogramMin) <a name="l00133"></a>00133 { <a name="l00134"></a>00134 m_HistogramMin = histogramMin; <a name="l00135"></a>00135 m_AutoMinMax = <span class="keyword">false</span>; <a name="l00136"></a>00136 <a name="l00137"></a>00137 <span class="comment">// Sanity check.. Check to see that container m_HistogramMin has the same</span> <a name="l00138"></a>00138 <span class="comment">// length as the length of measurement vectors in the list sample. And the</span> <a name="l00139"></a>00139 <span class="comment">// same length as the container over which the list sample is instantiated,</span> <a name="l00140"></a>00140 <span class="comment">// if fixed.</span> <a name="l00141"></a>00141 <a class="code" href="classitk_1_1MeasurementVectorTraits.html#1f802b66e64e80af8b16b310a966ff65">MeasurementVectorTraits::Assert</a>(m_HistogramMin, MeasurementVectorSize, <a name="l00142"></a>00142 <span class="stringliteral">"Length Mismatch: ListSampleToHistogramGenerator::SetHistogramMin"</span>); <a name="l00143"></a>00143 <span class="keywordflow">if</span>( m_List ) <a name="l00144"></a>00144 { <a name="l00145"></a>00145 <span class="keywordflow">if</span>( m_List->GetMeasurementVectorSize() != MeasurementVectorSize ) <a name="l00146"></a>00146 { <a name="l00147"></a>00147 <a class="code" href="itkMacro_8h.html#c51de1a715471e7fd0f2e481a70fa1f8">itkExceptionMacro</a>( << <span class="stringliteral">"Length Mismatch: ListSampleToHistogramGenerator::SetHistogramMin"</span> ); <a name="l00148"></a>00148 } <a name="l00149"></a>00149 } <a name="l00150"></a>00150 } <a name="l00151"></a>00151 <a name="l00152"></a><a class="code" href="classitk_1_1Statistics_1_1ListSampleToHistogramGenerator.html#c08533f09ce1c5bb2adf2a776b18fc12">00152</a> <span class="keywordtype">void</span> SetHistogramMax(<span class="keyword">const</span> MeasurementVectorType & histogramMax) <a name="l00153"></a>00153 { <a name="l00154"></a>00154 m_HistogramMax = histogramMax; <a name="l00155"></a>00155 m_AutoMinMax = <span class="keyword">false</span>; <a name="l00156"></a>00156 <a name="l00157"></a>00157 <span class="comment">// Sanity check.. Check to see that container m_HistogramMax has the same</span> <a name="l00158"></a>00158 <span class="comment">// length as the length of measurement vectors in the list sample. And the</span> <a name="l00159"></a>00159 <span class="comment">// same length as the container over which the list sample is instantiated,</span> <a name="l00160"></a>00160 <span class="comment">// if fixed.</span> <a name="l00161"></a>00161 <a class="code" href="classitk_1_1MeasurementVectorTraits.html#1f802b66e64e80af8b16b310a966ff65">MeasurementVectorTraits::Assert</a>(m_HistogramMax, MeasurementVectorSize, <a name="l00162"></a>00162 <span class="stringliteral">"Length Mismatch: ListSampleToHistogramGenerator::SetHistogramMin"</span>); <a name="l00163"></a>00163 <span class="keywordflow">if</span>( m_List ) <a name="l00164"></a>00164 { <a name="l00165"></a>00165 <span class="keywordflow">if</span>( m_List->GetMeasurementVectorSize() != MeasurementVectorSize ) <a name="l00166"></a>00166 { <a name="l00167"></a>00167 <a class="code" href="itkMacro_8h.html#c51de1a715471e7fd0f2e481a70fa1f8">itkExceptionMacro</a>( << <span class="stringliteral">"Length Mismatch: ListSampleToHistogramGenerator::SetHistogramMin"</span> ); <a name="l00168"></a>00168 } <a name="l00169"></a>00169 } <a name="l00170"></a>00170 } <a name="l00171"></a>00171 <a name="l00172"></a>00172 <a name="l00173"></a>00173 <span class="keyword">protected</span>: <a name="l00174"></a>00174 <a class="code" href="classitk_1_1Statistics_1_1ListSampleToHistogramGenerator.html" title="Generates a Histogram using the data from the ListSample object.">ListSampleToHistogramGenerator</a>() ; <a name="l00175"></a><a class="code" href="classitk_1_1Statistics_1_1ListSampleToHistogramGenerator.html#5de8590454a9af1efc64a4c3f7468345">00175</a> <span class="keyword">virtual</span> <a class="code" href="classitk_1_1Statistics_1_1ListSampleToHistogramGenerator.html#5de8590454a9af1efc64a4c3f7468345">~ListSampleToHistogramGenerator</a>() {} <a name="l00176"></a>00176 <span class="keywordtype">void</span> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#f75a5945cdd8315676941024a0b8c1e9">GenerateData</a>() ; <a name="l00177"></a>00177 <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="l00178"></a>00178 <a name="l00179"></a>00179 <span class="keyword">private</span>: <a name="l00180"></a>00180 <span class="keyword">const</span> TListSample* m_List ; <a name="l00181"></a>00181 <span class="keyword">typename</span> <a class="code" href="itkFEMMacro_8h.html#539cce1a3282ba59952dedcbf9cdb23f">HistogramType::Pointer</a> m_Histogram ; <a name="l00182"></a>00182 HistogramSizeType m_Sizes ; <a name="l00183"></a>00183 <span class="keywordtype">float</span> m_MarginalScale ; <a name="l00184"></a>00184 MeasurementVectorType m_HistogramMin; <a name="l00185"></a>00185 MeasurementVectorType m_HistogramMax; <a name="l00186"></a>00186 <span class="keywordtype">bool</span> m_AutoMinMax; <a name="l00187"></a>00187 <a name="l00188"></a>00188 } ; <span class="comment">// end of class</span> <a name="l00189"></a>00189 <a name="l00190"></a>00190 } <span class="comment">// end of namespace Statistics </span> <a name="l00191"></a>00191 } <span class="comment">// end of namespace itk </span> <a name="l00192"></a>00192 <a name="l00193"></a>00193 <span class="preprocessor">#ifndef ITK_MANUAL_INSTANTIATION</span> <a name="l00194"></a>00194 <span class="preprocessor"></span><span class="preprocessor">#include "itkListSampleToHistogramGenerator.txx"</span> <a name="l00195"></a>00195 <span class="preprocessor">#endif</span> <a name="l00196"></a>00196 <span class="preprocessor"></span> <a name="l00197"></a>00197 <span class="preprocessor">#endif</span> <a name="l00198"></a>00198 <span class="preprocessor"></span> </pre></div></div> <hr><address><small> Generated at Thu May 7 23:26:52 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>