00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkAmoebaOptimizer.h,v $ 00005 Language: C++ 00006 Date: $Date: 2007-03-22 14:29:13 $ 00007 Version: $Revision: 1.25 $ 00008 00009 Copyright (c) Insight Software Consortium. All rights reserved. 00010 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 #ifndef __itkAmoebaOptimizer_h 00018 #define __itkAmoebaOptimizer_h 00019 00020 #include "itkSingleValuedNonLinearVnlOptimizer.h" 00021 #include "vnl/algo/vnl_amoeba.h" 00022 00023 namespace itk 00024 { 00025 00049 class ITK_EXPORT AmoebaOptimizer : 00050 public SingleValuedNonLinearVnlOptimizer 00051 { 00052 public: 00054 typedef AmoebaOptimizer Self; 00055 typedef SingleValuedNonLinearVnlOptimizer Superclass; 00056 typedef SmartPointer<Self> Pointer; 00057 typedef SmartPointer<const Self> ConstPointer; 00058 00060 itkNewMacro(Self); 00061 00063 itkTypeMacro( AmoebaOptimizer, SingleValuedNonLinearVnlOptimizer ); 00064 00067 typedef Superclass::ParametersType ParametersType; 00068 00070 typedef vnl_vector<double> InternalParametersType; 00071 00073 typedef vnl_amoeba InternalOptimizerType; 00074 00076 vnl_amoeba * GetOptimizer(void); 00077 00079 void StartOptimization( void ); 00080 00082 virtual void SetCostFunction( SingleValuedCostFunction * costFunction ); 00083 00087 virtual void SetMaximumNumberOfIterations( unsigned int n ); 00088 itkGetMacro( MaximumNumberOfIterations, unsigned int ); 00090 00099 itkSetMacro(AutomaticInitialSimplex, bool); 00100 itkBooleanMacro(AutomaticInitialSimplex); 00101 itkGetMacro(AutomaticInitialSimplex, bool); 00103 00106 itkSetMacro(InitialSimplexDelta, ParametersType); 00107 itkGetMacro(InitialSimplexDelta, ParametersType); 00109 00118 virtual void SetParametersConvergenceTolerance( double tol ); 00119 itkGetMacro( ParametersConvergenceTolerance, double ); 00120 virtual void SetFunctionConvergenceTolerance( double tol ); 00121 itkGetMacro( FunctionConvergenceTolerance, double ); 00123 00125 MeasureType GetValue() const; 00126 00127 protected: 00128 AmoebaOptimizer(); 00129 virtual ~AmoebaOptimizer(); 00130 void PrintSelf(std::ostream& os, Indent indent) const; 00131 00132 typedef Superclass::CostFunctionAdaptorType CostFunctionAdaptorType; 00133 00134 private: 00135 AmoebaOptimizer(const Self&); //purposely not implemented 00136 void operator=(const Self&); //purposely not implemented 00137 00138 bool m_OptimizerInitialized; 00139 InternalOptimizerType * m_VnlOptimizer; 00140 unsigned int m_MaximumNumberOfIterations; 00141 double m_ParametersConvergenceTolerance; 00142 double m_FunctionConvergenceTolerance; 00143 00144 bool m_AutomaticInitialSimplex; 00145 ParametersType m_InitialSimplexDelta; 00146 }; 00147 00148 } // end namespace itk 00149 00150 #endif 00151