00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkConjugateGradientOptimizer.h,v $ 00005 Language: C++ 00006 Date: $Date: 2005/05/17 00:06:29 $ 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 __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; 00066 00068 MeasureType GetValue() const; 00069 00070 protected: 00071 ConjugateGradientOptimizer(); 00072 virtual ~ConjugateGradientOptimizer(); 00073 00074 typedef Superclass::CostFunctionAdaptorType CostFunctionAdaptorType; 00075 00076 private: 00077 ConjugateGradientOptimizer(const Self&); //purposely not implemented 00078 void operator=(const Self&); //purposely not implemented 00079 00081 bool m_OptimizerInitialized; 00082 InternalOptimizerType * m_VnlOptimizer; 00083 00084 }; 00085 00086 } // end namespace itk 00087 00088 00089 #endif 00090 00091 00092