<!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: itkLabelStatisticsImageFilter.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_00ffda33c24cbbf617b202f4f3bcb7e8.html">BasicFilters</a> </div> <div class="contents"> <h1>itkLabelStatisticsImageFilter.h</h1><a href="itkLabelStatisticsImageFilter_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: itkLabelStatisticsImageFilter.h,v $</span> <a name="l00005"></a>00005 <span class="comment"> Language: C++</span> <a name="l00006"></a>00006 <span class="comment"> Date: $Date: 2008-10-16 17:40:08 $</span> <a name="l00007"></a>00007 <span class="comment"> Version: $Revision: 1.10 $</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 __itkLabelStatisticsImageFilter_h</span> <a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#define __itkLabelStatisticsImageFilter_h</span> <a name="l00019"></a>00019 <span class="preprocessor"></span> <a name="l00020"></a>00020 <span class="preprocessor">#include "<a class="code" href="itkImageToImageFilter_8h.html">itkImageToImageFilter.h</a>"</span> <a name="l00021"></a>00021 <span class="preprocessor">#include "itkNumericTraits.h"</span> <a name="l00022"></a>00022 <span class="preprocessor">#include "<a class="code" href="itkArray_8h.html">itkArray.h</a>"</span> <a name="l00023"></a>00023 <span class="preprocessor">#include "<a class="code" href="itkSimpleDataObjectDecorator_8h.html">itkSimpleDataObjectDecorator.h</a>"</span> <a name="l00024"></a>00024 <span class="preprocessor">#include "<a class="code" href="itk__hash__map_8h.html">itk_hash_map.h</a>"</span> <a name="l00025"></a>00025 <span class="preprocessor">#include "<a class="code" href="itkHistogram_8h.html">itkHistogram.h</a>"</span> <a name="l00026"></a>00026 <span class="preprocessor">#include "<a class="code" href="itkFastMutexLock_8h.html">itkFastMutexLock.h</a>"</span> <a name="l00027"></a>00027 <span class="preprocessor">#include <vector></span> <a name="l00028"></a>00028 <a name="l00029"></a>00029 <span class="keyword">namespace </span>itk { <a name="l00030"></a>00030 <a name="l00054"></a>00054 <span class="keyword">template</span><<span class="keyword">class</span> TInputImage, <span class="keyword">class</span> TLabelImage> <a name="l00055"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter.html">00055</a> <span class="keyword">class </span><a class="code" href="itkWin32Header_8h.html#7d4384322557205d75f0719c012dded6">ITK_EXPORT</a> <a class="code" href="classitk_1_1LabelStatisticsImageFilter.html" title="Given an intensity image and a label map, compute min, max, variance and mean of...">LabelStatisticsImageFilter</a> : <a name="l00056"></a>00056 <span class="keyword">public</span> <a class="code" href="classitk_1_1ImageToImageFilter.html" title="Base class for filters that take an image as input and produce an image as output...">ImageToImageFilter</a><TInputImage, TInputImage> <a name="l00057"></a>00057 { <a name="l00058"></a>00058 <span class="keyword">public</span>: <a name="l00060"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter.html#8e65245913a9af6b0813e4dc23950411">00060</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1LabelStatisticsImageFilter.html" title="Given an intensity image and a label map, compute min, max, variance and mean of...">LabelStatisticsImageFilter</a> <a class="code" href="classitk_1_1LabelStatisticsImageFilter.html" title="Given an intensity image and a label map, compute min, max, variance and mean of...">Self</a>; <a name="l00061"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter.html#832ab882cc7fadbe50cafaaab0ec1502">00061</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1ImageToImageFilter.html">ImageToImageFilter<TInputImage,TInputImage></a> <a class="code" href="classitk_1_1ImageToImageFilter.html">Superclass</a>; <a name="l00062"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter.html#ba2614f883ce9c2183b738eced480d1d">00062</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="l00063"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter.html#c435acae75d3ea0589c778b09ac115c0">00063</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="l00064"></a>00064 <a name="l00066"></a>00066 <a class="code" href="itkMacro_8h.html#0fdc15685afa271857c57e7cd482f30c">itkNewMacro</a>(<a class="code" href="classitk_1_1LabelStatisticsImageFilter.html" title="Given an intensity image and a label map, compute min, max, variance and mean of...">Self</a>); <a name="l00067"></a>00067 <a name="l00069"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter.html#281a4740727808d96f91622d3929f016">00069</a> <a class="code" href="itkMacro_8h.html#574c1f86661d409dd32c742307a0e96a">itkTypeMacro</a>(<a class="code" href="classitk_1_1LabelStatisticsImageFilter.html" title="Given an intensity image and a label map, compute min, max, variance and mean of...">LabelStatisticsImageFilter</a>, <a class="code" href="classitk_1_1ImageToImageFilter.html" title="Base class for filters that take an image as input and produce an image as output...">ImageToImageFilter</a>); <a name="l00070"></a>00070 <a name="l00072"></a>00072 <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="itkFEMMacro_8h.html#539cce1a3282ba59952dedcbf9cdb23f">TInputImage::Pointer</a> InputImagePointer; <a name="l00073"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter.html#1ddc6ccd3579cf1609635571c276e5c8">00073</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#ed8c4a40607d317c666eb96ea265e126">TInputImage::RegionType</a> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#ed8c4a40607d317c666eb96ea265e126">RegionType</a>; <a name="l00074"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter.html#30c69ff0b83fc35bf1983176a29cf035">00074</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#5bf82236e1e50e653de84c8ead448599">TInputImage::SizeType</a> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#5bf82236e1e50e653de84c8ead448599">SizeType</a>; <a name="l00075"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter.html#1da391dcb172122890c75161b8b8b8bb">00075</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#be32dc19e71d40322ad9828b9ab40853">TInputImage::IndexType</a> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#be32dc19e71d40322ad9828b9ab40853">IndexType</a>; <a name="l00076"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter.html#350072247595bd5d2d213b580e430ca5">00076</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> TInputImage::PixelType PixelType; <a name="l00077"></a>00077 <a name="l00079"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter.html#d6e523921ebc348a7b8e7d1af6348f85">00079</a> <span class="keyword">typedef</span> TLabelImage LabelImageType; <a name="l00080"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter.html#4e6af8e07c27eadf046f2fe0b57077b3">00080</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="itkFEMMacro_8h.html#539cce1a3282ba59952dedcbf9cdb23f">TLabelImage::Pointer</a> LabelImagePointer; <a name="l00081"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter.html#8e0f65ec6bfd80f3c6c4b301d78b4b9d">00081</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#ed8c4a40607d317c666eb96ea265e126">TLabelImage::RegionType</a> LabelRegionType; <a name="l00082"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter.html#383966c53d6c628912259035c1ce02ac">00082</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#5bf82236e1e50e653de84c8ead448599">TLabelImage::SizeType</a> LabelSizeType; <a name="l00083"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter.html#267dd60ddbb3add8fe323c1fa5f5035a">00083</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#be32dc19e71d40322ad9828b9ab40853">TLabelImage::IndexType</a> LabelIndexType; <a name="l00084"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter.html#8c4a98dea562d1ead57864982a5ef591">00084</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> TLabelImage::PixelType LabelPixelType; <a name="l00085"></a>00085 <a name="l00087"></a>00087 <a class="code" href="itkMacro_8h.html#1905cf6b2e88235996fa7ff73b2fb0eb">itkStaticConstMacro</a>(ImageDimension, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>, <a name="l00088"></a>00088 TInputImage::ImageDimension ); <a name="l00089"></a>00089 <a name="l00091"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter.html#d246b75bd5a31863906f02a228396f74">00091</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> NumericTraits<PixelType>::RealType RealType; <a name="l00092"></a>00092 <a name="l00094"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter.html#d8a6b5ee3f5f3328ab1229dba1c3ab6d">00094</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="classitk_1_1SmartPointer.html">DataObject::Pointer</a> <a class="code" href="classitk_1_1SmartPointer.html">DataObjectPointer</a>; <a name="l00095"></a>00095 <a name="l00097"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter.html#0f6a8cc8d75738fa78197838ef9c0e6d">00097</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1SimpleDataObjectDecorator.html" title="Decorates any &quot;simple&quot; data type (data types without smart pointers) with...">SimpleDataObjectDecorator<RealType></a> <a class="code" href="classitk_1_1SimpleDataObjectDecorator.html" title="Decorates any &quot;simple&quot; data type (data types without smart pointers) with...">RealObjectType</a>; <a name="l00098"></a>00098 <a name="l00100"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter.html#c313746de32ceab1b9e2fa7a4e7c7589">00100</a> <span class="keyword">typedef</span> std::vector<typename IndexType::IndexValueType> BoundingBoxType; <a name="l00101"></a>00101 <a name="l00103"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter.html#d809bee619a07dc7ab340b463ee63da4">00103</a> <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.">itk::Statistics::Histogram<RealType,1></a> <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="l00104"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter.html#8c34055e75569c539e46f8549d230483">00104</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="classitk_1_1SmartPointer.html">HistogramType::Pointer</a> <a class="code" href="classitk_1_1SmartPointer.html">HistogramPointer</a>; <a name="l00105"></a>00105 <a name="l00108"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html">00108</a> <span class="keyword">class </span><a class="code" href="classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html" title="Statistics stored per label.">LabelStatistics</a> <a name="l00109"></a>00109 { <a name="l00110"></a>00110 <span class="keyword">public</span>: <a name="l00111"></a>00111 <a name="l00112"></a>00112 <span class="comment">// default constructor</span> <a name="l00113"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html#edc8e8c28b8b256fdee2abd0744c13de">00113</a> <a class="code" href="classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html" title="Statistics stored per label.">LabelStatistics</a>() <a name="l00114"></a>00114 { <a name="l00115"></a>00115 <span class="comment">// initialized to the default values</span> <a name="l00116"></a>00116 m_Count = 0; <a name="l00117"></a>00117 m_Sum = NumericTraits<RealType>::Zero; <a name="l00118"></a>00118 m_SumOfSquares = NumericTraits<RealType>::Zero; <a name="l00119"></a>00119 <a name="l00120"></a>00120 <span class="comment">// Set such that the first pixel encountered can be compared</span> <a name="l00121"></a>00121 m_Minimum = NumericTraits<RealType>::max(); <a name="l00122"></a>00122 m_Maximum = NumericTraits<RealType>::NonpositiveMin(); <a name="l00123"></a>00123 <a name="l00124"></a>00124 <span class="comment">// Default these to zero</span> <a name="l00125"></a>00125 m_Mean = NumericTraits<RealType>::Zero; <a name="l00126"></a>00126 m_Sigma = NumericTraits<RealType>::Zero; <a name="l00127"></a>00127 m_Variance = NumericTraits<RealType>::Zero; <a name="l00128"></a>00128 <a name="l00129"></a>00129 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> imageDimension = <a class="code" href="itkMacro_8h.html#94ef2dc11d52c8ef0a78e34558feb8cb">itkGetStaticConstMacro</a>(ImageDimension); <a name="l00130"></a>00130 m_BoundingBox.resize(imageDimension*2); <a name="l00131"></a>00131 <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0; i < imageDimension * 2; i += 2) <a name="l00132"></a>00132 { <a name="l00133"></a>00133 m_BoundingBox[i] = NumericTraits<ITK_TYPENAME IndexType::IndexValueType>::max(); <a name="l00134"></a>00134 m_BoundingBox[i+1] = NumericTraits<ITK_TYPENAME IndexType::IndexValueType>::NonpositiveMin(); <a name="l00135"></a>00135 } <a name="l00136"></a>00136 m_Histogram = 0; <a name="l00137"></a>00137 <a name="l00138"></a>00138 } <a name="l00139"></a>00139 <a name="l00140"></a>00140 <span class="comment">// constructor with histogram enabled</span> <a name="l00141"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html#8b70520e7bcf5729b283d1b2a43af528">00141</a> <a class="code" href="classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html" title="Statistics stored per label.">LabelStatistics</a>(<span class="keywordtype">int</span> size, RealType lowerBound, RealType upperBound) <a name="l00142"></a>00142 { <a name="l00143"></a>00143 <a name="l00144"></a>00144 <span class="comment">// initialized to the default values</span> <a name="l00145"></a>00145 m_Count = 0; <a name="l00146"></a>00146 m_Sum = NumericTraits<RealType>::Zero; <a name="l00147"></a>00147 m_SumOfSquares = NumericTraits<RealType>::Zero; <a name="l00148"></a>00148 <a name="l00149"></a>00149 <span class="comment">// Set such that the first pixel encountered can be compared</span> <a name="l00150"></a>00150 m_Minimum = NumericTraits<RealType>::max(); <a name="l00151"></a>00151 m_Maximum = NumericTraits<RealType>::NonpositiveMin(); <a name="l00152"></a>00152 <a name="l00153"></a>00153 <span class="comment">// Default these to zero</span> <a name="l00154"></a>00154 m_Mean = NumericTraits<RealType>::Zero; <a name="l00155"></a>00155 m_Sigma = NumericTraits<RealType>::Zero; <a name="l00156"></a>00156 m_Variance = NumericTraits<RealType>::Zero; <a name="l00157"></a>00157 <a name="l00158"></a>00158 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> imageDimension = <a class="code" href="itkMacro_8h.html#94ef2dc11d52c8ef0a78e34558feb8cb">itkGetStaticConstMacro</a>(ImageDimension); <a name="l00159"></a>00159 m_BoundingBox.resize(imageDimension*2); <a name="l00160"></a>00160 <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0; i < imageDimension * 2; i += 2) <a name="l00161"></a>00161 { <a name="l00162"></a>00162 m_BoundingBox[i] = NumericTraits<ITK_TYPENAME IndexType::IndexValueType>::max(); <a name="l00163"></a>00163 m_BoundingBox[i+1] = NumericTraits<ITK_TYPENAME IndexType::IndexValueType>::NonpositiveMin(); <a name="l00164"></a>00164 } <a name="l00165"></a>00165 <a name="l00166"></a>00166 <span class="comment">// Histogram</span> <a name="l00167"></a>00167 m_Histogram = <a class="code" href="namespaceHardConnectedComponentImageFilter.html#870262f145e0b45206db74df8053b59c">HistogramType::New</a>(); <a name="l00168"></a>00168 <span class="keyword">typename</span> <a class="code" href="classitk_1_1Size.html">HistogramType::SizeType</a> hsize; <a name="l00169"></a>00169 hsize[0] = size; <a name="l00170"></a>00170 <span class="keyword">typename</span> HistogramType::MeasurementVectorType lb; <a name="l00171"></a>00171 lb[0] = lowerBound; <a name="l00172"></a>00172 <span class="keyword">typename</span> HistogramType::MeasurementVectorType ub; <a name="l00173"></a>00173 ub[0] = upperBound; <a name="l00174"></a>00174 m_Histogram->Initialize(hsize, lb, ub); <a name="l00175"></a>00175 } <a name="l00176"></a>00176 <a name="l00177"></a>00177 <span class="comment">// need copy constructor because of smart pointer to histogram</span> <a name="l00178"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html#5b4bc930d269066c75da7ec230ad7d37">00178</a> <a class="code" href="classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html" title="Statistics stored per label.">LabelStatistics</a>(<span class="keyword">const</span> <a class="code" href="classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html" title="Statistics stored per label.">LabelStatistics</a>& l) <a name="l00179"></a>00179 { <a name="l00180"></a>00180 m_Count = l.<a class="code" href="classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html#1a66bf70fdd65a740279af1aafa211b4">m_Count</a>; <a name="l00181"></a>00181 m_Minimum = l.<a class="code" href="classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html#05dff6e33a31c3d144735143929853ca">m_Minimum</a>; <a name="l00182"></a>00182 m_Maximum = l.<a class="code" href="classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html#df7885b3b83e74fafe37cd2d3e92bce0">m_Maximum</a>; <a name="l00183"></a>00183 m_Mean = l.<a class="code" href="classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html#0aa117a4122832b57b58ec7f985a4b11">m_Mean</a>; <a name="l00184"></a>00184 m_Sum = l.<a class="code" href="classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html#0d046f738f531eb794cbe4419a1e3430">m_Sum</a>; <a name="l00185"></a>00185 m_SumOfSquares = l.<a class="code" href="classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html#a9df51d20cdf8e038ea2d87d0ab42f6e">m_SumOfSquares</a>; <a name="l00186"></a>00186 m_Sigma = l.<a class="code" href="classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html#564fe6612668a11653334e5f7238ead7">m_Sigma</a>; <a name="l00187"></a>00187 m_Variance = l.<a class="code" href="classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html#6e7e9c84a8e5a23665f88a5287316b07">m_Variance</a>; <a name="l00188"></a>00188 m_BoundingBox = l.<a class="code" href="classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html#b9289514f361fc8c7dffc129137f0214">m_BoundingBox</a>; <a name="l00189"></a>00189 m_Histogram = l.<a class="code" href="classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html#12b28194a69e48464cf209ed44d6619d">m_Histogram</a>; <a name="l00190"></a>00190 } <a name="l00191"></a>00191 <a name="l00192"></a>00192 <span class="comment">// added for completeness</span> <a name="l00193"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html#4a11f1d9d502f60f3ebbd5e314690d8c">00193</a> <a class="code" href="classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html" title="Statistics stored per label.">LabelStatistics</a>& operator= (<span class="keyword">const</span> <a class="code" href="classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html" title="Statistics stored per label.">LabelStatistics</a>& l) <a name="l00194"></a>00194 { <a name="l00195"></a>00195 m_Count = l.<a class="code" href="classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html#1a66bf70fdd65a740279af1aafa211b4">m_Count</a>; <a name="l00196"></a>00196 m_Minimum = l.<a class="code" href="classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html#05dff6e33a31c3d144735143929853ca">m_Minimum</a>; <a name="l00197"></a>00197 m_Maximum = l.<a class="code" href="classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html#df7885b3b83e74fafe37cd2d3e92bce0">m_Maximum</a>; <a name="l00198"></a>00198 m_Mean = l.<a class="code" href="classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html#0aa117a4122832b57b58ec7f985a4b11">m_Mean</a>; <a name="l00199"></a>00199 m_Sum = l.<a class="code" href="classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html#0d046f738f531eb794cbe4419a1e3430">m_Sum</a>; <a name="l00200"></a>00200 m_SumOfSquares = l.<a class="code" href="classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html#a9df51d20cdf8e038ea2d87d0ab42f6e">m_SumOfSquares</a>; <a name="l00201"></a>00201 m_Sigma = l.<a class="code" href="classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html#564fe6612668a11653334e5f7238ead7">m_Sigma</a>; <a name="l00202"></a>00202 m_Variance = l.<a class="code" href="classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html#6e7e9c84a8e5a23665f88a5287316b07">m_Variance</a>; <a name="l00203"></a>00203 m_BoundingBox = l.<a class="code" href="classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html#b9289514f361fc8c7dffc129137f0214">m_BoundingBox</a>; <a name="l00204"></a>00204 m_Histogram = l.<a class="code" href="classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html#12b28194a69e48464cf209ed44d6619d">m_Histogram</a>; <a name="l00205"></a>00205 } <a name="l00206"></a>00206 <a name="l00207"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html#1a66bf70fdd65a740279af1aafa211b4">00207</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> m_Count; <a name="l00208"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html#05dff6e33a31c3d144735143929853ca">00208</a> RealType m_Minimum; <a name="l00209"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html#df7885b3b83e74fafe37cd2d3e92bce0">00209</a> RealType m_Maximum; <a name="l00210"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html#0aa117a4122832b57b58ec7f985a4b11">00210</a> RealType m_Mean; <a name="l00211"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html#0d046f738f531eb794cbe4419a1e3430">00211</a> RealType m_Sum; <a name="l00212"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html#a9df51d20cdf8e038ea2d87d0ab42f6e">00212</a> RealType m_SumOfSquares; <a name="l00213"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html#564fe6612668a11653334e5f7238ead7">00213</a> RealType m_Sigma; <a name="l00214"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html#6e7e9c84a8e5a23665f88a5287316b07">00214</a> RealType m_Variance; <a name="l00215"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html#b9289514f361fc8c7dffc129137f0214">00215</a> BoundingBoxType m_BoundingBox; <a name="l00216"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter_1_1LabelStatistics.html#12b28194a69e48464cf209ed44d6619d">00216</a> <span class="keyword">typename</span> <a class="code" href="classitk_1_1SmartPointer.html">HistogramType::Pointer</a> m_Histogram; <a name="l00217"></a>00217 }; <a name="l00218"></a>00218 <a name="l00220"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter.html#0a3597f06a2c914662f008abca0929af">00220</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1hash__map.html">itk::hash_map<LabelPixelType, LabelStatistics></a> <a class="code" href="classitk_1_1hash__map.html">MapType</a>; <a name="l00221"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter.html#4c977712a39f6424179219230a98be36">00221</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="classitk_1_1hash__map.html" title="Replacement for STL hash map because some systems do not support it, or support it...">itk::hash_map<LabelPixelType, LabelStatistics>::iterator</a> MapIterator; <a name="l00222"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter.html#9024aa7c59ce25b80fcf832813fa37be">00222</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="classitk_1_1hash__map.html" title="Replacement for STL hash map because some systems do not support it, or support it...">itk::hash_map<LabelPixelType, LabelStatistics>::const_iterator</a> MapConstIterator; <a name="l00223"></a>00223 <a name="l00224"></a>00224 <span class="comment">// macros for Histogram enables</span> <a name="l00225"></a>00225 <a class="code" href="itkMacro_8h.html#7ebdd33cc5e7d74720ced9099c034faa">itkSetMacro</a>(UseHistograms, <span class="keywordtype">bool</span>); <a name="l00226"></a>00226 <a class="code" href="itkMacro_8h.html#1600305bb01e39e87c472d8bf29bd1cf">itkGetMacro</a>(UseHistograms, <span class="keywordtype">bool</span>); <a name="l00227"></a>00227 <a class="code" href="itkMacro_8h.html#9e7d129ffebb09fd28bc213e02d87248">itkBooleanMacro</a>(UseHistograms); <a name="l00228"></a>00228 <a name="l00230"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter.html#80ac38fc5bcd7be147973eed5e205f3c">00230</a> <span class="keywordtype">void</span> SetLabelInput(TLabelImage *input) <a name="l00231"></a>00231 { <a name="l00232"></a>00232 <span class="comment">// Process object is not const-correct so the const casting is required.</span> <a name="l00233"></a>00233 this->SetNthInput(1, const_cast<TLabelImage *>(input) ); <a name="l00234"></a>00234 } <a name="l00235"></a>00235 <a name="l00237"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter.html#4144c0cabd1f530ba3b507ab10815c1b">00237</a> LabelImageType * GetLabelInput() <a name="l00238"></a>00238 { <a name="l00239"></a>00239 <span class="keywordflow">return</span> <span class="keyword">static_cast<</span>LabelImageType*<span class="keyword">></span>(<span class="keyword">const_cast<</span><a class="code" href="classitk_1_1DataObject.html" title="Base class for all data objects in ITK.">DataObject</a> *<span class="keyword">></span>(this-><a class="code" href="classitk_1_1ProcessObject.html#1cb9c8ea89b6357d9d851f4179f933dd">ProcessObject::GetInput</a>(1))); <a name="l00240"></a>00240 } <a name="l00241"></a>00241 <a name="l00244"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter.html#4f05fd1c0a9749776ed7189f4c19980e">00244</a> <span class="keywordtype">bool</span> HasLabel(LabelPixelType label)<span class="keyword"> const</span> <a name="l00245"></a>00245 <span class="keyword"> </span>{ <a name="l00246"></a>00246 <span class="keywordflow">return</span> m_LabelStatistics.find(label) != m_LabelStatistics.end(); <a name="l00247"></a>00247 } <a name="l00248"></a>00248 <a name="l00250"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter.html#5df4ef6e88bbb7f27980f2fe9fe82ab2">00250</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> GetNumberOfObjects()<span class="keyword"> const</span> <a name="l00251"></a>00251 <span class="keyword"> </span>{ <a name="l00252"></a>00252 <span class="keywordflow">return</span> m_LabelStatistics.size(); <a name="l00253"></a>00253 } <a name="l00254"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter.html#b021817d451583f1d5d55d3ce60794fa">00254</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> GetNumberOfLabels()<span class="keyword"> const</span> <a name="l00255"></a>00255 <span class="keyword"> </span>{ <a name="l00256"></a>00256 <span class="keywordflow">return</span> this->GetNumberOfObjects(); <a name="l00257"></a>00257 } <a name="l00259"></a>00259 <a name="l00260"></a>00260 <a name="l00262"></a>00262 RealType GetMinimum(LabelPixelType label) <span class="keyword">const</span>; <a name="l00263"></a>00263 <a name="l00265"></a>00265 RealType GetMaximum(LabelPixelType label) <span class="keyword">const</span>; <a name="l00266"></a>00266 <a name="l00268"></a>00268 RealType GetMean(LabelPixelType label) <span class="keyword">const</span>; <a name="l00269"></a>00269 <a name="l00271"></a>00271 RealType GetMedian(LabelPixelType label) <span class="keyword">const</span>; <a name="l00272"></a>00272 <a name="l00274"></a>00274 RealType GetSigma(LabelPixelType label) <span class="keyword">const</span>; <a name="l00275"></a>00275 <a name="l00277"></a>00277 RealType GetVariance(LabelPixelType label) <span class="keyword">const</span>; <a name="l00278"></a>00278 <a name="l00280"></a>00280 BoundingBoxType GetBoundingBox(LabelPixelType label) <span class="keyword">const</span>; <a name="l00281"></a>00281 <a name="l00283"></a>00283 <a class="code" href="namespaceHardConnectedComponentImageFilter.html#ed8c4a40607d317c666eb96ea265e126">RegionType</a> GetRegion(LabelPixelType label) <span class="keyword">const</span>; <a name="l00284"></a>00284 <a name="l00286"></a>00286 RealType GetSum(LabelPixelType label) <span class="keyword">const</span>; <a name="l00287"></a>00287 <a name="l00289"></a>00289 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> GetCount(LabelPixelType label) <span class="keyword">const</span>; <a name="l00290"></a>00290 <a name="l00292"></a>00292 HistogramPointer GetHistogram(LabelPixelType label) <span class="keyword">const</span>; <a name="l00293"></a>00293 <a name="l00295"></a>00295 <span class="keywordtype">void</span> SetHistogramParameters(<span class="keyword">const</span> <span class="keywordtype">int</span> numBins, RealType lowerBound, <a name="l00296"></a>00296 RealType upperBound); <a name="l00297"></a>00297 <a name="l00298"></a>00298 <span class="preprocessor">#ifdef ITK_USE_CONCEPT_CHECKING</span> <a name="l00299"></a>00299 <span class="preprocessor"></span> <a name="l00300"></a>00300 <a class="code" href="itkConceptChecking_8h.html#009eae6c305d9c390972159815e6a710">itkConceptMacro</a>(InputHasNumericTraitsCheck, <a name="l00301"></a>00301 (<a class="code" href="structitk_1_1Concept_1_1HasNumericTraits.html">Concept::HasNumericTraits<PixelType></a>)); <a name="l00302"></a>00302 <a name="l00304"></a>00304 <span class="preprocessor">#endif</span> <a name="l00305"></a>00305 <span class="preprocessor"></span> <a name="l00306"></a>00306 <span class="keyword">protected</span>: <a name="l00307"></a>00307 <a class="code" href="classitk_1_1LabelStatisticsImageFilter.html" title="Given an intensity image and a label map, compute min, max, variance and mean of...">LabelStatisticsImageFilter</a>(); <a name="l00308"></a><a class="code" href="classitk_1_1LabelStatisticsImageFilter.html#e7b08490cf276ebbf8789339ef00bc38">00308</a> <a class="code" href="classitk_1_1LabelStatisticsImageFilter.html#e7b08490cf276ebbf8789339ef00bc38">~LabelStatisticsImageFilter</a>(){}; <a name="l00309"></a>00309 <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="l00310"></a>00310 <a name="l00312"></a>00312 <span class="keywordtype">void</span> AllocateOutputs(); <a name="l00313"></a>00313 <a name="l00315"></a>00315 <span class="keywordtype">void</span> BeforeThreadedGenerateData (); <a name="l00316"></a>00316 <a name="l00318"></a>00318 <span class="keywordtype">void</span> AfterThreadedGenerateData (); <a name="l00319"></a>00319 <a name="l00321"></a>00321 <span class="keywordtype">void</span> ThreadedGenerateData (<span class="keyword">const</span> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#ed8c4a40607d317c666eb96ea265e126">RegionType</a>& <a name="l00322"></a>00322 outputRegionForThread, <a name="l00323"></a>00323 <span class="keywordtype">int</span> threadId); <a name="l00324"></a>00324 <a name="l00325"></a>00325 <span class="comment">// Override since the filter needs all the data for the algorithm</span> <a name="l00326"></a>00326 <span class="keywordtype">void</span> GenerateInputRequestedRegion(); <a name="l00327"></a>00327 <a name="l00328"></a>00328 <span class="comment">// Override since the filter produces all of its output</span> <a name="l00329"></a>00329 <span class="keywordtype">void</span> EnlargeOutputRequestedRegion(<a class="code" href="classitk_1_1DataObject.html" title="Base class for all data objects in ITK.">DataObject</a> *data); <a name="l00330"></a>00330 <a name="l00331"></a>00331 <a name="l00332"></a>00332 <span class="keyword">private</span>: <a name="l00333"></a>00333 <a class="code" href="classitk_1_1LabelStatisticsImageFilter.html" title="Given an intensity image and a label map, compute min, max, variance and mean of...">LabelStatisticsImageFilter</a>(<span class="keyword">const</span> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#ac7d0120fe5292cdcdddb6163b8cb150">Self</a>&); <span class="comment">//purposely not implemented</span> <a name="l00334"></a>00334 <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="l00335"></a>00335 <a name="l00336"></a>00336 std::vector<MapType> m_LabelStatisticsPerThread; <a name="l00337"></a>00337 MapType m_LabelStatistics; <a name="l00338"></a>00338 <a name="l00339"></a>00339 <span class="keywordtype">bool</span> m_UseHistograms; <a name="l00340"></a>00340 <span class="keyword">typename</span> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#5bf82236e1e50e653de84c8ead448599">HistogramType::SizeType</a> m_NumBins; <a name="l00341"></a>00341 RealType m_LowerBound; <a name="l00342"></a>00342 RealType m_UpperBound; <a name="l00343"></a>00343 <a class="code" href="classitk_1_1SimpleFastMutexLock.html" title="Critical section locking class that can be allocated on the stack.">SimpleFastMutexLock</a> m_Mutex; <a name="l00344"></a>00344 <a name="l00345"></a>00345 }; <span class="comment">// end of class</span> <a name="l00346"></a>00346 <a name="l00347"></a>00347 } <span class="comment">// end namespace itk</span> <a name="l00348"></a>00348 <a name="l00349"></a>00349 <span class="preprocessor">#ifndef ITK_MANUAL_INSTANTIATION</span> <a name="l00350"></a>00350 <span class="preprocessor"></span><span class="preprocessor">#include "itkLabelStatisticsImageFilter.txx"</span> <a name="l00351"></a>00351 <span class="preprocessor">#endif</span> <a name="l00352"></a>00352 <span class="preprocessor"></span> <a name="l00353"></a>00353 <span class="preprocessor">#endif</span> <a name="l00354"></a>00354 <span class="preprocessor"></span> </pre></div></div> <hr><address><small> Generated at Thu May 7 23:23:24 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>