Sophie

Sophie

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

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: itkAttributeMorphologyBaseImageFilter.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_dd352b1cbb04f9ff09fa5f33693fed9f.html">Review</a>
  </div>
<div class="contents">
<h1>itkAttributeMorphologyBaseImageFilter.h</h1><a href="itkAttributeMorphologyBaseImageFilter_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: itkAttributeMorphologyBaseImageFilter.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-02-20 17:59:59 $</span>
<a name="l00007"></a>00007 <span class="comment">  Version:   $Revision: 1.4 $</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 
<a name="l00018"></a>00018 <span class="preprocessor">#ifndef __itkAttributeMorphologyBaseImageFilter_h</span>
<a name="l00019"></a>00019 <span class="preprocessor"></span><span class="preprocessor">#define __itkAttributeMorphologyBaseImageFilter_h</span>
<a name="l00020"></a>00020 <span class="preprocessor"></span>
<a name="l00021"></a>00021 <span class="preprocessor">#include "<a class="code" href="itkImageToImageFilter_8h.html">itkImageToImageFilter.h</a>"</span>
<a name="l00022"></a>00022 <span class="preprocessor">#include "<a class="code" href="itkImage_8h.html">itkImage.h</a>"</span>
<a name="l00023"></a>00023 <span class="preprocessor">#include &lt;vector&gt;</span>
<a name="l00024"></a>00024 
<a name="l00025"></a><a class="code" href="itkAttributeMorphologyBaseImageFilter_8h.html#7826934ae929ca3d49c785e6e41130ae">00025</a> <span class="preprocessor">#define PAMI</span>
<a name="l00026"></a>00026 <span class="preprocessor"></span>
<a name="l00027"></a>00027 <span class="keyword">namespace </span>itk
<a name="l00028"></a>00028 {
<a name="l00029"></a>00029 
<a name="l00056"></a>00056 <span class="keyword">template</span> &lt;<span class="keyword">class</span> TInputImage, <span class="keyword">class</span> TOutputImage, <span class="keyword">class</span> TAttribute, <span class="keyword">class</span> TFunction&gt;
<a name="l00057"></a><a class="code" href="classitk_1_1AttributeMorphologyBaseImageFilter.html">00057</a> <span class="keyword">class </span><a class="code" href="itkWin32Header_8h.html#7d4384322557205d75f0719c012dded6">ITK_EXPORT</a> <a class="code" href="classitk_1_1AttributeMorphologyBaseImageFilter.html" title="Morphological opening by attributes.">AttributeMorphologyBaseImageFilter</a> : 
<a name="l00058"></a>00058     <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>&lt; TInputImage, TOutputImage &gt; 
<a name="l00059"></a>00059 {
<a name="l00060"></a>00060 <span class="keyword">public</span>:
<a name="l00064"></a><a class="code" href="classitk_1_1AttributeMorphologyBaseImageFilter.html#b2649ab2a6625316954ce4f3b8f9f58d">00064</a>   <span class="keyword">typedef</span> <a class="code" href="classitk_1_1AttributeMorphologyBaseImageFilter.html" title="Morphological opening by attributes.">AttributeMorphologyBaseImageFilter</a>              <a class="code" href="classitk_1_1LightObject.html" title="Light weight base class for most itk classes.">Self</a>;
<a name="l00065"></a><a class="code" href="classitk_1_1AttributeMorphologyBaseImageFilter.html#f586e4cd075e161ec76886038a55decd">00065</a>   <span class="keyword">typedef</span> <a class="code" href="classitk_1_1ImageToImageFilter.html">ImageToImageFilter&lt; TInputImage, TOutputImage &gt;</a> <a class="code" href="classitk_1_1LightObject.html" title="Light weight base class for most itk classes.">Superclass</a>;
<a name="l00066"></a>00066 
<a name="l00070"></a><a class="code" href="classitk_1_1AttributeMorphologyBaseImageFilter.html#4c02cfc6d3741d6dfb822ec88fdfe57e">00070</a>   <span class="keyword">typedef</span> <span class="keyword">typename</span> Superclass::InputImagePointer InputImagePointer;
<a name="l00071"></a>00071 
<a name="l00076"></a><a class="code" href="classitk_1_1AttributeMorphologyBaseImageFilter.html#87c040e7ff759bc6f665726cbd3b1d4d">00076</a>   <span class="keyword">typedef</span> <span class="keyword">typename</span> TOutputImage::PixelType         <a class="code" href="namespaceHardConnectedComponentImageFilter.html#73549c9066bb62470db248f27cde10d2">OutputPixelType</a>;
<a name="l00077"></a><a class="code" href="classitk_1_1AttributeMorphologyBaseImageFilter.html#40d90ab236c89f3619a6fd1057e6cea5">00077</a>   <span class="keyword">typedef</span> <span class="keyword">typename</span> TOutputImage::InternalPixelType <a class="code" href="namespaceHardConnectedComponentImageFilter.html#05ddc2f0f1e5f6684417679cf537b4e2">OutputInternalPixelType</a>;
<a name="l00078"></a><a class="code" href="classitk_1_1AttributeMorphologyBaseImageFilter.html#27650e9c1db7fb74601194c5907f2a2d">00078</a>   <span class="keyword">typedef</span> <span class="keyword">typename</span> TInputImage::PixelType          <a class="code" href="namespaceHardConnectedComponentImageFilter.html#6e44b89d73d576fe68c175566a634ab8">InputPixelType</a>;
<a name="l00079"></a><a class="code" href="classitk_1_1AttributeMorphologyBaseImageFilter.html#8cc811c42fa98d1235d49f2e7a0198c6">00079</a>   <span class="keyword">typedef</span> <span class="keyword">typename</span> TInputImage::InternalPixelType  <a class="code" href="namespaceHardConnectedComponentImageFilter.html#a49b439ecaa370af8c4f2c64b0f845bd">InputInternalPixelType</a>;
<a name="l00080"></a><a class="code" href="classitk_1_1AttributeMorphologyBaseImageFilter.html#59bcff89eea4d3f0e0d231df4b268fe3">00080</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="l00081"></a><a class="code" href="classitk_1_1AttributeMorphologyBaseImageFilter.html#87e98df6bbab2ca2686cb22003758fde">00081</a>   <span class="keyword">typedef</span> <span class="keyword">typename</span> TInputImage::OffsetType         OffsetType;
<a name="l00082"></a><a class="code" href="classitk_1_1AttributeMorphologyBaseImageFilter.html#66f8164f20172601dc2e888e01a4e920">00082</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="l00083"></a>00083 
<a name="l00084"></a>00084   <a class="code" href="itkMacro_8h.html#1905cf6b2e88235996fa7ff73b2fb0eb">itkStaticConstMacro</a>(ImageDimension, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>,
<a name="l00085"></a>00085                       TOutputImage::ImageDimension);
<a name="l00086"></a>00086   
<a name="l00090"></a><a class="code" href="classitk_1_1AttributeMorphologyBaseImageFilter.html#647a6b70b9bcbd81b7af6edd059b9043">00090</a>   <span class="keyword">typedef</span> TInputImage  <a class="code" href="namespaceHardConnectedComponentImageFilter.html#3742cbac150bee74daa9aab85ed80623">InputImageType</a>;
<a name="l00091"></a><a class="code" href="classitk_1_1AttributeMorphologyBaseImageFilter.html#82730760609df37ea08b97a0af0ccfa9">00091</a>   <span class="keyword">typedef</span> TOutputImage <a class="code" href="namespaceHardConnectedComponentImageFilter.html#386ea018cab3835dcdff2603f4d2280e">OutputImageType</a>;
<a name="l00092"></a>00092 <span class="comment">//   typedef   typename TInputImage::IndexType       IndexType;</span>
<a name="l00093"></a>00093 <span class="comment">//   typedef   typename TInputImage::SizeType        SizeType;</span>
<a name="l00094"></a><a class="code" href="classitk_1_1AttributeMorphologyBaseImageFilter.html#625ea16a8f4f6f64e97c0969db5153b0">00094</a>   <span class="keyword">typedef</span>   <span class="keyword">typename</span> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#ed8c4a40607d317c666eb96ea265e126">TOutputImage::RegionType</a>     <a class="code" href="namespaceHardConnectedComponentImageFilter.html#ed8c4a40607d317c666eb96ea265e126">RegionType</a>;
<a name="l00095"></a><a class="code" href="classitk_1_1AttributeMorphologyBaseImageFilter.html#521d7105c3f5c4f30f1e6b1921ba5be3">00095</a>   <span class="keyword">typedef</span>   std::list&lt;IndexType&gt;                  <a class="code" href="namespaceHardConnectedComponentImageFilter.html#c7ddb53527b2dae111d642e7d2e6be07">ListType</a>;
<a name="l00096"></a><a class="code" href="classitk_1_1AttributeMorphologyBaseImageFilter.html#39af673d1d6d0fcf561a88972b2f0832">00096</a>   <span class="keyword">typedef</span> TAttribute                              AttributeType;
<a name="l00097"></a>00097 
<a name="l00101"></a><a class="code" href="classitk_1_1AttributeMorphologyBaseImageFilter.html#a3cdeb5af4f92c1939e7af53f554ab9f">00101</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="l00102"></a><a class="code" href="classitk_1_1AttributeMorphologyBaseImageFilter.html#d208b93719d26a282132d2108e4092b9">00102</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="l00103"></a>00103 
<a name="l00107"></a>00107   <a class="code" href="itkMacro_8h.html#574c1f86661d409dd32c742307a0e96a">itkTypeMacro</a>(<a class="code" href="classitk_1_1AttributeMorphologyBaseImageFilter.html" title="Morphological opening by attributes.">AttributeMorphologyBaseImageFilter</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="l00108"></a>00108 
<a name="l00112"></a>00112   <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="l00113"></a>00113 
<a name="l00120"></a>00120   <a class="code" href="itkMacro_8h.html#7ebdd33cc5e7d74720ced9099c034faa">itkSetMacro</a>(FullyConnected, <span class="keywordtype">bool</span>);
<a name="l00121"></a>00121   <a class="code" href="itkMacro_8h.html#7d989c13a1a213168db99ae0f84185d4">itkGetConstReferenceMacro</a>(FullyConnected, <span class="keywordtype">bool</span>);
<a name="l00122"></a>00122   <a class="code" href="itkMacro_8h.html#9e7d129ffebb09fd28bc213e02d87248">itkBooleanMacro</a>(FullyConnected);
<a name="l00124"></a>00124 
<a name="l00130"></a>00130   <a class="code" href="itkMacro_8h.html#7ebdd33cc5e7d74720ced9099c034faa">itkSetMacro</a>(Lambda, AttributeType);
<a name="l00131"></a>00131   <a class="code" href="itkMacro_8h.html#1600305bb01e39e87c472d8bf29bd1cf">itkGetMacro</a>(Lambda, AttributeType);
<a name="l00133"></a>00133 
<a name="l00134"></a>00134 <span class="keyword">protected</span>:
<a name="l00135"></a><a class="code" href="classitk_1_1AttributeMorphologyBaseImageFilter.html#e55ddbff944dddaf00682a90a1622f7b">00135</a>   <a class="code" href="classitk_1_1AttributeMorphologyBaseImageFilter.html" title="Morphological opening by attributes.">AttributeMorphologyBaseImageFilter</a>() 
<a name="l00136"></a>00136     {
<a name="l00137"></a>00137     m_FullyConnected = <span class="keyword">false</span>;
<a name="l00138"></a>00138     m_AttributeValuePerPixel = 1;
<a name="l00139"></a>00139     m_Lambda = 0;
<a name="l00140"></a>00140     }
<a name="l00141"></a><a class="code" href="classitk_1_1AttributeMorphologyBaseImageFilter.html#62358d0aa2c4978d32277d9cac5f985d">00141</a>   <span class="keyword">virtual</span> <a class="code" href="classitk_1_1AttributeMorphologyBaseImageFilter.html#62358d0aa2c4978d32277d9cac5f985d">~AttributeMorphologyBaseImageFilter</a>() {}
<a name="l00142"></a><a class="code" href="classitk_1_1AttributeMorphologyBaseImageFilter.html#686d56a63c3026e92a82c56a3587cfce">00142</a>   <a class="code" href="classitk_1_1AttributeMorphologyBaseImageFilter.html#686d56a63c3026e92a82c56a3587cfce">AttributeMorphologyBaseImageFilter</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>&amp;) {}
<a name="l00143"></a>00143   <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="l00144"></a>00144 
<a name="l00148"></a>00148   <span class="keywordtype">void</span> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#f75a5945cdd8315676941024a0b8c1e9">GenerateData</a>();
<a name="l00149"></a>00149 
<a name="l00153"></a>00153   <span class="keywordtype">void</span> GenerateInputRequestedRegion();
<a name="l00154"></a>00154 
<a name="l00159"></a>00159   <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> *<a class="code" href="itkMacro_8h.html#6be3b439282da7a34278c0594589b972">itkNotUsed</a>(output));
<a name="l00160"></a>00160 
<a name="l00161"></a><a class="code" href="classitk_1_1AttributeMorphologyBaseImageFilter.html#3a63b74b386bd47b4b232754dfbea053">00161</a>   AttributeType m_AttributeValuePerPixel;
<a name="l00162"></a>00162 
<a name="l00163"></a>00163 <span class="keyword">private</span>:
<a name="l00164"></a>00164 
<a name="l00165"></a>00165   <span class="keywordtype">bool</span>          m_FullyConnected;
<a name="l00166"></a>00166   AttributeType m_Lambda;
<a name="l00167"></a>00167 
<a name="l00168"></a>00168   <span class="comment">// some constants used several times in the code</span>
<a name="l00169"></a>00169   <a class="code" href="itkMacro_8h.html#1905cf6b2e88235996fa7ff73b2fb0eb">itkStaticConstMacro</a>(INACTIVE, <span class="keywordtype">long</span>, -1);
<a name="l00170"></a>00170   <a class="code" href="itkMacro_8h.html#1905cf6b2e88235996fa7ff73b2fb0eb">itkStaticConstMacro</a>(ACTIVE, <span class="keywordtype">long</span>, -2);
<a name="l00171"></a>00171   <a class="code" href="itkMacro_8h.html#1905cf6b2e88235996fa7ff73b2fb0eb">itkStaticConstMacro</a>(ROOT, <span class="keywordtype">long</span>, -3);
<a name="l00172"></a>00172 
<a name="l00173"></a>00173   <span class="comment">// Just used for area/volume openings at the moment</span>
<a name="l00174"></a>00174   AttributeType * m_AuxData;
<a name="l00175"></a>00175 
<a name="l00176"></a>00176   <span class="keyword">typedef</span> std::vector&lt;OffsetType&gt; OffsetVecType;
<a name="l00177"></a>00177   <span class="comment">// offset in the linear array.</span>
<a name="l00178"></a>00178   <span class="keyword">typedef</span> std::vector&lt;long&gt; OffsetDirectVecType;
<a name="l00179"></a>00179 
<a name="l00180"></a>00180   <span class="keywordtype">void</span> SetupOffsetVec(OffsetDirectVecType &amp;PosOffsets, OffsetVecType &amp;Offsets);
<a name="l00181"></a>00181 
<a name="l00182"></a>00182   <span class="keyword">class </span>GreyAndPos
<a name="l00183"></a>00183     {
<a name="l00184"></a>00184     <span class="keyword">public</span>:
<a name="l00185"></a>00185       <a class="code" href="namespaceHardConnectedComponentImageFilter.html#6e44b89d73d576fe68c175566a634ab8">InputPixelType</a> Val;
<a name="l00186"></a>00186       <span class="keywordtype">long</span> Pos;
<a name="l00187"></a>00187     };
<a name="l00188"></a>00188 
<a name="l00189"></a>00189   GreyAndPos *     m_SortPixels;
<a name="l00190"></a>00190   <span class="keywordtype">long</span> *           m_Parent;
<a name="l00191"></a>00191 <span class="preprocessor">#ifndef PAMI</span>
<a name="l00192"></a>00192 <span class="preprocessor"></span>  <span class="keywordtype">bool</span> *           m_Processed;
<a name="l00193"></a>00193 <span class="preprocessor">#endif</span>
<a name="l00194"></a>00194 <span class="preprocessor"></span>  <span class="comment">// This is a bit ugly, but I can't see an easy way around</span>
<a name="l00195"></a>00195   <a class="code" href="namespaceHardConnectedComponentImageFilter.html#6e44b89d73d576fe68c175566a634ab8">InputPixelType</a> * m_Raw;
<a name="l00196"></a>00196 
<a name="l00197"></a>00197   <span class="keyword">class </span>ComparePixStruct
<a name="l00198"></a>00198     {
<a name="l00199"></a>00199     <span class="keyword">public</span>:
<a name="l00200"></a>00200     TFunction m_TFunction;
<a name="l00201"></a>00201     <span class="keywordtype">bool</span> operator()(GreyAndPos <span class="keyword">const</span> &amp;l, GreyAndPos <span class="keyword">const</span> &amp;r)<span class="keyword"> const</span>
<a name="l00202"></a>00202 <span class="keyword">      </span>{
<a name="l00203"></a>00203       <span class="keywordflow">if</span> (m_TFunction(l.Val, r.Val))
<a name="l00204"></a>00204         {
<a name="l00205"></a>00205         <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00206"></a>00206         }
<a name="l00207"></a>00207       <span class="keywordflow">if</span> (l.Val == r.Val)
<a name="l00208"></a>00208         {
<a name="l00209"></a>00209         <span class="keywordflow">return</span> (l.Pos &lt; r.Pos);
<a name="l00210"></a>00210         }
<a name="l00211"></a>00211       <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00212"></a>00212       }
<a name="l00213"></a>00213     };
<a name="l00214"></a>00214 
<a name="l00215"></a>00215 <span class="preprocessor">#ifdef PAMI</span>
<a name="l00216"></a>00216 <span class="preprocessor"></span>  <span class="comment">// version from PAMI. Note - using the AuxData array rather than the</span>
<a name="l00217"></a>00217   <span class="comment">// parent array to store area</span>
<a name="l00218"></a>00218   <span class="keywordtype">void</span> MakeSet(<span class="keywordtype">long</span> x)
<a name="l00219"></a>00219     {
<a name="l00220"></a>00220     m_Parent[x] = ACTIVE;
<a name="l00221"></a>00221     m_AuxData[x] = m_AttributeValuePerPixel;
<a name="l00222"></a>00222     }
<a name="l00223"></a>00223 
<a name="l00224"></a>00224   <span class="keywordtype">long</span> FindRoot(<span class="keywordtype">long</span> x)
<a name="l00225"></a>00225     {
<a name="l00226"></a>00226     <span class="keywordflow">if</span> (m_Parent[x] &gt;= 0)
<a name="l00227"></a>00227       {
<a name="l00228"></a>00228       m_Parent[x] = FindRoot(m_Parent[x]);
<a name="l00229"></a>00229       <span class="keywordflow">return</span>(m_Parent[x]);
<a name="l00230"></a>00230       }
<a name="l00231"></a>00231     <span class="keywordflow">else</span>
<a name="l00232"></a>00232       {
<a name="l00233"></a>00233       <span class="keywordflow">return</span>(x);
<a name="l00234"></a>00234       }
<a name="l00235"></a>00235     }
<a name="l00236"></a>00236 
<a name="l00237"></a>00237   <span class="keywordtype">bool</span> Criterion(<span class="keywordtype">long</span> x, <span class="keywordtype">long</span> y)
<a name="l00238"></a>00238     {
<a name="l00239"></a>00239     <span class="keywordflow">return</span>((m_Raw[x] == m_Raw[y]) || (m_AuxData[x] &lt; m_Lambda));
<a name="l00240"></a>00240     }
<a name="l00241"></a>00241   
<a name="l00242"></a>00242   <span class="keywordtype">void</span> Union(<span class="keywordtype">long</span> n, <span class="keywordtype">long</span> p)
<a name="l00243"></a>00243     {
<a name="l00244"></a>00244     <span class="keywordtype">long</span> r = FindRoot(n);
<a name="l00245"></a>00245     <span class="keywordflow">if</span> (r != p)
<a name="l00246"></a>00246       {
<a name="l00247"></a>00247       <span class="keywordflow">if</span> (Criterion(r, p))
<a name="l00248"></a>00248         {
<a name="l00249"></a>00249         m_AuxData[p] += m_AuxData[r];
<a name="l00250"></a>00250         m_Parent[r] = p;
<a name="l00251"></a>00251         }
<a name="l00252"></a>00252       <span class="keywordflow">else</span> 
<a name="l00253"></a>00253         {
<a name="l00254"></a>00254         m_AuxData[p] = m_Lambda;
<a name="l00255"></a>00255         }
<a name="l00256"></a>00256       }
<a name="l00257"></a>00257     }
<a name="l00258"></a>00258 
<a name="l00259"></a>00259 <span class="preprocessor">#else</span>
<a name="l00260"></a>00260 <span class="preprocessor"></span>  <span class="comment">// version from ISMM paper</span>
<a name="l00261"></a>00261   <span class="keywordtype">void</span> MakeSet(<span class="keywordtype">long</span> x)
<a name="l00262"></a>00262     {
<a name="l00263"></a>00263     m_Parent[x] = ACTIVE;
<a name="l00264"></a>00264     m_AuxData[x] = m_AttributeValuePerPixel;
<a name="l00265"></a>00265     }
<a name="l00266"></a>00266 
<a name="l00267"></a>00267   <span class="keywordtype">void</span> Link(<span class="keywordtype">long</span> x, <span class="keywordtype">long</span> y)
<a name="l00268"></a>00268     {
<a name="l00269"></a>00269     <span class="keywordflow">if</span> ((m_Parent[y] == ACTIVE) &amp;&amp; (m_Parent[x] == ACTIVE))
<a name="l00270"></a>00270       {
<a name="l00271"></a>00271       <span class="comment">// should be a call to MergeAuxData</span>
<a name="l00272"></a>00272       m_AuxData[y] = m_AuxData[x] + m_AuxData[y];
<a name="l00273"></a>00273       m_AuxData[x] = -m_AttributeValuePerPixel;
<a name="l00274"></a>00274       }
<a name="l00275"></a>00275     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (m_Parent[x] == ACTIVE)
<a name="l00276"></a>00276       {
<a name="l00277"></a>00277       m_AuxData[x] = -m_AttributeValuePerPixel;
<a name="l00278"></a>00278       }
<a name="l00279"></a>00279     <span class="keywordflow">else</span>
<a name="l00280"></a>00280       {
<a name="l00281"></a>00281       m_AuxData[y] = -m_AttributeValuePerPixel;
<a name="l00282"></a>00282       m_Parent[y] = INACTIVE;
<a name="l00283"></a>00283       }
<a name="l00284"></a>00284     m_Parent[x] = y;
<a name="l00285"></a>00285     }
<a name="l00286"></a>00286 
<a name="l00287"></a>00287   <span class="keywordtype">long</span> FindRoot(<span class="keywordtype">long</span> x)
<a name="l00288"></a>00288     {
<a name="l00289"></a>00289     <span class="keywordflow">if</span> (m_Parent[x] &gt;= 0)
<a name="l00290"></a>00290       {
<a name="l00291"></a>00291       m_Parent[x] = FindRoot(m_Parent[x]);
<a name="l00292"></a>00292       <span class="keywordflow">return</span>(m_Parent[x]);
<a name="l00293"></a>00293       }
<a name="l00294"></a>00294     <span class="keywordflow">else</span>
<a name="l00295"></a>00295       {
<a name="l00296"></a>00296       <span class="keywordflow">return</span>(x);
<a name="l00297"></a>00297       }
<a name="l00298"></a>00298     }
<a name="l00299"></a>00299 
<a name="l00300"></a>00300   <span class="keywordtype">bool</span> Equiv(<span class="keywordtype">long</span> x, <span class="keywordtype">long</span> y)
<a name="l00301"></a>00301     {
<a name="l00302"></a>00302     <span class="keywordflow">return</span>((m_Raw[x] == m_Raw[y]) || (m_Parent[x] == ACTIVE));
<a name="l00303"></a>00303     }
<a name="l00304"></a>00304   
<a name="l00305"></a>00305   <span class="keywordtype">void</span> Union(<span class="keywordtype">long</span> n, <span class="keywordtype">long</span> p)
<a name="l00306"></a>00306     {
<a name="l00307"></a>00307     <span class="keywordtype">long</span> r = FindRoot(n);
<a name="l00308"></a>00308     <span class="keywordflow">if</span> (r != p)
<a name="l00309"></a>00309       {
<a name="l00310"></a>00310       <span class="keywordflow">if</span> (Equiv(r, p))
<a name="l00311"></a>00311         {
<a name="l00312"></a>00312         Link(r, p);
<a name="l00313"></a>00313         }
<a name="l00314"></a>00314       <span class="keywordflow">else</span> <span class="keywordflow">if</span> (m_Parent[p] == ACTIVE)
<a name="l00315"></a>00315         {
<a name="l00316"></a>00316         m_Parent[p] = INACTIVE;
<a name="l00317"></a>00317         m_AuxData[p] = -m_AttributeValuePerPixel;
<a name="l00318"></a>00318         }
<a name="l00319"></a>00319       }
<a name="l00320"></a>00320     }
<a name="l00321"></a>00321 <span class="preprocessor">#endif</span>
<a name="l00322"></a>00322 <span class="preprocessor"></span>};
<a name="l00323"></a>00323   
<a name="l00324"></a>00324 } <span class="comment">// end namespace itk</span>
<a name="l00325"></a>00325 
<a name="l00326"></a>00326 <span class="preprocessor">#ifndef ITK_MANUAL_INSTANTIATION</span>
<a name="l00327"></a>00327 <span class="preprocessor"></span><span class="preprocessor">#include "itkAttributeMorphologyBaseImageFilter.txx"</span>
<a name="l00328"></a>00328 <span class="preprocessor">#endif</span>
<a name="l00329"></a>00329 <span class="preprocessor"></span>
<a name="l00330"></a>00330 <span class="preprocessor">#endif</span>
<a name="l00331"></a>00331 <span class="preprocessor"></span>
</pre></div></div>
<hr><address><small>
Generated at Thu May 7 22:07:54 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>