<!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: itkWatershedSegmentTreeGenerator.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_16b0d2d22c345042f35cebae66b36010.html">Algorithms</a> </div> <div class="contents"> <h1>itkWatershedSegmentTreeGenerator.h</h1><a href="itkWatershedSegmentTreeGenerator_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: itkWatershedSegmentTreeGenerator.h,v $</span> <a name="l00005"></a>00005 <span class="comment"> Language: C++</span> <a name="l00006"></a>00006 <span class="comment"> Date: $Date: 2009-01-27 19:30:19 $</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 __itkWatershedSegmentTreeGenerator_h</span> <a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#define __itkWatershedSegmentTreeGenerator_h</span> <a name="l00019"></a>00019 <span class="preprocessor"></span> <a name="l00020"></a>00020 <span class="preprocessor">#include "<a class="code" href="itkWatershedSegmentTable_8h.html">itkWatershedSegmentTable.h</a>"</span> <a name="l00021"></a>00021 <span class="preprocessor">#include "<a class="code" href="itkWatershedSegmentTree_8h.html">itkWatershedSegmentTree.h</a>"</span> <a name="l00022"></a>00022 <span class="preprocessor">#include "<a class="code" href="itkEquivalencyTable_8h.html">itkEquivalencyTable.h</a>"</span> <a name="l00023"></a>00023 <span class="preprocessor">#include "<a class="code" href="itkOneWayEquivalencyTable_8h.html">itkOneWayEquivalencyTable.h</a>"</span> <a name="l00024"></a>00024 <a name="l00025"></a>00025 <span class="preprocessor">#include <algorithm></span> <a name="l00026"></a>00026 <span class="preprocessor">#include <utility></span> <a name="l00027"></a>00027 <a name="l00028"></a>00028 <span class="keyword">namespace </span>itk <a name="l00029"></a>00029 { <a name="l00030"></a>00030 <span class="keyword">namespace </span>watershed <a name="l00031"></a>00031 { <a name="l00032"></a>00032 <a name="l00076"></a>00076 <span class="keyword">template</span> <<span class="keyword">class</span> TScalarType> <a name="l00077"></a><a class="code" href="classitk_1_1watershed_1_1SegmentTreeGenerator.html">00077</a> <span class="keyword">class </span><a class="code" href="itkWin32Header_8h.html#7d4384322557205d75f0719c012dded6">ITK_EXPORT</a> <a class="code" href="classitk_1_1watershed_1_1SegmentTreeGenerator.html">SegmentTreeGenerator</a> : <span class="keyword">public</span> <a class="code" href="classitk_1_1ProcessObject.html" title="ProcessObject is the base class for all process objects (source, filters, mappers)...">ProcessObject</a> <a name="l00078"></a>00078 { <a name="l00079"></a>00079 <span class="keyword">public</span>: <a name="l00080"></a>00080 <a name="l00082"></a><a class="code" href="classitk_1_1watershed_1_1SegmentTreeGenerator.html#d68404d8eb2079f51404044b475fd254">00082</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1watershed_1_1SegmentTreeGenerator.html">SegmentTreeGenerator</a> <a class="code" href="classitk_1_1LightObject.html" title="Light weight base class for most itk classes.">Self</a>; <a name="l00083"></a><a class="code" href="classitk_1_1watershed_1_1SegmentTreeGenerator.html#e4f6788ba459922562d9a31e04af1d85">00083</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1ProcessObject.html" title="ProcessObject is the base class for all process objects (source, filters, mappers)...">ProcessObject</a> <a class="code" href="classitk_1_1LightObject.html" title="Light weight base class for most itk classes.">Superclass</a>; <a name="l00084"></a><a class="code" href="classitk_1_1watershed_1_1SegmentTreeGenerator.html#64f035521ec48d9a39f9f2908c7d89cc">00084</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="l00085"></a><a class="code" href="classitk_1_1watershed_1_1SegmentTreeGenerator.html#d09122185bb07aa43d0d972bea531f10">00085</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="l00086"></a>00086 <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="l00087"></a><a class="code" href="classitk_1_1watershed_1_1SegmentTreeGenerator.html#c4554411f1a21af9d267ccb606320a4f">00087</a> <a class="code" href="itkMacro_8h.html#574c1f86661d409dd32c742307a0e96a">itkTypeMacro</a>(<a class="code" href="classWatershedSegmentTreeGenerator.html">WatershedSegmentTreeGenerator</a>, <a class="code" href="classitk_1_1ProcessObject.html" title="ProcessObject is the base class for all process objects (source, filters, mappers)...">ProcessObject</a>); <a name="l00089"></a>00089 <a name="l00091"></a>00091 <span class="keyword">typedef</span> TScalarType ScalarType; <a name="l00092"></a><a class="code" href="classitk_1_1watershed_1_1SegmentTreeGenerator.html#75abce217c1b71106e5d512453a2bbee">00092</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1watershed_1_1SegmentTable.html">SegmentTable<ScalarType></a> <a class="code" href="classitk_1_1watershed_1_1SegmentTable.html">SegmentTableType</a>; <a name="l00093"></a><a class="code" href="classitk_1_1watershed_1_1SegmentTreeGenerator.html#91947c71c496f0a5dc338a9e27227ac4">00093</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1watershed_1_1SegmentTree.html">SegmentTree<ScalarType></a> <a class="code" href="classitk_1_1watershed_1_1SegmentTree.html">SegmentTreeType</a>; <a name="l00094"></a><a class="code" href="classitk_1_1watershed_1_1SegmentTreeGenerator.html#4aef1800d18842ae962ea53f784c612b">00094</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1EquivalencyTable.html" title="Hash table to manage integral label equivalencies.">EquivalencyTable</a> <a class="code" href="classitk_1_1EquivalencyTable.html" title="Hash table to manage integral label equivalencies.">EquivalencyTableType</a>; <a name="l00095"></a><a class="code" href="classitk_1_1watershed_1_1SegmentTreeGenerator.html#110c92f4b1a7973f87c0f5a7212a586d">00095</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1OneWayEquivalencyTable.html" title="Hash table to manage integral label equivalencies that are order dependent.">OneWayEquivalencyTable</a> <a class="code" href="classitk_1_1OneWayEquivalencyTable.html" title="Hash table to manage integral label equivalencies that are order dependent.">OneWayEquivalencyTableType</a>; <a name="l00096"></a><a class="code" href="classitk_1_1watershed_1_1SegmentTreeGenerator.html#9b7f758beb17d82d283c1b92d06a4b1d">00096</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1SmartPointer.html">DataObject::Pointer</a> <a class="code" href="classitk_1_1SmartPointer.html">DataObjectPointer</a>; <a name="l00097"></a>00097 <a name="l00099"></a><a class="code" href="classitk_1_1watershed_1_1SegmentTreeGenerator.html#3c406df49cec0d4c30de9f537a60c0f3">00099</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="classitk_1_1SmartPointer.html">SegmentTableType::Pointer</a> <a class="code" href="classitk_1_1SmartPointer.html">SegmentTableTypePointer</a>; <a name="l00100"></a>00100 <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="classitk_1_1SmartPointer.html">OneWayEquivalencyTableType::Pointer</a> <a name="l00101"></a><a class="code" href="classitk_1_1watershed_1_1SegmentTreeGenerator.html#6720d5f18549cbf1393ab602be6d6745">00101</a> <a class="code" href="classitk_1_1SmartPointer.html">OneWayEquivalencyTableTypePointer</a>; <a name="l00102"></a><a class="code" href="classitk_1_1watershed_1_1SegmentTreeGenerator.html#bb946fa3355c7d29067e5560c6756514">00102</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="classitk_1_1SmartPointer.html">SegmentTreeType::Pointer</a> <a class="code" href="classitk_1_1SmartPointer.html">SegmentTreeTypePointer</a>; <a name="l00103"></a>00103 <a name="l00104"></a>00104 <a name="l00106"></a><a class="code" href="classitk_1_1watershed_1_1SegmentTreeGenerator.html#dc04b8ea3ddff65903ac2b73621446f8">00106</a> <a class="code" href="classitk_1_1watershed_1_1SegmentTable.html">SegmentTableType</a>* GetInputSegmentTable() <a name="l00107"></a>00107 { <a name="l00108"></a>00108 <span class="keywordflow">return</span> <span class="keyword">static_cast<</span><a class="code" href="classitk_1_1watershed_1_1SegmentTable.html">SegmentTableType</a> *<span class="keyword">></span>(this-><a class="code" href="classitk_1_1ProcessObject.html#1cb9c8ea89b6357d9d851f4179f933dd">ProcessObject::GetInput</a>(0)); <a name="l00109"></a>00109 } <a name="l00110"></a><a class="code" href="classitk_1_1watershed_1_1SegmentTreeGenerator.html#d7c2aea0debcdc787cc1867ccb1d9a19">00110</a> <span class="keywordtype">void</span> SetInputSegmentTable(<a class="code" href="classitk_1_1watershed_1_1SegmentTable.html">SegmentTableType</a> *st) <a name="l00111"></a>00111 { <a name="l00112"></a>00112 <span class="comment">// Reset the highest calculated flood level if we are given a</span> <a name="l00113"></a>00113 <span class="comment">// different input image.</span> <a name="l00114"></a>00114 <span class="keywordflow">if</span> (st != this->GetInput(0)) <a name="l00115"></a>00115 { <a name="l00116"></a>00116 m_HighestCalculatedFloodLevel = 0.0; <a name="l00117"></a>00117 } <a name="l00118"></a>00118 this-><a class="code" href="classitk_1_1ProcessObject.html#148829de75f8eae1161af95151710808">ProcessObject::SetNthInput</a>(0, st); <a name="l00119"></a>00119 } <a name="l00121"></a>00121 <a name="l00125"></a><a class="code" href="classitk_1_1watershed_1_1SegmentTreeGenerator.html#7de8e250e0420c4981f69f16f4e34397">00125</a> <span class="keywordtype">void</span> SetInputEquivalencyTable(<a class="code" href="classitk_1_1EquivalencyTable.html" title="Hash table to manage integral label equivalencies.">EquivalencyTableType</a> *eq) <a name="l00126"></a>00126 { <a name="l00127"></a>00127 this-><a class="code" href="classitk_1_1ProcessObject.html#148829de75f8eae1161af95151710808">ProcessObject::SetNthInput</a>(1, eq); <a name="l00128"></a>00128 } <a name="l00129"></a><a class="code" href="classitk_1_1watershed_1_1SegmentTreeGenerator.html#0d86fa896449c4788ff85986de5219da">00129</a> <a class="code" href="classitk_1_1EquivalencyTable.html" title="Hash table to manage integral label equivalencies.">EquivalencyTableType</a>* GetInputEquivalencyTable() <a name="l00130"></a>00130 { <a name="l00131"></a>00131 <span class="keywordflow">return</span> <a name="l00132"></a>00132 <span class="keyword">static_cast<</span><a class="code" href="classitk_1_1EquivalencyTable.html" title="Hash table to manage integral label equivalencies.">EquivalencyTableType</a> *<span class="keyword">></span>(this-><a class="code" href="classitk_1_1ProcessObject.html#1cb9c8ea89b6357d9d851f4179f933dd">ProcessObject::GetInput</a>(1)); <a name="l00133"></a>00133 } <a name="l00135"></a>00135 <a name="l00137"></a><a class="code" href="classitk_1_1watershed_1_1SegmentTreeGenerator.html#c71291aa57bf014cf088c33aa8a1d743">00137</a> <a class="code" href="classitk_1_1watershed_1_1SegmentTree.html">SegmentTreeType</a> * GetOutputSegmentTree() <a name="l00138"></a>00138 { <a name="l00139"></a>00139 <span class="keywordflow">return</span> <span class="keyword">static_cast<</span><a class="code" href="classitk_1_1watershed_1_1SegmentTree.html">SegmentTreeType</a> *<span class="keyword">></span> <a name="l00140"></a>00140 (this-><a class="code" href="classitk_1_1ProcessObject.html#f24a0bf37dae4c4ea24a03caf200588d">ProcessObject::GetOutput</a>(0)); <a name="l00141"></a>00141 } <a name="l00142"></a>00142 <a name="l00144"></a>00144 <span class="keywordtype">void</span> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#f75a5945cdd8315676941024a0b8c1e9">GenerateData</a>(); <a name="l00145"></a>00145 <a name="l00150"></a>00150 <a class="code" href="itkMacro_8h.html#7ebdd33cc5e7d74720ced9099c034faa">itkSetMacro</a>(Merge, <span class="keywordtype">bool</span>); <a name="l00151"></a>00151 <a class="code" href="itkMacro_8h.html#1600305bb01e39e87c472d8bf29bd1cf">itkGetMacro</a>(Merge, <span class="keywordtype">bool</span>); <a name="l00153"></a>00153 <a name="l00159"></a>00159 <span class="keywordtype">void</span> SetFloodLevel(<span class="keywordtype">double</span>); <a name="l00160"></a>00160 <a class="code" href="itkMacro_8h.html#1600305bb01e39e87c472d8bf29bd1cf">itkGetMacro</a>(FloodLevel, <span class="keywordtype">double</span>); <a name="l00162"></a>00162 <a name="l00166"></a>00166 <a class="code" href="itkMacro_8h.html#7ebdd33cc5e7d74720ced9099c034faa">itkSetMacro</a>(HighestCalculatedFloodLevel, <span class="keywordtype">double</span>); <a name="l00167"></a>00167 <a class="code" href="itkMacro_8h.html#1600305bb01e39e87c472d8bf29bd1cf">itkGetMacro</a>(HighestCalculatedFloodLevel, <span class="keywordtype">double</span>); <a name="l00169"></a>00169 <a name="l00175"></a>00175 <a class="code" href="itkMacro_8h.html#7ebdd33cc5e7d74720ced9099c034faa">itkSetMacro</a>(ConsumeInput, <span class="keywordtype">bool</span>); <a name="l00176"></a>00176 <a class="code" href="itkMacro_8h.html#1600305bb01e39e87c472d8bf29bd1cf">itkGetMacro</a>(ConsumeInput, <span class="keywordtype">bool</span>); <a name="l00178"></a>00178 <a name="l00181"></a>00181 <span class="keyword">static</span> <span class="keywordtype">void</span> MergeSegments(SegmentTableTypePointer, <a name="l00182"></a>00182 OneWayEquivalencyTableTypePointer, <a name="l00183"></a>00183 <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span>, <a name="l00184"></a>00184 <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span>); <a name="l00185"></a>00185 <a name="l00188"></a>00188 <span class="keyword">static</span> <span class="keywordtype">void</span> PruneMergeSegments(SegmentTableTypePointer, <a name="l00189"></a>00189 OneWayEquivalencyTableTypePointer, <a name="l00190"></a>00190 <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span>, <a name="l00191"></a>00191 <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span>, <a name="l00192"></a>00192 ScalarType); <a name="l00193"></a>00193 <a name="l00195"></a>00195 <span class="keyword">virtual</span> DataObjectPointer MakeOutput(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> idx); <a name="l00196"></a>00196 <a name="l00197"></a>00197 <span class="keyword">protected</span>: <a name="l00198"></a>00198 <a class="code" href="classitk_1_1watershed_1_1SegmentTreeGenerator.html">SegmentTreeGenerator</a>(); <a name="l00199"></a><a class="code" href="classitk_1_1watershed_1_1SegmentTreeGenerator.html#8ff6da614b20396242ef407eb0f5d0c4">00199</a> <span class="keyword">virtual</span> <a class="code" href="classitk_1_1watershed_1_1SegmentTreeGenerator.html#8ff6da614b20396242ef407eb0f5d0c4">~SegmentTreeGenerator</a>() {} <a name="l00200"></a><a class="code" href="classitk_1_1watershed_1_1SegmentTreeGenerator.html#cb419faa74c1eee7b5d874b25be3b009">00200</a> <a class="code" href="classitk_1_1watershed_1_1SegmentTreeGenerator.html#cb419faa74c1eee7b5d874b25be3b009">SegmentTreeGenerator</a>(<span class="keyword">const</span> <a class="code" href="classitk_1_1LightObject.html" title="Light weight base class for most itk classes.">Self</a>&) {} <a name="l00201"></a><a class="code" href="classitk_1_1watershed_1_1SegmentTreeGenerator.html#c093cb810a3dfe06f1a84a3530618c5f">00201</a> <span class="keywordtype">void</span> <a class="code" href="classitk_1_1watershed_1_1SegmentTreeGenerator.html#c093cb810a3dfe06f1a84a3530618c5f">operator=</a>(<span class="keyword">const</span> <a class="code" href="classitk_1_1LightObject.html" title="Light weight base class for most itk classes.">Self</a>&) {} <a name="l00202"></a>00202 <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="l00203"></a>00203 <a name="l00206"></a>00206 <span class="keywordtype">void</span> CompileMergeList(SegmentTableTypePointer, SegmentTreeTypePointer); <a name="l00207"></a>00207 <a name="l00210"></a>00210 <span class="keywordtype">void</span> ExtractMergeHierarchy(SegmentTableTypePointer, SegmentTreeTypePointer); <a name="l00211"></a>00211 <a name="l00212"></a>00212 <span class="keywordtype">void</span> MergeEquivalencies(); <a name="l00213"></a>00213 <a name="l00215"></a>00215 <span class="keywordtype">void</span> GenerateOutputRequestedRegion(<a class="code" href="classitk_1_1DataObject.html" title="Base class for all data objects in ITK.">DataObject</a> *output); <a name="l00216"></a>00216 <span class="keywordtype">void</span> GenerateInputRequestedRegion(); <a name="l00218"></a>00218 <a name="l00219"></a>00219 <span class="keyword">private</span>: <a name="l00220"></a>00220 <span class="keywordtype">bool</span> m_Merge; <a name="l00221"></a>00221 <span class="keywordtype">double</span> m_FloodLevel; <a name="l00222"></a>00222 <span class="keywordtype">bool</span> m_ConsumeInput; <a name="l00223"></a>00223 <a name="l00224"></a>00224 <a class="code" href="itkFEMMacro_8h.html#539cce1a3282ba59952dedcbf9cdb23f">OneWayEquivalencyTableType::Pointer</a> m_MergedSegmentsTable; <a name="l00225"></a>00225 <a name="l00230"></a>00230 <span class="keywordtype">double</span> m_HighestCalculatedFloodLevel; <a name="l00231"></a>00231 }; <a name="l00232"></a>00232 <a name="l00233"></a>00233 }<span class="comment">// end namespace watershed</span> <a name="l00234"></a>00234 }<span class="comment">// end namespace itk</span> <a name="l00235"></a>00235 <a name="l00236"></a>00236 <span class="preprocessor">#ifndef ITK_MANUAL_INSTANTIATION</span> <a name="l00237"></a>00237 <span class="preprocessor"></span><span class="preprocessor">#include "itkWatershedSegmentTreeGenerator.txx"</span> <a name="l00238"></a>00238 <span class="preprocessor">#endif</span> <a name="l00239"></a>00239 <span class="preprocessor"></span> <a name="l00240"></a>00240 <span class="preprocessor">#endif</span> <a name="l00241"></a>00241 <span class="preprocessor"></span> </pre></div></div> <hr><address><small> Generated at Fri May 8 00:40:49 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>