freSetupOptimizationMetricControllerBase.txx

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: freSetupOptimizationMetricControllerBase.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 #ifndef __freSetupOptimizationMetricControllerBase_txx
00024 #define __freSetupOptimizationMetricControllerBase_txx
00025 
00026 #include "freSetupOptimizationMetricControllerBase.h"
00027 
00028 namespace FREE
00029 {
00030 
00031 
00035 
00036 
00037 
00038 template <class TControlledMetric>
00039 const char* const SetupOptimizationMetricControllerBase<TControlledMetric>::cParam_MetricScales = "MetricScales";
00040 template <class TControlledMetric>
00041 const char* const SetupOptimizationMetricControllerBase<TControlledMetric>::cParamDsc_MetricScales = "Scaling for each metric value to weighten their influence on the optimization.";
00042 
00043 template <class TControlledMetric>
00044 SetupOptimizationMetricControllerBase<TControlledMetric>::
00045 SetupOptimizationMetricControllerBase():ComponentControllerBase<TControlledMetric>()
00046 {
00047   this->UpdateControllerID(ControllerID::SetupOptimizationMetricControllerBase);
00048   this->m_Description = "Base class for registration metric controller; not for practical use.";
00049 };
00050 
00051 template <class TControlledMetric>
00052 void
00053 SetupOptimizationMetricControllerBase<TControlledMetric>::
00054 GenerateProfile(CtrlProfile::ControllerProfile& profile,
00055                   const SessionComponentCache* pComponentCache,
00056                   bool bRegardOldSetup) const
00057 {
00058   Superclass::GenerateProfile(profile,pComponentCache,bRegardOldSetup);
00059 
00060   //Parameters
00061   profile.Parameters().AddParameter(cParam_MetricScales,CtrlProfile::Parameter::PVTDouble,cParamDsc_MetricScales,1,"1.0");
00062   profile.Parameters().AddParameter(cParam_MetricMinimize,CtrlProfile::Parameter::PVTBool,cParamDsc_MetricMinimize,1,"true");
00063 
00064         CtrlProfile::ProfileOption* pOption = profile.Requirements().AddRequirement(std::string("../")+cComp_MainTransform)->AddProfileOption();
00065         pOption->Inheritance().AddAncestor("SetupTransformBase");
00066         pOption->CheckForInheritance();
00067 };
00068 
00069 template <class TControlledMetric>
00070 void
00071 SetupOptimizationMetricControllerBase<TControlledMetric>::
00072 ActualizeMainComponent(ComponentType* pMainComponent,
00073                        SessionComponentCache* pComponentCache, SessionInfo* pSessionInfo,
00074                                                                                          const unsigned int& iActLevel) const
00075 {
00076         Superclass::ActualizeMainComponent(pMainComponent, pComponentCache,
00077                                                                                                                                                  pSessionInfo, iActLevel);
00078 
00079   typedef typename ComponentType::MetricScalesType ComponentMetricScalesType;
00080   ComponentMetricScalesType metricScales;
00081         
00082   Parameter* pParameter = pComponentCache->Setup()->Parameters().GetParameter(cParam_MetricScales);
00083   if (!pParameter) throwExceptionMacro("Missing parameter: " << cParam_MetricScales);
00084         metricScales = Convert::ParameterLayerToArray<ComponentMetricScalesType>(*(pParameter->GetParameterLayer(0)));
00085 
00086   pMainComponent->SetMetricScales(metricScales);
00087 };
00088 
00089 } //end of namespace FREE
00090 
00091 #endif

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