Sophie

Sophie

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

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: itkCompositeValleyFunction.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>
  </div>
<div class="contents">
<h1>itkCompositeValleyFunction.h</h1><a href="itkCompositeValleyFunction_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: itkCompositeValleyFunction.h,v $</span>
<a name="l00005"></a>00005 <span class="comment">  Language:  C++</span>
<a name="l00006"></a>00006 <span class="comment">  Date:      $Date: 2007-03-22 14:29:13 $</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 __itkCompositeValleyFunction_h</span>
<a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#define __itkCompositeValleyFunction_h</span>
<a name="l00019"></a>00019 <span class="preprocessor"></span>
<a name="l00020"></a>00020 <span class="preprocessor">#include "<a class="code" href="itkArray_8h.html">itkArray.h</a>"</span>
<a name="l00021"></a>00021 <span class="preprocessor">#include "<a class="code" href="itkCacheableScalarFunction_8h.html">itkCacheableScalarFunction.h</a>"</span>
<a name="l00022"></a>00022 <span class="preprocessor">#include &lt;vector&gt;</span>
<a name="l00023"></a>00023 
<a name="l00024"></a>00024 <span class="keyword">namespace </span>itk {
<a name="l00025"></a>00025 
<a name="l00071"></a><a class="code" href="classitk_1_1TargetClass.html">00071</a> <span class="keyword">class </span><a class="code" href="classitk_1_1TargetClass.html">TargetClass</a>
<a name="l00072"></a>00072 {
<a name="l00073"></a>00073 <span class="keyword">public</span>:
<a name="l00075"></a><a class="code" href="classitk_1_1TargetClass.html#ca3b691a590706ded690921cd037b3a4">00075</a>   <a class="code" href="classitk_1_1TargetClass.html#ca3b691a590706ded690921cd037b3a4">TargetClass</a>(<span class="keywordtype">double</span> mean, <span class="keywordtype">double</span> sigma) 
<a name="l00076"></a>00076     { 
<a name="l00077"></a>00077     m_Mean = mean;
<a name="l00078"></a>00078     m_Sigma = sigma;
<a name="l00079"></a>00079     }
<a name="l00080"></a>00080 
<a name="l00082"></a><a class="code" href="classitk_1_1TargetClass.html#b27c16835c3bec2a8b51bfacfce5959e">00082</a>   <span class="keywordtype">void</span> <a class="code" href="classitk_1_1TargetClass.html#b27c16835c3bec2a8b51bfacfce5959e">SetMean</a>(<span class="keywordtype">double</span> mean) { m_Mean = mean; }  
<a name="l00083"></a><a class="code" href="classitk_1_1TargetClass.html#2b0d704a8c3fbec74f4dc9dc62d03586">00083</a>   <span class="keywordtype">double</span> <a class="code" href="classitk_1_1TargetClass.html#2b0d704a8c3fbec74f4dc9dc62d03586">GetMean</a>() { <span class="keywordflow">return</span> m_Mean; } 
<a name="l00085"></a>00085 
<a name="l00087"></a><a class="code" href="classitk_1_1TargetClass.html#277076b9a70536378c7967fa46c37edb">00087</a>   <span class="keywordtype">void</span> <a class="code" href="classitk_1_1TargetClass.html#277076b9a70536378c7967fa46c37edb">SetSigma</a>(<span class="keywordtype">double</span> sigma) { m_Sigma = sigma; }
<a name="l00088"></a><a class="code" href="classitk_1_1TargetClass.html#cc54c3df03a4ad0a6a84d83c0860e03c">00088</a>   <span class="keywordtype">double</span> <a class="code" href="classitk_1_1TargetClass.html#cc54c3df03a4ad0a6a84d83c0860e03c">GetSigma</a>() { <span class="keywordflow">return</span> m_Sigma; }
<a name="l00090"></a>00090 
<a name="l00091"></a>00091 <span class="keyword">private</span>:
<a name="l00092"></a>00092   <span class="keywordtype">double</span> m_Mean;
<a name="l00093"></a>00093   <span class="keywordtype">double</span> m_Sigma;
<a name="l00094"></a>00094 }; <span class="comment">// end of class </span>
<a name="l00095"></a>00095 
<a name="l00096"></a><a class="code" href="classitk_1_1CompositeValleyFunction.html">00096</a> <span class="keyword">class </span><a class="code" href="classitk_1_1CompositeValleyFunction.html" title="Multiple valley shaped curve function.">CompositeValleyFunction</a> : <span class="keyword">public</span> <a class="code" href="classitk_1_1CacheableScalarFunction.html" title="function cache implementation">CacheableScalarFunction</a>
<a name="l00097"></a>00097 {
<a name="l00098"></a>00098 <span class="keyword">public</span>:
<a name="l00099"></a>00099 
<a name="l00101"></a><a class="code" href="classitk_1_1CompositeValleyFunction.html#75a61fed2b15cd9afcf5145417e7ac3b">00101</a>   <span class="keyword">typedef</span> <a class="code" href="classitk_1_1CacheableScalarFunction.html" title="function cache implementation">CacheableScalarFunction</a> <a class="code" href="classitk_1_1CacheableScalarFunction.html" title="function cache implementation">Superclass</a>;
<a name="l00102"></a>00102 
<a name="l00104"></a><a class="code" href="classitk_1_1CompositeValleyFunction.html#ebef7c7dec580890bca3d22149ee4751">00104</a>   <span class="keyword">typedef</span>  <a class="code" href="classitk_1_1CacheableScalarFunction.html#3e6333600aacf7275e6e0311cbedbdb6">Superclass::MeasureType</a>          <a class="code" href="classitk_1_1CompositeValleyFunction.html#ebef7c7dec580890bca3d22149ee4751">MeasureType</a>;
<a name="l00105"></a><a class="code" href="classitk_1_1CompositeValleyFunction.html#0121eac6e8bebe212574930b0342013a">00105</a>   <span class="keyword">typedef</span>  <a class="code" href="classitk_1_1Array.html">Superclass::MeasureArrayType</a>     <a class="code" href="classitk_1_1Array.html">MeasureArrayType</a>;
<a name="l00106"></a>00106 
<a name="l00108"></a>00108   <a class="code" href="classitk_1_1CompositeValleyFunction.html#2deb077c2428318ff0156fc1e1325e07">CompositeValleyFunction</a>( <span class="keyword">const</span> <a class="code" href="classitk_1_1Array.html">MeasureArrayType</a> &amp; classMeans, 
<a name="l00109"></a>00109                            <span class="keyword">const</span> <a class="code" href="classitk_1_1Array.html">MeasureArrayType</a> &amp; classSigmas );
<a name="l00110"></a>00110 
<a name="l00112"></a><a class="code" href="classitk_1_1CompositeValleyFunction.html#ba6f7635e90e469fcaf7ecd4643dba2b">00112</a>   <span class="keyword">virtual</span> <a class="code" href="classitk_1_1CompositeValleyFunction.html#ba6f7635e90e469fcaf7ecd4643dba2b">~CompositeValleyFunction</a>() {}
<a name="l00113"></a>00113 
<a name="l00115"></a><a class="code" href="classitk_1_1CompositeValleyFunction.html#4b66cedc2bc4dcc6c2c93cd5600563a1">00115</a>   <span class="keywordtype">double</span> <a class="code" href="classitk_1_1CompositeValleyFunction.html#4b66cedc2bc4dcc6c2c93cd5600563a1">GetUpperBound</a>() { <span class="keywordflow">return</span> m_UpperBound; }
<a name="l00116"></a>00116 
<a name="l00118"></a><a class="code" href="classitk_1_1CompositeValleyFunction.html#ed178340535ea8ad7ec6538042b591f4">00118</a>   <span class="keywordtype">double</span> <a class="code" href="classitk_1_1CompositeValleyFunction.html#ed178340535ea8ad7ec6538042b591f4">GetLowerBound</a>() { <span class="keywordflow">return</span> m_LowerBound; }
<a name="l00119"></a>00119 
<a name="l00122"></a><a class="code" href="classitk_1_1CompositeValleyFunction.html#67f3c97956b625b5bef85f819c2e8e84">00122</a>   <a class="code" href="classitk_1_1CompositeValleyFunction.html#ebef7c7dec580890bca3d22149ee4751">MeasureType</a> <a class="code" href="classitk_1_1CompositeValleyFunction.html#67f3c97956b625b5bef85f819c2e8e84">operator() </a>(<a class="code" href="classitk_1_1CompositeValleyFunction.html#ebef7c7dec580890bca3d22149ee4751">MeasureType</a> x)
<a name="l00123"></a>00123     {
<a name="l00124"></a>00124     <span class="keywordflow">if</span> (x &gt; m_UpperBound || x &lt; m_LowerBound)
<a name="l00125"></a>00125       {
<a name="l00126"></a>00126       <span class="keywordflow">return</span> 1;
<a name="l00127"></a>00127       }
<a name="l00128"></a>00128 
<a name="l00129"></a>00129     <span class="keywordflow">if</span> (!this-&gt;<a class="code" href="classitk_1_1CacheableScalarFunction.html#6d08a844aad2210ad812989586ec3d5b">IsCacheAvailable</a>()) 
<a name="l00130"></a>00130       {
<a name="l00131"></a>00131       <span class="keywordflow">return</span> this-&gt;<a class="code" href="classitk_1_1CompositeValleyFunction.html#10d0e29980ed7e24d5a905aabe187758">Evaluate</a>(x);
<a name="l00132"></a>00132       } 
<a name="l00133"></a>00133     <span class="keywordflow">else</span> 
<a name="l00134"></a>00134       {
<a name="l00135"></a>00135       <span class="keywordflow">return</span> <a class="code" href="classitk_1_1CacheableScalarFunction.html#4ae0a32e403ff42f78565fd1f38a4de3">GetCachedValue</a>(x);
<a name="l00136"></a>00136       }
<a name="l00137"></a>00137     }
<a name="l00138"></a>00138 
<a name="l00140"></a><a class="code" href="classitk_1_1CompositeValleyFunction.html#10d0e29980ed7e24d5a905aabe187758">00140</a>   <span class="keyword">inline</span> <a class="code" href="classitk_1_1CompositeValleyFunction.html#ebef7c7dec580890bca3d22149ee4751">MeasureType</a> <a class="code" href="classitk_1_1CompositeValleyFunction.html#10d0e29980ed7e24d5a905aabe187758">Evaluate</a>(<a class="code" href="classitk_1_1CompositeValleyFunction.html#ebef7c7dec580890bca3d22149ee4751">MeasureType</a> x) 
<a name="l00141"></a>00141     {
<a name="l00142"></a>00142     <a class="code" href="classitk_1_1CompositeValleyFunction.html#ebef7c7dec580890bca3d22149ee4751">MeasureType</a> res = 1;
<a name="l00143"></a>00143 
<a name="l00144"></a>00144     <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> k = 0; k &lt; m_Targets.size(); k++)
<a name="l00145"></a>00145       {
<a name="l00146"></a>00146       res *= <a class="code" href="classitk_1_1CompositeValleyFunction.html#fb6e3415f934e8841b439122baa54d1a">valley</a>( ( x - m_Targets[k].GetMean() ) /
<a name="l00147"></a>00147                      m_Targets[k].GetSigma() );
<a name="l00148"></a>00148       }
<a name="l00149"></a>00149     
<a name="l00150"></a>00150     <span class="keywordflow">return</span> res;
<a name="l00151"></a>00151     }   
<a name="l00152"></a>00152 
<a name="l00154"></a><a class="code" href="classitk_1_1CompositeValleyFunction.html#fb6e3415f934e8841b439122baa54d1a">00154</a>   <span class="keyword">inline</span> <a class="code" href="classitk_1_1CompositeValleyFunction.html#ebef7c7dec580890bca3d22149ee4751">MeasureType</a> <a class="code" href="classitk_1_1CompositeValleyFunction.html#fb6e3415f934e8841b439122baa54d1a">valley</a>(<a class="code" href="classitk_1_1CompositeValleyFunction.html#ebef7c7dec580890bca3d22149ee4751">MeasureType</a> d) 
<a name="l00155"></a>00155     {
<a name="l00156"></a>00156     <span class="keywordflow">return</span> 1 - 1 / (1+d*d/3);
<a name="l00157"></a>00157     }
<a name="l00158"></a>00158 
<a name="l00159"></a>00159 <span class="keyword">protected</span>:
<a name="l00160"></a><a class="code" href="classitk_1_1CompositeValleyFunction.html#b7ff2d0e740c535936bf975996706560">00160</a>   <span class="keywordtype">void</span> <a class="code" href="classitk_1_1CompositeValleyFunction.html#b7ff2d0e740c535936bf975996706560">AddNewClass</a>(<span class="keywordtype">double</span> mean, <span class="keywordtype">double</span> sigma)
<a name="l00161"></a>00161   {
<a name="l00162"></a>00162     <a class="code" href="classitk_1_1TargetClass.html">TargetClass</a> aClass(mean, sigma);
<a name="l00163"></a>00163     m_Targets.push_back(aClass);
<a name="l00164"></a>00164   }
<a name="l00165"></a>00165 
<a name="l00167"></a>00167   <span class="keywordtype">void</span> <a class="code" href="classitk_1_1CompositeValleyFunction.html#69aef5d9530beab3108a944a844bafbd">Initialize</a>();
<a name="l00168"></a>00168 
<a name="l00169"></a>00169 <span class="keyword">private</span>:
<a name="l00171"></a>00171   std::vector&lt;TargetClass&gt; m_Targets;  
<a name="l00172"></a>00172 
<a name="l00175"></a>00175   <span class="keywordtype">double</span> m_UpperBound;
<a name="l00176"></a>00176 
<a name="l00179"></a>00179   <span class="keywordtype">double</span> m_LowerBound;
<a name="l00180"></a>00180 
<a name="l00181"></a>00181 }; <span class="comment">// end of class</span>
<a name="l00182"></a>00182 
<a name="l00183"></a>00183 } <span class="comment">// end of namespace itk</span>
<a name="l00184"></a>00184 <span class="preprocessor">#endif</span>
<a name="l00185"></a>00185 <span class="preprocessor"></span>
</pre></div></div>
<hr><address><small>
Generated at Thu May 7 22:26:30 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>