00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkAmoebaOptimizer.h,v $ 00005 Language: C++ 00006 Date: $Date: 2005/03/07 20:39:31 $ 00007 Version: $Revision: 1.24 $ 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 ); 00089 00098 itkSetMacro(AutomaticInitialSimplex, bool); 00099 itkBooleanMacro(AutomaticInitialSimplex); 00100 itkGetMacro(AutomaticInitialSimplex, bool); 00101 00104 itkSetMacro(InitialSimplexDelta, ParametersType); 00105 itkGetMacro(InitialSimplexDelta, ParametersType); 00106 00115 virtual void SetParametersConvergenceTolerance( double tol ); 00116 itkGetMacro( ParametersConvergenceTolerance, double ); 00117 virtual void SetFunctionConvergenceTolerance( double tol ); 00118 itkGetMacro( FunctionConvergenceTolerance, double ); 00119 00121 MeasureType GetValue() const; 00122 00123 protected: 00124 AmoebaOptimizer(); 00125 virtual ~AmoebaOptimizer(); 00126 void PrintSelf(std::ostream& os, Indent indent) const; 00127 00128 typedef Superclass::CostFunctionAdaptorType CostFunctionAdaptorType; 00129 00130 private: 00131 AmoebaOptimizer(const Self&); //purposely not implemented 00132 void operator=(const Self&); //purposely not implemented 00133 00134 bool m_OptimizerInitialized; 00135 InternalOptimizerType * m_VnlOptimizer; 00136 unsigned int m_MaximumNumberOfIterations; 00137 double m_ParametersConvergenceTolerance; 00138 double m_FunctionConvergenceTolerance; 00139 00140 bool m_AutomaticInitialSimplex; 00141 ParametersType m_InitialSimplexDelta; 00142 }; 00143 00144 } // end namespace itk 00145 00146 00147 00148 #endif 00149 00150 00151