freESRandomMultiParentSelectorController.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: freESRandomMultiParentSelectorController.cxx,v $
00007   Language:  C++
00008 
00009 
00010   Copyright (c) 2007 Ralf o Floca (Department of Medical Informatics,
00011   Institute for Medical Biometry and Informatics, University of Heidelberg,
00012   Germany). All rights reserved.
00013   See FREECopyright.txt or http://www.mi.med.uni-hd.de/free/copyright.htm
00014   for details.
00015 
00016      This software is distributed WITHOUT ANY WARRANTY; without even 
00017      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00018      PURPOSE.  See the above copyright notices for more information.
00019 
00020 =========================================================================*/
00021 
00022 #include "freESRandomMultiParentSelectorController.h"
00023 #include "freExceptions.h"
00024 
00025 namespace FREE
00026 {
00027 
00031 
00032 
00033 DefineParameterMacro(ESRandomMultiParentSelectorController,AllowRedraw,"AllowRedraw","Indicates if a parent is allowed to be randomly drawn more than once. If redraw isn't allowed the number of selections must be less or equal the size of the population.");
00034 DefineParameterMacro(ESRandomMultiParentSelectorController,NumberOfSelections,"NumberOfSelections","The number of individuals that should be selected. In terms of ES it is the parameter rho.");
00035 
00036 ESRandomMultiParentSelectorController::
00037 ESRandomMultiParentSelectorController()
00038 {
00039   //Profile settings
00040   this->UpdateControllerID(ControllerID::ESRandomMultiParentSelectorController);
00041   this->m_Description = "ES selects the parents out of the population randomly.";
00042 };
00043 
00044 void
00045 ESRandomMultiParentSelectorController::
00046 GenerateProfile(CtrlProfile::ControllerProfile& profile,
00047                 const SessionComponentCache* pComponentCache,
00048                 bool bRegardOldSetup) const
00049 {
00050   Superclass::GenerateProfile(profile,pComponentCache,bRegardOldSetup);
00051 
00052   //parameters
00053   profile.Parameters().AddParameter(cParam_AllowRedraw,CtrlProfile::Parameter::PVTBool,cParamDsc_AllowRedraw,1,"false");
00054   profile.Parameters().AddParameter(cParam_NumberOfSelections,CtrlProfile::Parameter::PVTULong,cParamDsc_NumberOfSelections,1,"1",-1);
00055 };
00056 
00057 void
00058 ESRandomMultiParentSelectorController::
00059 ActualizeMainComponent(ComponentType* pMainComponent,
00060                        SessionComponentCache* pComponentCache, SessionInfo* pSessionInfo,
00061                                                                                          const unsigned int& iActLevel) const
00062 {
00063   Superclass::ActualizeMainComponent(pMainComponent, pComponentCache,
00064                                      pSessionInfo, iActLevel);
00065 
00066   bool bAllowRedraw;
00067   unsigned long lNumberOfSelections;
00068 
00069   try
00070   {
00071     SessionAccessor::GetParameterValue(pComponentCache,cParam_AllowRedraw,bAllowRedraw,0,iActLevel,true);
00072     SessionAccessor::GetParameterValue(pComponentCache,cParam_NumberOfSelections,lNumberOfSelections,0,iActLevel,true);
00073   }
00074   catchAllNPassMacro("Error while retrieving parameter values.");
00075 
00076   pMainComponent->SetAllowRedraw(bAllowRedraw);
00077   pMainComponent->SetNumberOfSelections(lNumberOfSelections);
00078 };
00079 
00080 
00081 } //end of namespace free

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