00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkConjugateGradientOptimizer.h,v $ 00005 Language: C++ 00006 Date: $Date: 2007-03-22 14:29:13 $ 00007 Version: $Revision: 1.27 $ 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 __itkConjugateGradientOptimizer_h 00018 #define __itkConjugateGradientOptimizer_h 00019 00020 #include "itkSingleValuedNonLinearVnlOptimizer.h" 00021 #include "vnl/algo/vnl_conjugate_gradient.h" 00022 00023 namespace itk 00024 { 00025 00031 class ITK_EXPORT ConjugateGradientOptimizer : 00032 public SingleValuedNonLinearVnlOptimizer 00033 00034 { 00035 public: 00037 typedef ConjugateGradientOptimizer Self; 00038 typedef SingleValuedNonLinearVnlOptimizer Superclass; 00039 typedef SmartPointer<Self> Pointer; 00040 typedef SmartPointer<const Self> ConstPointer; 00041 00043 itkNewMacro(Self); 00044 00046 itkTypeMacro( ConjugateGradientOptimizer, SingleValuedNonLinearOptimizer ); 00047 00049 typedef vnl_vector<double> InternalParametersType; 00050 00052 typedef vnl_conjugate_gradient InternalOptimizerType; 00053 00055 vnl_conjugate_gradient * GetOptimizer(void); 00056 00058 void StartOptimization( void ); 00059 00061 virtual void SetCostFunction( SingleValuedCostFunction * costFunction ); 00062 00064 unsigned long GetNumberOfIterations(void) const; 00065 unsigned long GetCurrentIteration(void) const; 00067 00069 MeasureType GetValue() const; 00070 00071 protected: 00072 ConjugateGradientOptimizer(); 00073 virtual ~ConjugateGradientOptimizer(); 00074 00075 typedef Superclass::CostFunctionAdaptorType CostFunctionAdaptorType; 00076 00077 private: 00078 ConjugateGradientOptimizer(const Self&); //purposely not implemented 00079 void operator=(const Self&); //purposely not implemented 00080 00082 bool m_OptimizerInitialized; 00083 InternalOptimizerType * m_VnlOptimizer; 00084 00085 }; 00086 00087 } // end namespace itk 00088 00089 00090 #endif 00091