<!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: itkPowellOptimizer.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_2c33022d19e8077162952ea9ed57656d.html">Numerics</a> </div> <div class="contents"> <h1>itkPowellOptimizer.h</h1><a href="itkPowellOptimizer_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: itkPowellOptimizer.h,v $</span> <a name="l00005"></a>00005 <span class="comment"> Language: C++</span> <a name="l00006"></a>00006 <span class="comment"> Date: $Date: 2008-04-29 23:33:33 $</span> <a name="l00007"></a>00007 <span class="comment"> Version: $Revision: 1.11 $</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 __itkPowellOptimizer_h</span> <a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#define __itkPowellOptimizer_h</span> <a name="l00019"></a>00019 <span class="preprocessor"></span> <a name="l00020"></a>00020 <span class="preprocessor">#include <<a class="code" href="itkVector_8h.html">itkVector.h</a>></span> <a name="l00021"></a>00021 <span class="preprocessor">#include <<a class="code" href="itkMatrix_8h.html">itkMatrix.h</a>></span> <a name="l00022"></a>00022 <span class="preprocessor">#include <<a class="code" href="itkSingleValuedNonLinearOptimizer_8h.html">itkSingleValuedNonLinearOptimizer.h</a>></span> <a name="l00023"></a>00023 <a name="l00024"></a>00024 <span class="keyword">namespace </span>itk <a name="l00025"></a>00025 { <a name="l00026"></a>00026 <a name="l00060"></a><a class="code" href="classitk_1_1PowellOptimizer.html">00060</a> <span class="keyword">class </span><a class="code" href="itkWin32Header_8h.html#7d4384322557205d75f0719c012dded6">ITK_EXPORT</a> <a class="code" href="classitk_1_1PowellOptimizer.html" title="Implements Powell optimization using Brent line search.">PowellOptimizer</a>: <a name="l00061"></a>00061 <span class="keyword">public</span> <a class="code" href="classitk_1_1SingleValuedNonLinearOptimizer.html" title="This class is a base for the Optimization methods that optimize a single valued function...">SingleValuedNonLinearOptimizer</a> <a name="l00062"></a>00062 { <a name="l00063"></a>00063 <span class="keyword">public</span>: <a name="l00065"></a><a class="code" href="classitk_1_1PowellOptimizer.html#d8ec393e97ba857c467d39552d6131a3">00065</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1PowellOptimizer.html" title="Implements Powell optimization using Brent line search.">PowellOptimizer</a> <a class="code" href="classitk_1_1LightObject.html" title="Light weight base class for most itk classes.">Self</a>; <a name="l00066"></a><a class="code" href="classitk_1_1PowellOptimizer.html#65f53b5c3e63897e1240a3d2a468c809">00066</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1SingleValuedNonLinearOptimizer.html" title="This class is a base for the Optimization methods that optimize a single valued function...">SingleValuedNonLinearOptimizer</a> <a class="code" href="classitk_1_1LightObject.html" title="Light weight base class for most itk classes.">Superclass</a>; <a name="l00067"></a><a class="code" href="classitk_1_1PowellOptimizer.html#3a22817cf2a190154030e15473c2be3f">00067</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="l00068"></a><a class="code" href="classitk_1_1PowellOptimizer.html#21cacd8d4f473851c38873d2768f1f74">00068</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="l00069"></a>00069 <a name="l00070"></a>00070 <span class="keyword">typedef</span> <a class="code" href="classitk_1_1Array.html">SingleValuedNonLinearOptimizer::ParametersType</a> <a name="l00071"></a><a class="code" href="classitk_1_1PowellOptimizer.html#5be7f8220e73af71610231919043eec6">00071</a> <a class="code" href="classitk_1_1Array.html">ParametersType</a>; <a name="l00072"></a>00072 <a name="l00074"></a>00074 <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="l00075"></a>00075 <a name="l00077"></a><a class="code" href="classitk_1_1PowellOptimizer.html#2cf7d26d053f37de2808d58799d33a6b">00077</a> <a class="code" href="itkMacro_8h.html#574c1f86661d409dd32c742307a0e96a">itkTypeMacro</a>(<a class="code" href="classitk_1_1PowellOptimizer.html" title="Implements Powell optimization using Brent line search.">PowellOptimizer</a>, <a class="code" href="classitk_1_1SingleValuedNonLinearOptimizer.html" title="This class is a base for the Optimization methods that optimize a single valued function...">SingleValuedNonLinearOptimizer</a> ); <a name="l00078"></a>00078 <a name="l00080"></a>00080 <span class="keyword">typedef</span> <a class="code" href="classitk_1_1SingleValuedCostFunction.html" title="This class is a base for the CostFunctions returning a single value.">SingleValuedCostFunction</a> <a class="code" href="classitk_1_1SingleValuedCostFunction.html" title="This class is a base for the CostFunctions returning a single value.">CostFunctionType</a>; <a name="l00081"></a><a class="code" href="classitk_1_1PowellOptimizer.html#7144aec4d8bfe3dbedad433e4af382dc">00081</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1SmartPointer.html">CostFunctionType::Pointer</a> <a class="code" href="classitk_1_1SmartPointer.html">CostFunctionPointer</a>; <a name="l00082"></a>00082 <a name="l00084"></a>00084 <a class="code" href="itkMacro_8h.html#7ebdd33cc5e7d74720ced9099c034faa">itkSetMacro</a>( Maximize, <span class="keywordtype">bool</span> ); <a name="l00085"></a>00085 <a class="code" href="itkMacro_8h.html#7d989c13a1a213168db99ae0f84185d4">itkGetConstReferenceMacro</a>( Maximize, <span class="keywordtype">bool</span> ); <a name="l00087"></a>00087 <a name="l00089"></a>00089 <a class="code" href="itkMacro_8h.html#7ebdd33cc5e7d74720ced9099c034faa">itkSetMacro</a>( MaximumIteration, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> ); <a name="l00090"></a>00090 <a class="code" href="itkMacro_8h.html#7d989c13a1a213168db99ae0f84185d4">itkGetConstReferenceMacro</a>( MaximumIteration, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> ); <a name="l00092"></a>00092 <a name="l00094"></a>00094 <a class="code" href="itkMacro_8h.html#7ebdd33cc5e7d74720ced9099c034faa">itkSetMacro</a>(MaximumLineIteration, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>); <a name="l00095"></a>00095 <a class="code" href="itkMacro_8h.html#89294335d94b115d40e2603f2fff7950">itkGetConstMacro</a>(MaximumLineIteration, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>); <a name="l00097"></a>00097 <a name="l00100"></a>00100 <a class="code" href="itkMacro_8h.html#7ebdd33cc5e7d74720ced9099c034faa">itkSetMacro</a>( StepLength, <span class="keywordtype">double</span> ); <a name="l00101"></a>00101 <a class="code" href="itkMacro_8h.html#7d989c13a1a213168db99ae0f84185d4">itkGetConstReferenceMacro</a>( StepLength, <span class="keywordtype">double</span> ); <a name="l00103"></a>00103 <a name="l00106"></a>00106 <a class="code" href="itkMacro_8h.html#7ebdd33cc5e7d74720ced9099c034faa">itkSetMacro</a>( StepTolerance, <span class="keywordtype">double</span> ); <a name="l00107"></a>00107 <a class="code" href="itkMacro_8h.html#7d989c13a1a213168db99ae0f84185d4">itkGetConstReferenceMacro</a>( StepTolerance, <span class="keywordtype">double</span> ); <a name="l00109"></a>00109 <a name="l00113"></a>00113 <a class="code" href="itkMacro_8h.html#7ebdd33cc5e7d74720ced9099c034faa">itkSetMacro</a>( ValueTolerance, <span class="keywordtype">double</span> ); <a name="l00114"></a>00114 <a class="code" href="itkMacro_8h.html#7d989c13a1a213168db99ae0f84185d4">itkGetConstReferenceMacro</a>( ValueTolerance, <span class="keywordtype">double</span> ); <a name="l00116"></a>00116 <a name="l00118"></a>00118 <a class="code" href="itkMacro_8h.html#7d989c13a1a213168db99ae0f84185d4">itkGetConstReferenceMacro</a>( CurrentCost, MeasureType ); <a name="l00119"></a><a class="code" href="classitk_1_1PowellOptimizer.html#f29245b73cfbf0726ccd6ac8b8d20d7f">00119</a> MeasureType <a class="code" href="classitk_1_1PowellOptimizer.html#f29245b73cfbf0726ccd6ac8b8d20d7f">GetValue</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> this->GetCurrentCost(); } <a name="l00121"></a>00121 <a name="l00123"></a>00123 <a class="code" href="itkMacro_8h.html#7d989c13a1a213168db99ae0f84185d4">itkGetConstReferenceMacro</a>( CurrentIteration, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>); <a name="l00124"></a>00124 <a name="l00126"></a>00126 <a class="code" href="itkMacro_8h.html#7d989c13a1a213168db99ae0f84185d4">itkGetConstReferenceMacro</a>( CurrentLineIteration, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>); <a name="l00127"></a>00127 <a name="l00129"></a>00129 <span class="keywordtype">void</span> StartOptimization(); <a name="l00130"></a>00130 <a name="l00134"></a><a class="code" href="classitk_1_1PowellOptimizer.html#4116e4d808e01964348b7e34d3630cd4">00134</a> <span class="keywordtype">void</span> StopOptimization() <a name="l00135"></a>00135 { m_Stop = <span class="keyword">true</span>; } <a name="l00136"></a>00136 <a name="l00137"></a>00137 <a class="code" href="itkMacro_8h.html#1600305bb01e39e87c472d8bf29bd1cf">itkGetMacro</a>(CatchGetValueException, <span class="keywordtype">bool</span>); <a name="l00138"></a>00138 <a class="code" href="itkMacro_8h.html#7ebdd33cc5e7d74720ced9099c034faa">itkSetMacro</a>(CatchGetValueException, <span class="keywordtype">bool</span>); <a name="l00139"></a>00139 <a name="l00140"></a>00140 <a class="code" href="itkMacro_8h.html#1600305bb01e39e87c472d8bf29bd1cf">itkGetMacro</a>(MetricWorstPossibleValue, <span class="keywordtype">double</span>); <a name="l00141"></a>00141 <a class="code" href="itkMacro_8h.html#7ebdd33cc5e7d74720ced9099c034faa">itkSetMacro</a>(MetricWorstPossibleValue, <span class="keywordtype">double</span>); <a name="l00142"></a>00142 <a name="l00143"></a>00143 <a name="l00144"></a>00144 <span class="keyword">protected</span>: <a name="l00145"></a>00145 <a class="code" href="classitk_1_1PowellOptimizer.html" title="Implements Powell optimization using Brent line search.">PowellOptimizer</a>(); <a name="l00146"></a>00146 <a class="code" href="classitk_1_1PowellOptimizer.html" title="Implements Powell optimization using Brent line search.">PowellOptimizer</a>(<span class="keyword">const</span> <a class="code" href="classitk_1_1PowellOptimizer.html" title="Implements Powell optimization using Brent line search.">PowellOptimizer</a>&); <a name="l00147"></a>00147 <span class="keyword">virtual</span> ~<a class="code" href="classitk_1_1PowellOptimizer.html" title="Implements Powell optimization using Brent line search.">PowellOptimizer</a>(); <a name="l00148"></a>00148 <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="l00149"></a>00149 <a name="l00150"></a>00150 <a class="code" href="itkMacro_8h.html#7ebdd33cc5e7d74720ced9099c034faa">itkSetMacro</a>(CurrentCost, <span class="keywordtype">double</span>); <a name="l00151"></a>00151 <a name="l00154"></a>00154 <span class="keywordtype">void</span> SetLine(<span class="keyword">const</span> ParametersType & origin, <a name="l00155"></a>00155 <span class="keyword">const</span> <a class="code" href="classvnl__vector.html">vnl_vector<double></a> & direction); <a name="l00156"></a>00156 <a name="l00160"></a>00160 <span class="keywordtype">double</span> GetLineValue(<span class="keywordtype">double</span> x) <span class="keyword">const</span>; <a name="l00161"></a>00161 <a name="l00162"></a>00162 <span class="keywordtype">double</span> GetLineValue(<span class="keywordtype">double</span> x, ParametersType & tempCoord) <span class="keyword">const</span>; <a name="l00163"></a>00163 <a name="l00166"></a>00166 <span class="keywordtype">void</span> SetCurrentLinePoint(<span class="keywordtype">double</span> x, <span class="keywordtype">double</span> fx); <a name="l00167"></a>00167 <a name="l00170"></a>00170 <span class="keywordtype">void</span> Swap(<span class="keywordtype">double</span> *a, <span class="keywordtype">double</span> *b) <span class="keyword">const</span>; <a name="l00171"></a>00171 <a name="l00174"></a>00174 <span class="keywordtype">void</span> Shift(<span class="keywordtype">double</span> *a, <span class="keywordtype">double</span> *b, <span class="keywordtype">double</span> *c, <span class="keywordtype">double</span> d) <span class="keyword">const</span>; <a name="l00175"></a>00175 <a name="l00185"></a>00185 <span class="keyword">virtual</span> <span class="keywordtype">void</span> LineBracket(<span class="keywordtype">double</span> *ax, <span class="keywordtype">double</span> *bx, <span class="keywordtype">double</span> *cx, <a name="l00186"></a>00186 <span class="keywordtype">double</span> *fa, <span class="keywordtype">double</span> *fb, <span class="keywordtype">double</span> *fc); <a name="l00187"></a>00187 <a name="l00188"></a>00188 <span class="keyword">virtual</span> <span class="keywordtype">void</span> LineBracket(<span class="keywordtype">double</span> *ax, <span class="keywordtype">double</span> *bx, <span class="keywordtype">double</span> *cx, <a name="l00189"></a>00189 <span class="keywordtype">double</span> *fa, <span class="keywordtype">double</span> *fb, <span class="keywordtype">double</span> *fc, <a name="l00190"></a>00190 ParametersType & tempCoord); <a name="l00191"></a>00191 <a name="l00197"></a>00197 <span class="keyword">virtual</span> <span class="keywordtype">void</span> BracketedLineOptimize(<span class="keywordtype">double</span> ax, <span class="keywordtype">double</span> bx, <span class="keywordtype">double</span> cx, <a name="l00198"></a>00198 <span class="keywordtype">double</span> fa, <span class="keywordtype">double</span> fb, <span class="keywordtype">double</span> fc, <a name="l00199"></a>00199 <span class="keywordtype">double</span> * extX, <span class="keywordtype">double</span> * extVal); <a name="l00200"></a>00200 <a name="l00201"></a>00201 <span class="keyword">virtual</span> <span class="keywordtype">void</span> BracketedLineOptimize(<span class="keywordtype">double</span> ax, <span class="keywordtype">double</span> bx, <span class="keywordtype">double</span> cx, <a name="l00202"></a>00202 <span class="keywordtype">double</span> fa, <span class="keywordtype">double</span> fb, <span class="keywordtype">double</span> fc, <a name="l00203"></a>00203 <span class="keywordtype">double</span> * extX, <span class="keywordtype">double</span> * extVal, <a name="l00204"></a>00204 ParametersType & tempCoord); <a name="l00205"></a>00205 <a name="l00206"></a>00206 <a class="code" href="itkMacro_8h.html#1600305bb01e39e87c472d8bf29bd1cf">itkGetMacro</a>(SpaceDimension, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>); <a name="l00207"></a><a class="code" href="classitk_1_1PowellOptimizer.html#07e8bb5f0aac58ef79faa34764d7b047">00207</a> <span class="keywordtype">void</span> SetSpaceDimension( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> dim ) <a name="l00208"></a>00208 { <a name="l00209"></a>00209 this->m_SpaceDimension = dim; <a name="l00210"></a>00210 this->m_LineDirection.set_size( dim ); <a name="l00211"></a>00211 this->m_LineOrigin.set_size( dim ); <a name="l00212"></a>00212 this->m_CurrentPosition.set_size( dim ); <a name="l00213"></a>00213 this->Modified(); <a name="l00214"></a>00214 } <a name="l00215"></a>00215 <a name="l00216"></a>00216 <a class="code" href="itkMacro_8h.html#7ebdd33cc5e7d74720ced9099c034faa">itkSetMacro</a>(CurrentIteration, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>); <a name="l00217"></a>00217 <a name="l00218"></a>00218 <a class="code" href="itkMacro_8h.html#1600305bb01e39e87c472d8bf29bd1cf">itkGetMacro</a>(Stop, <span class="keywordtype">bool</span>); <a name="l00219"></a>00219 <a class="code" href="itkMacro_8h.html#7ebdd33cc5e7d74720ced9099c034faa">itkSetMacro</a>(Stop, <span class="keywordtype">bool</span>); <a name="l00220"></a>00220 <a name="l00221"></a>00221 <span class="keyword">private</span>: <a name="l00222"></a>00222 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> m_SpaceDimension; <a name="l00223"></a>00223 <a name="l00225"></a>00225 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> m_CurrentIteration; <a name="l00226"></a>00226 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> m_CurrentLineIteration; <a name="l00227"></a>00227 <a name="l00229"></a>00229 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> m_MaximumIteration; <a name="l00230"></a>00230 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> m_MaximumLineIteration; <a name="l00231"></a>00231 <a name="l00232"></a>00232 <span class="keywordtype">bool</span> m_CatchGetValueException; <a name="l00233"></a>00233 <span class="keywordtype">double</span> m_MetricWorstPossibleValue; <a name="l00234"></a>00234 <a name="l00236"></a>00236 <span class="keywordtype">bool</span> m_Maximize; <a name="l00237"></a>00237 <a name="l00239"></a>00239 <span class="keywordtype">double</span> m_StepLength; <a name="l00240"></a>00240 <span class="keywordtype">double</span> m_StepTolerance; <a name="l00241"></a>00241 <a name="l00242"></a>00242 ParametersType m_LineOrigin; <a name="l00243"></a>00243 <a class="code" href="classvnl__vector.html">vnl_vector<double></a> m_LineDirection; <a name="l00244"></a>00244 <a name="l00245"></a>00245 <span class="keywordtype">double</span> m_ValueTolerance; <a name="l00246"></a>00246 <a name="l00248"></a>00248 MeasureType m_CurrentCost; <a name="l00249"></a>00249 <a name="l00254"></a>00254 <span class="keywordtype">bool</span> m_Stop; <a name="l00255"></a>00255 <a name="l00256"></a>00256 }; <span class="comment">// end of class</span> <a name="l00257"></a>00257 <a name="l00258"></a>00258 } <span class="comment">// end of namespace itk</span> <a name="l00259"></a>00259 <a name="l00260"></a>00260 <span class="preprocessor">#endif</span> <a name="l00261"></a>00261 <span class="preprocessor"></span> </pre></div></div> <hr><address><small> Generated at Thu May 7 23:53:02 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>