00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkAmoebaOptimizer.h,v $ 00005 Language: C++ 00006 Date: $Date: 2009-06-24 12:02:50 $ 00007 Version: $Revision: 1.26 $ 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 itkGetConstMacro( MaximumNumberOfIterations, unsigned int ); 00090 00099 itkSetMacro(AutomaticInitialSimplex, bool); 00100 itkBooleanMacro(AutomaticInitialSimplex); 00101 itkGetConstMacro(AutomaticInitialSimplex, bool); 00103 00106 itkSetMacro(InitialSimplexDelta, ParametersType); 00107 itkGetConstMacro(InitialSimplexDelta, ParametersType); 00109 00118 virtual void SetParametersConvergenceTolerance( double tol ); 00119 itkGetConstMacro( ParametersConvergenceTolerance, double ); 00120 virtual void SetFunctionConvergenceTolerance( double tol ); 00121 itkGetConstMacro( FunctionConvergenceTolerance, double ); 00123 00125 const std::string GetStopConditionDescription() const; 00126 00128 MeasureType GetValue() const; 00129 00130 protected: 00131 AmoebaOptimizer(); 00132 virtual ~AmoebaOptimizer(); 00133 void PrintSelf(std::ostream& os, Indent indent) const; 00134 00135 typedef Superclass::CostFunctionAdaptorType CostFunctionAdaptorType; 00136 00137 private: 00138 AmoebaOptimizer(const Self&); //purposely not implemented 00139 void operator=(const Self&); //purposely not implemented 00140 00141 bool m_OptimizerInitialized; 00142 InternalOptimizerType * m_VnlOptimizer; 00143 unsigned int m_MaximumNumberOfIterations; 00144 double m_ParametersConvergenceTolerance; 00145 double m_FunctionConvergenceTolerance; 00146 00147 bool m_AutomaticInitialSimplex; 00148 ParametersType m_InitialSimplexDelta; 00149 00150 OStringStream m_StopConditionDescription; 00151 }; 00152 00153 } // end namespace itk 00154 00155 #endif 00156