freTransformationCtrlrs.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: freTransformationCtrlrs.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 "freTransformationCtrlrs.h"
00023 
00024 #include "freTranslationTransformController.h"
00025 #include "freScaleTransformController.h"
00026 #include "freSimilarity2DTransformController.h"
00027 #include "freVersorTransformController.h"
00028 #include "freVersorRigid3DTransformController.h"
00029 #include "freAffineTransformController.h"
00030 #include "freBSplineDeformableTransformController.h"
00031 #include "freCenteredAffineTransformController.h"
00032 #include "freEuler3DTransformController.h"
00033 #include "freCenteredEuler3DTransformController.h"
00034 #include "freRigid2DTransformController.h"
00035 #include "freCenteredRigid2DTransformController.h"
00036 
00037 namespace FREE
00038 {
00039 
00040 #ifndef __FREE_DISABLE_DLL_INTERFACE
00041 
00042 namespace
00043 {
00044 
00045 extern "C"
00046 #ifdef _WIN32
00047     __declspec( dllexport )
00048 #endif
00049     void FREEGetControllerList(int& iControllerCount, const char**& pControllerIDs)
00050 {
00051     ::FREE::TransformationCtrlrs::GetControllerList(iControllerCount, pControllerIDs);
00052 };
00053 
00054 extern "C"
00055 #ifdef _WIN32
00056     __declspec( dllexport )
00057 #endif
00058     GenericComponentController* FREECreateController(const char* pControllerID)
00059 {
00060     return ::FREE::TransformationCtrlrs::CreateController(pControllerID);
00061 };
00062 
00063 extern "C"
00064 #ifdef _WIN32
00065     __declspec( dllexport )
00066 #endif
00067     bool FREEDeleteController (GenericComponentController* pController)
00068 {
00069     if (pController)
00070     {
00071         delete pController;
00072     }
00073     return true;
00074 };
00075 
00076 extern "C"
00077 #ifdef _WIN32
00078     __declspec( dllexport )
00079 #endif
00080     void FREELinkCentralAsDedicated (::FREE::ControllerCentral::ControllerListType* pDedicatedControllerList,
00081                                      ::FREE::ControllerCentral::LibraryHandleListType* pDedicatedLibraryHandles,
00082                                      ::FREE::ProgressEventBase* pfnOnControl, ::FREE::ProgressEventBase* pfnOnBuild,
00083                                      ::FREE::ControllerCentral::CtrlCallbackListType* pCtrlCallbackList,
00084                                      ::FREE::ControllerCentral::CtrlProgressListType* pCtrlProgressList,
00085                                      ::itk::MutexLock* pGlobalCallbackMutex,
00086                                      ::itk::MutexLock* pGlobalProgressMutex)
00087 {
00088     ::FREE::ControllerCentral::LinkControllerCentralAsDedicated(pDedicatedControllerList,pDedicatedLibraryHandles,pfnOnControl,pfnOnBuild,pCtrlCallbackList,pCtrlProgressList,pGlobalCallbackMutex,pGlobalProgressMutex);
00089 }
00090 
00091 
00092 } 
00093 
00094 #endif // __FREE_DISABLE_DLL_INTERFACE
00095 
00099 
00100 
00101 void TransformationCtrlrs::RegisterAllControllers(ControllerCentral* pCentral)
00102 {
00103     int iCount = 0;
00104     const char** pControllerIDs = 0;
00105 
00106     TransformationCtrlrs::GetControllerList(iCount,pControllerIDs);
00107 
00108     for (int iPos = 0; iPos < iCount; iPos++)
00109     {
00110         pCentral->RegisterController(TransformationCtrlrs::CreateController(pControllerIDs[iPos]));
00111     }
00112 
00113     if (pControllerIDs)
00114         delete pControllerIDs;
00115 };
00116 
00117 void TransformationCtrlrs::GetControllerList(int& iControllerCount, const char**& pControllerIDs)
00118 {
00119     typedef std::vector<const char*> ControllerListType;
00120     ControllerListType internalControllerList;
00121 
00122     //Transformations
00123     internalControllerList.push_back(ControllerID::Translation2DTransformController);
00124     internalControllerList.push_back(ControllerID::Scale2DTransformController);
00125     internalControllerList.push_back(ControllerID::Rigid2DTransformController);
00126     internalControllerList.push_back(ControllerID::Similarity2DTransformController);
00127     internalControllerList.push_back(ControllerID::Affine2DTransformController);
00128     internalControllerList.push_back(ControllerID::BSpline3rdOrder2DTransformController);
00129     internalControllerList.push_back(ControllerID::CenteredRigid2DTransformController);
00130     internalControllerList.push_back(ControllerID::CenteredAffine2DTransformController);
00131 
00132     internalControllerList.push_back(ControllerID::Translation3DTransformController);
00133     internalControllerList.push_back(ControllerID::Scale3DTransformController);
00134     internalControllerList.push_back(ControllerID::Euler3DTransformController);
00135     internalControllerList.push_back(ControllerID::VersorTransformController);
00136     internalControllerList.push_back(ControllerID::VersorRigid3DTransformController);
00137     internalControllerList.push_back(ControllerID::Affine3DTransformController);
00138     internalControllerList.push_back(ControllerID::BSpline3rdOrder3DTransformController);
00139     internalControllerList.push_back(ControllerID::CenteredAffine3DTransformController);
00140     internalControllerList.push_back(ControllerID::CenteredEuler3DTransformController);
00141 
00142     //create export array with controller names.
00143     iControllerCount = internalControllerList.size();
00144     pControllerIDs = new const char*[iControllerCount];
00145     for (unsigned int iPos = 0; iPos<iControllerCount; iPos++)
00146     {
00147         pControllerIDs[iPos] = internalControllerList.at(iPos);
00148     }
00149 };
00150 
00151 GenericComponentController* TransformationCtrlrs::CreateController(const char* pControllerID)
00152 {
00153     std::string sControllerID(pControllerID);
00154 
00155     //Transformations
00156     if (sControllerID == ControllerID::Translation2DTransformController)
00157         return(GenericComponentController*)new Translation2DTransformController;
00158     if (sControllerID == ControllerID::Scale2DTransformController)
00159         return(GenericComponentController*)new Scale2DTransformController;
00160     if (sControllerID == ControllerID::Rigid2DTransformController)
00161         return(GenericComponentController*)new Rigid2DTransformController;
00162     if (sControllerID == ControllerID::Similarity2DTransformController)
00163         return(GenericComponentController*)new Similarity2DTransformController;
00164     if (sControllerID == ControllerID::Affine2DTransformController)
00165         return(GenericComponentController*)new Affine2DTransformController;
00166     if (sControllerID == ControllerID::BSpline3rdOrder2DTransformController)
00167         return(GenericComponentController*)new BSpline3rdOrder2DTransformController;
00168     if (sControllerID == ControllerID::CenteredRigid2DTransformController)
00169         return(GenericComponentController*)new CenteredRigid2DTransformController;
00170     if (sControllerID == ControllerID::CenteredAffine2DTransformController)
00171         return(GenericComponentController*)new CenteredAffine2DTransformController;
00172 
00173     if (sControllerID == ControllerID::Translation3DTransformController)
00174         return(GenericComponentController*)new Translation3DTransformController;
00175     if (sControllerID == ControllerID::Scale3DTransformController)
00176         return(GenericComponentController*)new Scale3DTransformController;
00177     if (sControllerID == ControllerID::Euler3DTransformController)
00178         return(GenericComponentController*)new Euler3DTransformController;
00179     if (sControllerID == ControllerID::VersorTransformController)
00180         return(GenericComponentController*)new VersorTransformController;
00181     if (sControllerID == ControllerID::VersorRigid3DTransformController)
00182         return(GenericComponentController*)new VersorRigid3DTransformController;
00183     if (sControllerID == ControllerID::Affine3DTransformController)
00184         return(GenericComponentController*)new Affine3DTransformController;
00185     if (sControllerID == ControllerID::BSpline3rdOrder3DTransformController)
00186         return(GenericComponentController*)new BSpline3rdOrder3DTransformController;
00187     if (sControllerID == ControllerID::CenteredAffine3DTransformController)
00188         return(GenericComponentController*)new CenteredAffine3DTransformController;
00189     if (sControllerID == ControllerID::CenteredEuler3DTransformController)
00190         return(GenericComponentController*)new CenteredEuler3DTransformController;
00191 
00192     return NULL;
00193 };
00194 
00195 
00196 } //end of namespace free

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