00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkConjugateGradientOptimizer.h,v $ 00005 Language: C++ 00006 Date: $Date: 2002/04/20 17:14:02 $ 00007 Version: $Revision: 1.22 $ 00008 00009 Copyright (c) 2002 Insight 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 00067 00068 protected: 00069 ConjugateGradientOptimizer(); 00070 virtual ~ConjugateGradientOptimizer(); 00071 00072 typedef Superclass::CostFunctionAdaptorType CostFunctionAdaptorType; 00073 00074 private: 00075 ConjugateGradientOptimizer(const Self&); //purposely not implemented 00076 void operator=(const Self&); //purposely not implemented 00077 00079 bool m_OptimizerInitialized; 00080 InternalOptimizerType * m_VnlOptimizer; 00081 00082 }; 00083 00084 } // end namespace itk 00085 00086 00087 #endif 00088 00089 00090