Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > d5e74628f0e673bb8680aebce32b2c04 > files > 16260

itk-doc-3.12.0-1mdv2010.0.i586.rpm

<!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: itkKdTreeBasedKmeansEstimator.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>&nbsp;&nbsp; 
<a href="modules.html" class="qindex">Groups</a>&nbsp;&nbsp;
<a href="namespaces.html" class="qindex">Namespace List</a>&nbsp;&nbsp;
<a href="hierarchy.html" class="qindex">Class Hierarchy</a>&nbsp;&nbsp;
<a href="classes.html" class="qindex">Alphabetical List</a>&nbsp;&nbsp;
<a href="annotated.html" class="qindex">Compound List</a>&nbsp;&nbsp; 
<a href="files.html" class="qindex">File
List</a>&nbsp;&nbsp; 
<a href="namespacemembers.html" class="qindex">Namespace Members</a>&nbsp;&nbsp; 
<a href="functions.html" class="qindex">Compound Members</a>&nbsp;&nbsp; 
<a href="globals.html" class="qindex">File Members</a>&nbsp;&nbsp;
<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>&nbsp;&raquo&nbsp;<a class="el" href="dir_2c33022d19e8077162952ea9ed57656d.html">Numerics</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_e82fe55e9fab4124d6625d716e091a5f.html">Statistics</a>
  </div>
