freSetupOptimizationCtrlrs.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: freSetupOptimizationCtrlrs.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 #include "freSetupOptimizationCtrlrs.h"
00023 
00024 #include "freSetupTransformController.h"
00025 #include "freConstrainedSetupTransformController.h"
00026 #include "freAccuracySOMetricController.h"
00027 #include "freConstrainedAccuracySOMetricController.h"
00028 #include "freConsistencySOMetricController.h"
00029 #include "frePrecisionSOMetricController.h"
00030 #include "freExhaustiveSOOptimizerController.h"
00031 #include "freSetupOptimizationProcessorController.h"
00032 #include "freAmoebaSOOptimizerController.h"
00033 #include "freLimitedAxisAmoebaSOOptimizerController.h"
00034 #include "freOnePlusOneEvolutionarySOOptimizerController.h"
00035 #include "freConstrainedOnePlusOneEvolutionarySOOptimizerController.h"
00036 #include "frePowellSOOptimizerController.h"
00037 #include "freSPSASOOptimizerController.h"
00038 #include "freEvolutionaryStrategySOOptimizerController.h"
00039 #include "freImageDifferenceSOMetricController.h"
00040 #include "freConstrainedImageDifferenceSOMetricController.h"
00041 #include "freImageClassificationSOMetricController.h"
00042 #include "freConstrainedImageClassificationSOMetricController.h"
00043 
00044 namespace FREE
00045 {
00046 
00047 #ifndef __FREE_DISABLE_DLL_INTERFACE
00048 
00049 namespace
00050 {
00051 
00052 extern "C" 
00053 #ifdef _WIN32
00054 __declspec( dllexport ) 
00055 #endif
00056 void FREEGetControllerList(int& iControllerCount, const char**& pControllerIDs)
00057 {
00058   ::FREE::SetupOptimizationCtrlrs::GetControllerList(iControllerCount, pControllerIDs);
00059 };
00060 
00061 extern "C" 
00062 #ifdef _WIN32
00063 __declspec( dllexport ) 
00064 #endif 
00065 GenericComponentController* FREECreateController(const char* pControllerID)
00066 {
00067   return ::FREE::SetupOptimizationCtrlrs::CreateController(pControllerID);
00068 };
00069 
00070 extern "C" 
00071 #ifdef _WIN32
00072 __declspec( dllexport ) 
00073 #endif 
00074 bool FREEDeleteController (GenericComponentController* pController)
00075 {
00076                 if (pController)
00077                 {
00078                         delete pController;
00079                 }
00080                 return true;
00081 };
00082 
00083 extern "C" 
00084 #ifdef _WIN32
00085 __declspec( dllexport ) 
00086 #endif 
00087     void FREELinkCentralAsDedicated (::FREE::ControllerCentral::ControllerListType* pDedicatedControllerList,
00088                                      ::FREE::ControllerCentral::LibraryHandleListType* pDedicatedLibraryHandles,
00089                                      ::FREE::ProgressEventBase* pfnOnControl, ::FREE::ProgressEventBase* pfnOnBuild,
00090                                      ::FREE::ControllerCentral::CtrlCallbackListType* pCtrlCallbackList,
00091                                      ::FREE::ControllerCentral::CtrlProgressListType* pCtrlProgressList,
00092                                      ::itk::MutexLock* pGlobalCallbackMutex,
00093                                      ::itk::MutexLock* pGlobalProgressMutex)
00094 {
00095     ::FREE::ControllerCentral::LinkControllerCentralAsDedicated(pDedicatedControllerList,pDedicatedLibraryHandles,pfnOnControl,pfnOnBuild,pCtrlCallbackList,pCtrlProgressList,pGlobalCallbackMutex,pGlobalProgressMutex);
00096 }
00097 
00098 
00099 } // end of anonymous namspace of dll interface
00100 
00101 #endif // __FREE_DISABLE_DLL_INTERFACE
00102 
00103 
00107 
00108 
00109 void SetupOptimizationCtrlrs::RegisterAllControllers(ControllerCentral* pCentral)
00110 {
00111         int iCount = 0;
00112         const char** pControllerIDs = 0;
00113 
00114         SetupOptimizationCtrlrs::GetControllerList(iCount,pControllerIDs);
00115 
00116         for (int iPos = 0; iPos < iCount; iPos++)
00117         {
00118                 pCentral->RegisterController(SetupOptimizationCtrlrs::CreateController(pControllerIDs[iPos]));
00119         }
00120 
00121         if (pControllerIDs) delete pControllerIDs;
00122 };
00123 
00124 void SetupOptimizationCtrlrs::GetControllerList(int& iControllerCount, const char**& pControllerIDs)
00125 {
00126         typedef std::vector<const char*> ControllerListType;
00127         ControllerListType internalControllerList;
00128 
00129         internalControllerList.push_back(ControllerID::SetupTransformController);
00130         internalControllerList.push_back(ControllerID::ConstrainedSetupTransformController);
00131 
00132         internalControllerList.push_back(ControllerID::Accuracy2DSOMetricController);
00133         internalControllerList.push_back(ControllerID::Accuracy3DSOMetricController);
00134         internalControllerList.push_back(ControllerID::Consistency2DSOMetricController);
00135         internalControllerList.push_back(ControllerID::Consistency3DSOMetricController);
00136         internalControllerList.push_back(ControllerID::ConstrainedAccuracy2DSOMetricController);
00137         internalControllerList.push_back(ControllerID::ConstrainedAccuracy3DSOMetricController);
00138         internalControllerList.push_back(ControllerID::ImageClassification2DSOMetricController);
00139         internalControllerList.push_back(ControllerID::ImageClassification3DSOMetricController);
00140         internalControllerList.push_back(ControllerID::ConstrainedImageClassification2DSOMetricController);
00141         internalControllerList.push_back(ControllerID::ConstrainedImageClassification3DSOMetricController);
00142         internalControllerList.push_back(ControllerID::ImageDifference2DSOMetricController);
00143         internalControllerList.push_back(ControllerID::ImageDifference3DSOMetricController);
00144         internalControllerList.push_back(ControllerID::ConstrainedImageDifference2DSOMetricController);
00145         internalControllerList.push_back(ControllerID::ConstrainedImageDifference3DSOMetricController);
00146         internalControllerList.push_back(ControllerID::PrecisionSOMetricController);
00147 
00148         internalControllerList.push_back(ControllerID::ExhaustiveSOOptimizerController);
00149         internalControllerList.push_back(ControllerID::AmoebaSOOptimizerController);
00150         internalControllerList.push_back(ControllerID::LimitedAxisAmoebaSOOptimizerController);
00151         internalControllerList.push_back(ControllerID::OnePlusOneEvolutionarySOOptimizerController);
00152         internalControllerList.push_back(ControllerID::ConstrainedOnePlusOneEvolutionarySOOptimizerController);
00153         internalControllerList.push_back(ControllerID::PowellSOOptimizerController);
00154         internalControllerList.push_back(ControllerID::SPSASOOptimizerController);
00155         internalControllerList.push_back(ControllerID::EvolutionaryStrategySOOptimizerController);
00156 
00157         internalControllerList.push_back(ControllerID::SetupOptimizationProcessorController);
00158 
00159         //create export array with controller names.
00160         iControllerCount = internalControllerList.size();
00161         pControllerIDs = new const char*[iControllerCount];
00162         for (unsigned int iPos = 0; iPos<iControllerCount; iPos++)
00163         {
00164                 pControllerIDs[iPos] = internalControllerList.at(iPos);
00165         }
00166 };
00167 
00168 GenericComponentController* SetupOptimizationCtrlrs::CreateController(const char* pControllerID)
00169 {
00170         std::string sControllerID(pControllerID);
00171 
00172         if (sControllerID == ControllerID::SetupTransformController) return (GenericComponentController*) new SetupTransformController;
00173         if (sControllerID == ControllerID::ConstrainedSetupTransformController) return (GenericComponentController*) new ConstrainedSetupTransformController;
00174 
00175         if (sControllerID == ControllerID::Accuracy2DSOMetricController) return (GenericComponentController*) new Accuracy2DSOMetricController;
00176         if (sControllerID == ControllerID::Accuracy3DSOMetricController) return (GenericComponentController*) new Accuracy3DSOMetricController;
00177         if (sControllerID == ControllerID::ConstrainedAccuracy2DSOMetricController) return (GenericComponentController*) new ConstrainedAccuracy2DSOMetricController;
00178         if (sControllerID == ControllerID::ConstrainedAccuracy3DSOMetricController) return (GenericComponentController*) new ConstrainedAccuracy3DSOMetricController;
00179         if (sControllerID == ControllerID::Consistency2DSOMetricController) return (GenericComponentController*) new Consistency2DSOMetricController;
00180         if (sControllerID == ControllerID::Consistency3DSOMetricController) return (GenericComponentController*) new Consistency3DSOMetricController;
00181         if (sControllerID == ControllerID::PrecisionSOMetricController) return (GenericComponentController*) new PrecisionSOMetricController;
00182         if (sControllerID == ControllerID::ImageDifference2DSOMetricController) return (GenericComponentController*) new ImageDifference2DSOMetricController;
00183         if (sControllerID == ControllerID::ImageDifference3DSOMetricController) return (GenericComponentController*) new ImageDifference3DSOMetricController;
00184         if (sControllerID == ControllerID::ConstrainedImageDifference2DSOMetricController) return (GenericComponentController*) new ConstrainedImageDifference2DSOMetricController;
00185         if (sControllerID == ControllerID::ConstrainedImageDifference3DSOMetricController) return (GenericComponentController*) new ConstrainedImageDifference3DSOMetricController;
00186         if (sControllerID == ControllerID::ImageClassification2DSOMetricController) return (GenericComponentController*) new ImageClassification2DSOMetricController;
00187         if (sControllerID == ControllerID::ImageClassification3DSOMetricController) return (GenericComponentController*) new ImageClassification3DSOMetricController;
00188         if (sControllerID == ControllerID::ConstrainedImageClassification2DSOMetricController) return (GenericComponentController*) new ConstrainedImageClassification2DSOMetricController;
00189         if (sControllerID == ControllerID::ConstrainedImageClassification3DSOMetricController) return (GenericComponentController*) new ConstrainedImageClassification3DSOMetricController;
00190 
00191         if (sControllerID == ControllerID::ExhaustiveSOOptimizerController) return (GenericComponentController*) new ExhaustiveSOOptimizerController;
00192         if (sControllerID == ControllerID::AmoebaSOOptimizerController) return (GenericComponentController*) new AmoebaSOOptimizerController;
00193         if (sControllerID == ControllerID::LimitedAxisAmoebaSOOptimizerController) return (GenericComponentController*) new LimitedAxisAmoebaSOOptimizerController;
00194         if (sControllerID == ControllerID::OnePlusOneEvolutionarySOOptimizerController) return (GenericComponentController*) new OnePlusOneEvolutionarySOOptimizerController;
00195         if (sControllerID == ControllerID::ConstrainedOnePlusOneEvolutionarySOOptimizerController) return (GenericComponentController*) new ConstrainedOnePlusOneEvolutionarySOOptimizerController;
00196         if (sControllerID == ControllerID::PowellSOOptimizerController) return (GenericComponentController*) new PowellSOOptimizerController;
00197         if (sControllerID == ControllerID::SPSASOOptimizerController) return (GenericComponentController*) new SPSASOOptimizerController;
00198         if (sControllerID == ControllerID::EvolutionaryStrategySOOptimizerController) return (GenericComponentController*) new EvolutionaryStrategySOOptimizerController;
00199 
00200   if (sControllerID == ControllerID::SetupOptimizationProcessorController) return (GenericComponentController*) new SetupOptimizationProcessorController;
00201 
00202         return NULL;
00203 };
00204 
00205 
00206 } //end of namespace free

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