freLevenbergMarquardtOptimizerController.cxx

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   F.R.E.E. - flexible registration evaluation engine
00004   Version:   v.1.0.0
00005   Date:      $Date: 2006/09/01 12:00:00 $
00006   Module:    $RCSfile: freLevenbergMarquardtOptimizerController.cxx,v $
00007   Language:  C++
00008 
00009 
00010 
00011   Copyright (c) 2007 Ralf o Floca (Department of Medical Informatics,
00012   Institute for Medical Biometry and Informatics, University of Heidelberg,
00013   Germany). All rights reserved.
00014   See FREECopyright.txt or http://www.mi.med.uni-hd.de/free/copyright.htm
00015   for details.
00016 
00017      This software is distributed WITHOUT ANY WARRANTY; without even 
00018      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00019      PURPOSE.  See the above copyright notices for more information.
00020 
00021 =========================================================================*/
00022 
00023 #include "freLevenbergMarquardtOptimizerController.h"
00024 #include "freExceptions.h"
00025 
00026 namespace FREE
00027 {
00028 
00032 
00033 
00034 LevenbergMarquardtOptimizerController::
00035 LevenbergMarquardtOptimizerController()
00036 {
00037   //Profile settings
00038   this->UpdateControllerID(ControllerID::LevenbergMarquardtOptimizerController);
00039   this->m_Description = "Optimizes by a Levenberg-Marquardt-optimizer approach.";
00040 };
00041 
00042 void
00043 LevenbergMarquardtOptimizerController::
00044 GenerateProfile(CtrlProfile::ControllerProfile& profile,
00045                 const SessionComponentCache* pComponentCache,
00046                 bool bRegardOldSetup) const
00047 {
00048   Superclass::GenerateProfile(profile,pComponentCache,bRegardOldSetup);
00049 
00050         //Parameters
00051   profile.Parameters().AddParameter(cParam_EpsilonFunction,CtrlProfile::Parameter::PVTDouble,cParamDsc_EpsilonFunction,1,"1e-11",-1,true);
00052   profile.Parameters().AddParameter(cParam_GradMagTolerance,CtrlProfile::Parameter::PVTDouble,cParamDsc_GradMagTolerance,1,"1e-5",-1,true);
00053   profile.Parameters().AddParameter(cParam_ValueTolerance,CtrlProfile::Parameter::PVTDouble,cParamDsc_ValueTolerance,1,"1e-8",-1,true);
00054   profile.Parameters().AddParameter(cParam_Iterations,Parameter::PVTInteger,cParamDsc_Iterations,1,"2000",-1,true);
00055 };
00056 
00057 void
00058 LevenbergMarquardtOptimizerController::
00059 ActualizeMainComponent(ComponentType* pMainComponent,
00060                        SessionComponentCache* pComponentCache, SessionInfo* pSessionInfo,
00061                                                                                          const unsigned int& iActLevel) const
00062 {
00063   Superclass::ActualizeMainComponent(pMainComponent, pComponentCache, pSessionInfo, iActLevel);
00064 
00065   int iNrOfIterations;
00066   double dValueTolerance;
00067   double dGradMagTolerance;
00068   double dEpsilonFunction;
00069 
00070   try
00071   {
00072     SessionAccessor::GetParameterValue(pComponentCache,cParam_Iterations,iNrOfIterations,0,iActLevel,true);
00073     SessionAccessor::GetParameterValue(pComponentCache,cParam_GradMagTolerance,dGradMagTolerance,0,iActLevel,true);
00074     SessionAccessor::GetParameterValue(pComponentCache,cParam_ValueTolerance,dValueTolerance,0,iActLevel,true);
00075     SessionAccessor::GetParameterValue(pComponentCache,cParam_EpsilonFunction,dEpsilonFunction,0,iActLevel,true);
00076   }
00077   catchAllNPassMacro("Error while retrieving parameter values.");
00078 
00079   ParameterArrayType scales = this->GetTransformScales(pComponentCache,iActLevel);
00080   pMainComponent->SetScales(scales);
00081   pMainComponent->SetNumberOfIterations(iNrOfIterations);
00082   pMainComponent->SetGradientTolerance(dGradMagTolerance);
00083   pMainComponent->SetValueTolerance(dValueTolerance);
00084   pMainComponent->SetEpsilonFunction(dEpsilonFunction);
00085 };
00086 
00087 
00088 } //end of namespace free

Generated at Sat Oct 13 16:25:07 2007 for f.r.e.e. - Flexible Registration and Evaluation Engine by doxygen 1.5.3 written by Dimitri van Heesch, © 1997-2000