ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkLevenbergMarquardtOptimizer.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkLevenbergMarquardtOptimizer_h
00019 #define __itkLevenbergMarquardtOptimizer_h
00020 
00021 #include "itkMultipleValuedNonLinearVnlOptimizer.h"
00022 #include "vnl/algo/vnl_levenberg_marquardt.h"
00023 
00024 namespace itk
00025 {
00032 class ITK_EXPORT LevenbergMarquardtOptimizer:
00033   public MultipleValuedNonLinearVnlOptimizer
00034 {
00035 public:
00037   typedef LevenbergMarquardtOptimizer         Self;
00038   typedef MultipleValuedNonLinearVnlOptimizer Superclass;
00039   typedef SmartPointer< Self >                Pointer;
00040   typedef SmartPointer< const Self >          ConstPointer;
00041 
00043   itkNewMacro(Self);
00044 
00046   itkTypeMacro(LevenbergMarquardtOptimizer, MultipleValuedNonLinearVnlOptimizer);
00047 
00049   typedef   vnl_vector< double > InternalParametersType;
00050 
00052   typedef   vnl_levenberg_marquardt InternalOptimizerType;
00053 
00055   vnl_levenberg_marquardt * GetOptimizer(void) const;
00056 
00058   void StartOptimization(void);
00059 
00061   virtual void SetCostFunction(MultipleValuedCostFunction *costFunction);
00062 
00063   void SetNumberOfIterations(unsigned int iterations);
00064 
00065   void SetValueTolerance(double tol);
00066 
00067   void SetGradientTolerance(double tol);
00068 
00069   void SetEpsilonFunction(double epsilon);
00070 
00072   MeasureType GetValue() const;
00073 
00074   const std::string GetStopConditionDescription() const;
00075 
00076 protected:
00077   LevenbergMarquardtOptimizer();
00078   virtual ~LevenbergMarquardtOptimizer();
00079 
00080   typedef Superclass::CostFunctionAdaptorType CostFunctionAdaptorType;
00081 private:
00082   LevenbergMarquardtOptimizer(const Self &); //purposely not implemented
00083   void operator=(const Self &);              //purposely not implemented
00084 
00085   bool                   m_OptimizerInitialized;
00086   InternalOptimizerType *m_VnlOptimizer;
00087   unsigned int           m_NumberOfIterations;
00088   double                 m_ValueTolerance;
00089   double                 m_GradientTolerance;
00090   double                 m_EpsilonFunction;
00091 };
00092 } // end namespace itk
00093 
00094 #endif
00095