<div class="contents">
<h1>itkKdTreeBasedKmeansEstimator.h</h1><a href="itkKdTreeBasedKmeansEstimator_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 &amp; Registration Toolkit</span>
<a name="l00004"></a>00004 <span class="comment">  Module:    $RCSfile: itkKdTreeBasedKmeansEstimator.h,v $</span>
<a name="l00005"></a>00005 <span class="comment">  Language:  C++</span>
<a name="l00006"></a>00006 <span class="comment">  Date:      $Date: 2005-07-26 15:54:59 $</span>
<a name="l00007"></a>00007 <span class="comment">  Version:   $Revision: 1.18 $</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 __itkKdTreeBasedKmeansEstimator_h</span>
<a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#define __itkKdTreeBasedKmeansEstimator_h</span>
<a name="l00019"></a>00019 <span class="preprocessor"></span>
<a name="l00020"></a>00020 <span class="preprocessor">#include &lt;vector&gt;</span>
<a name="l00021"></a>00021 <span class="preprocessor">#include "<a class="code" href="itk__hash__map_8h.html">itk_hash_map.h</a>"</span>
<a name="l00022"></a>00022 
<a name="l00023"></a>00023 <span class="preprocessor">#include "<a class="code" href="itkObject_8h.html">itkObject.h</a>"</span>
<a name="l00024"></a>00024 <span class="preprocessor">#include "<a class="code" href="itkMeasurementVectorTraits_8h.html">itkMeasurementVectorTraits.h</a>"</span>
<a name="l00025"></a>00025 
<a name="l00026"></a>00026 <span class="keyword">namespace </span>itk {
<a name="l00027"></a>00027 <span class="keyword">namespace </span>Statistics {
<a name="l00028"></a>00028 
<a name="l00066"></a>00066 <span class="keyword">template</span>&lt; <span class="keyword">class</span> TKdTree &gt;
<a name="l00067"></a><a class="code" href="classitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator.html">00067</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_1KdTreeBasedKmeansEstimator.html" title="fast k-means algorithm implementation using k-d tree structure">KdTreeBasedKmeansEstimator</a>: 
<a name="l00068"></a>00068     <span class="keyword">public</span> <a class="code" href="classitk_1_1Object.html" title="Base class for most itk classes.">Object</a>
<a name="l00069"></a>00069 {
<a name="l00070"></a>00070 <span class="keyword">public</span>:
<a name="l00072"></a><a class="code" href="classitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator.html#7430c6dcb6cfe96656730072e7413d87">00072</a>   <span class="keyword">typedef</span> <a class="code" href="classitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator.html" title="fast k-means algorithm implementation using k-d tree structure">KdTreeBasedKmeansEstimator</a> <a class="code" href="classitk_1_1LightObject.html" title="Light weight base class for most itk classes.">Self</a> ;
<a name="l00073"></a><a class="code" href="classitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator.html#26ee5f92112a5b2ae95500cfa47c3421">00073</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="l00074"></a><a class="code" href="classitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator.html#ee0e22b89030d23c2c0cc460e838f04f">00074</a>   <span class="keyword">typedef</span> <a class="code" href="classitk_1_1SmartPointer.html">SmartPointer&lt;Self&gt;</a> <a class="code" href="classitk_1_1SmartPointer.html">Pointer</a>;
<a name="l00075"></a><a class="code" href="classitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator.html#b8f11df41a72a207b30b935b58b14f4b">00075</a>   <span class="keyword">typedef</span> <a class="code" href="classitk_1_1SmartPointer.html">SmartPointer&lt;const Self&gt;</a> <a class="code" href="classitk_1_1SmartPointer.html">ConstPointer</a>;
<a name="l00076"></a>00076 
<a name="l00078"></a>00078   <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="l00079"></a>00079 
<a name="l00081"></a><a class="code" href="classitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator.html#50adad417b5f62782025e2749c4e2146">00081</a>   <a class="code" href="itkMacro_8h.html#574c1f86661d409dd32c742307a0e96a">itkTypeMacro</a>(<a class="code" href="classitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator.html" title="fast k-means algorithm implementation using k-d tree structure">KdTreeBasedKmeansEstimator</a>, Obeject);
<a name="l00082"></a>00082 
<a name="l00084"></a>00084   <span class="keyword">typedef</span> <span class="keyword">typename</span> TKdTree::KdTreeNodeType KdTreeNodeType ;
<a name="l00085"></a><a class="code" href="classitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator.html#f9667af819521977d457436d41b4e34e">00085</a>   <span class="keyword">typedef</span> <span class="keyword">typename</span> TKdTree::MeasurementType MeasurementType ;
<a name="l00086"></a><a class="code" href="classitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator.html#0263b576da173f0911391e629fbb363b">00086</a>   <span class="keyword">typedef</span> <span class="keyword">typename</span> TKdTree::MeasurementVectorType MeasurementVectorType ;
<a name="l00087"></a><a class="code" href="classitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator.html#1a2cbaf674c84c40c906732beeda4d8d">00087</a>   <span class="keyword">typedef</span> <span class="keyword">typename</span> TKdTree::InstanceIdentifier InstanceIdentifier ;
<a name="l00088"></a><a class="code" href="classitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator.html#a0da04c8cbaa5d78fe367e2b37640e82">00088</a>   <span class="keyword">typedef</span> <span class="keyword">typename</span> TKdTree::SampleType SampleType ;
<a name="l00089"></a><a class="code" href="classitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator.html#c8327419b317bff7d0a0c5b13aa4f773">00089</a>   <span class="keyword">typedef</span> <span class="keyword">typename</span> KdTreeNodeType::CentroidType CentroidType ;
<a name="l00090"></a>00090 
<a name="l00091"></a>00091 
<a name="l00093"></a><a class="code" href="classitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator.html#d22f34e2e1bfcbd4f7dce3a4741e1793">00093</a>   <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> MeasurementVectorSizeType;
<a name="l00094"></a>00094 
<a name="l00097"></a><a class="code" href="classitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator.html#2c46ab68b99b81b9a28f8d7f33ebdb6b">00097</a>   <span class="keyword">typedef</span> <a class="code" href="classitk_1_1Array.html">Array&lt; double &gt;</a> <a class="code" href="classitk_1_1Array.html">ParameterType</a> ;
<a name="l00098"></a><a class="code" href="classitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator.html#66e2773addf243fc96cd4127ce1eec46">00098</a>   <span class="keyword">typedef</span> std::vector&lt; ParameterType &gt; InternalParametersType;
<a name="l00099"></a><a class="code" href="classitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator.html#57b7e6d0e222d569f4df85c14c314017">00099</a>   <span class="keyword">typedef</span> <a class="code" href="classitk_1_1Array.html">Array&lt; double &gt;</a> <a class="code" href="classitk_1_1Array.html">ParametersType</a>;
<a name="l00100"></a>00100 
<a name="l00102"></a><a class="code" href="classitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator.html#3b7129ce37b94a04b9ce34cb0a4c89cb">00102</a>   <span class="keywordtype">void</span> SetParameters(<a class="code" href="classitk_1_1Array.html">ParametersType</a>&amp; params)
<a name="l00103"></a>00103   { m_Parameters = params ; }
<a name="l00104"></a>00104 
<a name="l00106"></a><a class="code" href="classitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator.html#964c21decc48b381316102974087bad2">00106</a>   <a class="code" href="classitk_1_1Array.html">ParametersType</a>&amp; GetParameters() 
<a name="l00107"></a>00107   { <span class="keywordflow">return</span> m_Parameters ; }
<a name="l00108"></a>00108 
<a name="l00110"></a>00110   <a class="code" href="itkMacro_8h.html#7ebdd33cc5e7d74720ced9099c034faa">itkSetMacro</a>( MaximumIteration, <span class="keywordtype">int</span> );
<a name="l00111"></a>00111   <a class="code" href="itkMacro_8h.html#7d989c13a1a213168db99ae0f84185d4">itkGetConstReferenceMacro</a>( MaximumIteration, <span class="keywordtype">int</span> ); 
<a name="l00113"></a>00113 
<a name="l00116"></a>00116   <a class="code" href="itkMacro_8h.html#7ebdd33cc5e7d74720ced9099c034faa">itkSetMacro</a>( CentroidPositionChangesThreshold, <span class="keywordtype">double</span> );   
<a name="l00117"></a>00117   <a class="code" href="itkMacro_8h.html#7d989c13a1a213168db99ae0f84185d4">itkGetConstReferenceMacro</a>( CentroidPositionChangesThreshold, <span class="keywordtype">double</span> );   
<a name="l00119"></a>00119 
<a name="l00121"></a><a class="code" href="classitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator.html#dcf17d1286ad96fd6474097f34389382">00121</a>   <span class="keywordtype">void</span> SetKdTree(TKdTree* tree) 
<a name="l00122"></a>00122     { 
<a name="l00123"></a>00123     m_KdTree = tree ; 
<a name="l00124"></a>00124     m_MeasurementVectorSize = tree-&gt;GetMeasurementVectorSize();
<a name="l00125"></a>00125     m_DistanceMetric-&gt;SetMeasurementVectorSize( m_MeasurementVectorSize );
<a name="l00126"></a>00126     <a class="code" href="classitk_1_1MeasurementVectorTraits.html#d7a46e993e7f3d690bc20f98971d25d5">MeasurementVectorTraits::SetLength</a>( m_TempVertex, m_MeasurementVectorSize );
<a name="l00127"></a>00127     }
<a name="l00129"></a>00129 
<a name="l00130"></a><a class="code" href="classitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator.html#9f1e9bb0bc77f5372a520a4b77748d1c">00130</a>   TKdTree* GetKdTree() 
<a name="l00131"></a>00131   { <span class="keywordflow">return</span> m_KdTree.GetPointer() ; }
<a name="l00132"></a>00132 
<a name="l00134"></a>00134   <a class="code" href="itkMacro_8h.html#7d989c13a1a213168db99ae0f84185d4">itkGetConstReferenceMacro</a>( MeasurementVectorSize, MeasurementVectorSizeType );
<a name="l00135"></a>00135 
<a name="l00136"></a>00136   <a class="code" href="itkMacro_8h.html#7d989c13a1a213168db99ae0f84185d4">itkGetConstReferenceMacro</a>( CurrentIteration, <span class="keywordtype">int</span>) ;
<a name="l00137"></a>00137   <a class="code" href="itkMacro_8h.html#7d989c13a1a213168db99ae0f84185d4">itkGetConstReferenceMacro</a>( CentroidPositionChanges, <span class="keywordtype">double</span>) ;
<a name="l00138"></a>00138 
<a name="l00143"></a>00143   <span class="keywordtype">void</span> StartOptimization() ;
<a name="l00144"></a>00144 
<a name="l00145"></a><a class="code" href="classitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator.html#fac6f43a259932281dcb5f2e2772ac5c">00145</a>   <span class="keyword">typedef</span> <a class="code" href="classitk_1_1hash__map.html">itk::hash_map&lt; InstanceIdentifier, unsigned int &gt;</a> <a class="code" href="classitk_1_1hash__map.html">ClusterLabelsType</a> ;
<a name="l00146"></a>00146 
<a name="l00147"></a><a class="code" href="classitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator.html#63c4a492c7e032a9b71252719f205a4c">00147</a>   <span class="keywordtype">void</span> SetUseClusterLabels(<span class="keywordtype">bool</span> flag)
<a name="l00148"></a>00148   { m_UseClusterLabels = flag ; }
<a name="l00149"></a>00149 
<a name="l00150"></a><a class="code" href="classitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator.html#65d0fbc69886d0ca48ba33d3cfb22013">00150</a>   <a class="code" href="classitk_1_1hash__map.html">ClusterLabelsType</a>* GetClusterLabels() 
<a name="l00151"></a>00151   { <span class="keywordflow">return</span> &amp;m_ClusterLabels ; }
<a name="l00152"></a>00152 
<a name="l00153"></a>00153 <span class="keyword">protected</span>:
<a name="l00154"></a>00154   <a class="code" href="classitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator.html" title="fast k-means algorithm implementation using k-d tree structure">KdTreeBasedKmeansEstimator</a>() ;
<a name="l00155"></a><a class="code" href="classitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator.html#17586e87059b21ab17613aef6a94a142">00155</a>   <span class="keyword">virtual</span> <a class="code" href="classitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator.html#17586e87059b21ab17613aef6a94a142">~KdTreeBasedKmeansEstimator</a>() {}
<a name="l00156"></a>00156 
<a name="l00157"></a>00157   <span class="keywordtype">void</span> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#920ae03048a5ad715d803ca2e92b52de">PrintSelf</a>(std::ostream&amp; 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="l00158"></a>00158 
<a name="l00159"></a>00159   <span class="keywordtype">void</span> FillClusterLabels(KdTreeNodeType* node, <span class="keywordtype">int</span> closestIndex) ;
<a name="l00160"></a>00160 
<a name="l00162"></a><a class="code" href="classitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator_1_1CandidateVector.html">00162</a>   <span class="keyword">class </span><a class="code" href="classitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator_1_1CandidateVector.html">CandidateVector</a>
<a name="l00163"></a>00163   {
<a name="l00164"></a>00164   <span class="keyword">public</span>:
<a name="l00165"></a><a class="code" href="classitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator_1_1CandidateVector.html#bdffb034f2c3a49ab27023c75be3f13f">00165</a>     <a class="code" href="classitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator_1_1CandidateVector.html#bdffb034f2c3a49ab27023c75be3f13f">CandidateVector</a>() {}
<a name="l00166"></a>00166 
<a name="l00167"></a><a class="code" href="structitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator_1_1CandidateVector_1_1Candidate.html">00167</a>     <span class="keyword">struct </span><a class="code" href="structitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator_1_1CandidateVector_1_1Candidate.html">Candidate</a>
<a name="l00168"></a>00168     {
<a name="l00169"></a><a class="code" href="structitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator_1_1CandidateVector_1_1Candidate.html#dc632dc8e83d7de3a8ce7ccfd16c14d3">00169</a>       CentroidType Centroid ;
<a name="l00170"></a><a class="code" href="structitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator_1_1CandidateVector_1_1Candidate.html#31b66eaadfb8cc1cc064a4cc9ba1a22a">00170</a>       CentroidType WeightedCentroid ;
<a name="l00171"></a><a class="code" href="structitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator_1_1CandidateVector_1_1Candidate.html#dd36e2e4b34c2301f814e2855ad62195">00171</a>       <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> ;
<a name="l00172"></a>00172     } ; <span class="comment">// end of struct</span>
<a name="l00173"></a>00173 
<a name="l00174"></a><a class="code" href="classitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator_1_1CandidateVector.html#4b3ad6b095a00999e14244070f3acda1">00174</a>     <span class="keyword">virtual</span> <a class="code" href="classitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator_1_1CandidateVector.html#4b3ad6b095a00999e14244070f3acda1">~CandidateVector</a>() {} 
<a name="l00175"></a>00175 
<a name="l00177"></a><a class="code" href="classitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator_1_1CandidateVector.html#c28b1b0be608c2040587e302befac4a3">00177</a>     <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="l00178"></a>00178 <span class="keyword">    </span>{ <span class="keywordflow">return</span> <span class="keyword">static_cast&lt;</span><span class="keywordtype">int</span><span class="keyword">&gt;</span>( m_Candidates.size() ); }
<a name="l00179"></a>00179 
<a name="l00182"></a><a class="code" href="classitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator_1_1CandidateVector.html#01a6bfedd1b2bbd1786855b4f0ea2466">00182</a>     <span class="keywordtype">void</span> SetCentroids(InternalParametersType&amp; centroids)
<a name="l00183"></a>00183     {
<a name="l00184"></a>00184       this-&gt;m_MeasurementVectorSize = <a class="code" href="classitk_1_1MeasurementVectorTraits.html#4868d37fef7fcc55678062887cf44afd">MeasurementVectorTraits::GetLength</a>( centroids[0] );
<a name="l00185"></a>00185       m_Candidates.resize(centroids.size()) ;
<a name="l00186"></a>00186       <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0 ; i &lt; centroids.size() ; i++)
<a name="l00187"></a>00187         {
<a name="l00188"></a>00188           <a class="code" href="structitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator_1_1CandidateVector_1_1Candidate.html">Candidate</a> candidate ;
<a name="l00189"></a>00189           candidate.<a class="code" href="structitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator_1_1CandidateVector_1_1Candidate.html#dc632dc8e83d7de3a8ce7ccfd16c14d3">Centroid</a> = centroids[i] ;
<a name="l00190"></a>00190           <a class="code" href="classitk_1_1MeasurementVectorTraits.html#d7a46e993e7f3d690bc20f98971d25d5">MeasurementVectorTraits::SetLength</a>( candidate.<a class="code" href="structitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator_1_1CandidateVector_1_1Candidate.html#31b66eaadfb8cc1cc064a4cc9ba1a22a">WeightedCentroid</a>, m_MeasurementVectorSize );
<a name="l00191"></a>00191           candidate.<a class="code" href="structitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator_1_1CandidateVector_1_1Candidate.html#31b66eaadfb8cc1cc064a4cc9ba1a22a">WeightedCentroid</a>.Fill(0.0) ;
<a name="l00192"></a>00192           candidate.<a class="code" href="structitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator_1_1CandidateVector_1_1Candidate.html#dd36e2e4b34c2301f814e2855ad62195">Size</a> = 0 ;
<a name="l00193"></a>00193           m_Candidates[i] = candidate ;
<a name="l00194"></a>00194         }
<a name="l00195"></a>00195     }
<a name="l00197"></a>00197 
<a name="l00199"></a><a class="code" href="classitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator_1_1CandidateVector.html#aa7bcb710c42c127b3b8ff92c1313c69">00199</a>     <span class="keywordtype">void</span> GetCentroids(InternalParametersType&amp; centroids)
<a name="l00200"></a>00200     {
<a name="l00201"></a>00201       <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i ;
<a name="l00202"></a>00202       centroids.resize(this-&gt;<a class="code" href="classitk_1_1Size.html" title="Represent the size (bounds) of a n-dimensional image.">Size</a>()) ;
<a name="l00203"></a>00203       <span class="keywordflow">for</span> (i = 0 ; i &lt; (<span class="keywordtype">unsigned</span> int)this-&gt;<a class="code" href="classitk_1_1Size.html" title="Represent the size (bounds) of a n-dimensional image.">Size</a>() ; i++)
<a name="l00204"></a>00204         {
<a name="l00205"></a>00205           centroids[i] = m_Candidates[i].<a class="code" href="structitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator_1_1CandidateVector_1_1Candidate.html#dc632dc8e83d7de3a8ce7ccfd16c14d3">Centroid</a> ;
<a name="l00206"></a>00206         }
<a name="l00207"></a>00207     }
<a name="l00209"></a>00209 
<a name="l00212"></a><a class="code" href="classitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator_1_1CandidateVector.html#e07d911bfaaa26bdfcb8f5ae73ae9463">00212</a>     <span class="keywordtype">void</span> UpdateCentroids()
<a name="l00213"></a>00213     {
<a name="l00214"></a>00214       <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, j ;
<a name="l00215"></a>00215       <span class="keywordflow">for</span> (i = 0 ; i &lt; (<span class="keywordtype">unsigned</span> int)this-&gt;<a class="code" href="classitk_1_1Size.html" title="Represent the size (bounds) of a n-dimensional image.">Size</a>() ; i++)
<a name="l00216"></a>00216         {
<a name="l00217"></a>00217           <span class="keywordflow">if</span> (m_Candidates[i].<a class="code" href="classitk_1_1Size.html" title="Represent the size (bounds) of a n-dimensional image.">Size</a> &gt; 0)
<a name="l00218"></a>00218             {
<a name="l00219"></a>00219               <span class="keywordflow">for</span> (j = 0 ; j &lt; m_MeasurementVectorSize; j++)
<a name="l00220"></a>00220                 {
<a name="l00221"></a>00221                   m_Candidates[i].Centroid[j] = 
<a name="l00222"></a>00222                     m_Candidates[i].WeightedCentroid[j] / 
<a name="l00223"></a>00223                     double(m_Candidates[i].<a class="code" href="classitk_1_1Size.html" title="Represent the size (bounds) of a n-dimensional image.">Size</a>) ;
<a name="l00224"></a>00224                 }
<a name="l00225"></a>00225             }
<a name="l00226"></a>00226         }
<a name="l00227"></a>00227     }
<a name="l00229"></a>00229 
<a name="l00231"></a><a class="code" href="classitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator_1_1CandidateVector.html#d0c1baee405271ad18dfeba97cac2139">00231</a>     <a class="code" href="structitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator_1_1CandidateVector_1_1Candidate.html">Candidate</a>&amp; operator[](<span class="keywordtype">int</span> index)
<a name="l00232"></a>00232     { <span class="keywordflow">return</span> m_Candidates[index] ; }
<a name="l00233"></a>00233 
<a name="l00234"></a>00234 
<a name="l00235"></a>00235   <span class="keyword">private</span>:
<a name="l00237"></a>00237     std::vector&lt; Candidate &gt; m_Candidates ;
<a name="l00238"></a>00238 
<a name="l00240"></a>00240     MeasurementVectorSizeType m_MeasurementVectorSize;
<a name="l00241"></a>00241   } ; <span class="comment">// end of class</span>
<a name="l00242"></a>00242 
<a name="l00248"></a>00248   <span class="keywordtype">double</span> GetSumOfSquaredPositionChanges(InternalParametersType &amp;previous, 
<a name="l00249"></a>00249                                         InternalParametersType &amp;current) ;
<a name="l00250"></a>00250 
<a name="l00253"></a>00253   <span class="keywordtype">int</span> GetClosestCandidate(ParameterType &amp;measurements, 
<a name="l00254"></a>00254                           std::vector&lt; int &gt; &amp;validIndexes) ;
<a name="l00255"></a>00255 
<a name="l00257"></a>00257   <span class="keywordtype">bool</span> IsFarther(ParameterType &amp;pointA,
<a name="l00258"></a>00258                  ParameterType &amp;pointB,
<a name="l00259"></a>00259                  MeasurementVectorType &amp;lowerBound,
<a name="l00260"></a>00260                  MeasurementVectorType &amp;upperBound) ;
<a name="l00261"></a>00261 
<a name="l00264"></a>00264   <span class="keywordtype">void</span> Filter(KdTreeNodeType* node, 
<a name="l00265"></a>00265               std::vector&lt; int &gt; validIndexes,
<a name="l00266"></a>00266               MeasurementVectorType &amp;lowerBound, 
<a name="l00267"></a>00267               MeasurementVectorType &amp;upperBound) ;
<a name="l00268"></a>00268 
<a name="l00270"></a>00270   <span class="keywordtype">void</span> CopyParameters(InternalParametersType &amp;source, InternalParametersType &amp;target) ;
<a name="l00271"></a>00271 
<a name="l00273"></a>00273   <span class="keywordtype">void</span> CopyParameters(ParametersType &amp;source, InternalParametersType &amp;target) ;
<a name="l00274"></a>00274 
<a name="l00276"></a>00276   <span class="keywordtype">void</span> CopyParameters(InternalParametersType &amp;source, ParametersType &amp;target) ;
<a name="l00277"></a>00277 
<a name="l00279"></a><a class="code" href="classitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator.html#f45acea203f7136a6bb7a23039d41ad3">00279</a>   <span class="keywordtype">void</span> GetPoint(<a class="code" href="classitk_1_1Array.html">ParameterType</a> &amp;point, 
<a name="l00280"></a>00280                 MeasurementVectorType measurements)
<a name="l00281"></a>00281   {
<a name="l00282"></a>00282     <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0 ; i &lt; m_MeasurementVectorSize ; i++)
<a name="l00283"></a>00283       {
<a name="l00284"></a>00284         point[i] = measurements[i] ;
<a name="l00285"></a>00285       }
<a name="l00286"></a>00286   }
<a name="l00288"></a>00288 
<a name="l00289"></a><a class="code" href="classitk_1_1Statistics_1_1KdTreeBasedKmeansEstimator.html#787b1fef9a1daec693b360b1eae54a8c">00289</a>   <span class="keywordtype">void</span> PrintPoint(<a class="code" href="classitk_1_1Array.html">ParameterType</a> &amp;point)
<a name="l00290"></a>00290   {
<a name="l00291"></a>00291     std::cout &lt;&lt; <span class="stringliteral">"[ "</span> ;
<a name="l00292"></a>00292     <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0 ; i &lt; m_MeasurementVectorSize ; i++)
<a name="l00293"></a>00293       {
<a name="l00294"></a>00294         std::cout &lt;&lt; point[i] &lt;&lt; <span class="stringliteral">" "</span> ;
<a name="l00295"></a>00295       }
<a name="l00296"></a>00296     std::cout &lt;&lt; <span class="stringliteral">"]"</span> ;
<a name="l00297"></a>00297   }
<a name="l00298"></a>00298 
<a name="l00299"></a>00299 <span class="keyword">private</span>:
<a name="l00301"></a>00301   <span class="keywordtype">int</span> m_CurrentIteration ;
<a name="l00302"></a>00302 
<a name="l00304"></a>00304   <span class="keywordtype">int</span> m_MaximumIteration ;
<a name="l00305"></a>00305 
<a name="l00307"></a>00307   <span class="keywordtype">double</span> m_CentroidPositionChanges ;
<a name="l00308"></a>00308 
<a name="l00311"></a>00311   <span class="keywordtype">double</span> m_CentroidPositionChangesThreshold ;
<a name="l00312"></a>00312 
<a name="l00314"></a>00314   <span class="keyword">typename</span> <a class="code" href="itkFEMMacro_8h.html#539cce1a3282ba59952dedcbf9cdb23f">TKdTree::Pointer</a> m_KdTree ;
<a name="l00315"></a>00315 
<a name="l00317"></a>00317   <span class="keyword">typename</span> <a class="code" href="classitk_1_1Statistics_1_1EuclideanDistance.html" title="Euclidean distance function.">EuclideanDistance&lt; ParameterType &gt;::Pointer</a> m_DistanceMetric ;
<a name="l00318"></a>00318 
<a name="l00320"></a>00320   ParametersType m_Parameters ;
<a name="l00321"></a>00321 
<a name="l00322"></a>00322   CandidateVector m_CandidateVector ;
<a name="l00323"></a>00323   
<a name="l00324"></a>00324   ParameterType m_TempVertex ;
<a name="l00325"></a>00325 
<a name="l00326"></a>00326   <span class="keywordtype">bool</span> m_UseClusterLabels ;
<a name="l00327"></a>00327   <span class="keywordtype">bool</span> m_GenerateClusterLabels ;
<a name="l00328"></a>00328   ClusterLabelsType m_ClusterLabels ;
<a name="l00329"></a>00329   MeasurementVectorSizeType m_MeasurementVectorSize;
<a name="l00330"></a>00330 } ; <span class="comment">// end of class</span>
<a name="l00331"></a>00331 
<a name="l00332"></a>00332 } <span class="comment">// end of namespace Statistics</span>
<a name="l00333"></a>00333 } <span class="comment">// end of namespace itk</span>
<a name="l00334"></a>00334 
<a name="l00335"></a>00335 <span class="preprocessor">#ifndef ITK_MANUAL_INSTANTIATION</span>
<a name="l00336"></a>00336 <span class="preprocessor"></span><span class="preprocessor">#include "itkKdTreeBasedKmeansEstimator.txx"</span>
<a name="l00337"></a>00337 <span class="preprocessor">#endif</span>
<a name="l00338"></a>00338 <span class="preprocessor"></span>
<a name="l00339"></a>00339 
<a name="l00340"></a>00340 <span class="preprocessor">#endif</span>
<a name="l00341"></a>00341 <span class="preprocessor"></span>
</pre></div></div>
<hr><address><small>
Generated at Thu May 7 23:22:27 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>,
 &copy;&nbsp;1997-2000</small></address>
</body>
</html>