freImageFilterCtrlrs.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: freImageFilterCtrlrs.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 "freImageFilterCtrlrs.h"
00023 
00024 #include "freSpatialRegionOfInterestImageFilterController.h"
00025 
00026 namespace FREE
00027 {
00028 
00029 #ifndef __FREE_DISABLE_DLL_INTERFACE
00030 
00031 namespace
00032 {
00033 
00034 extern "C" 
00035 #ifdef _WIN32
00036 __declspec( dllexport ) 
00037 #endif
00038 void FREEGetControllerList(int& iControllerCount, const char**& pControllerIDs)
00039 {
00040   ::FREE::ImageFilterCtrlrs::GetControllerList(iControllerCount, pControllerIDs);
00041 };
00042 
00043 extern "C" 
00044 #ifdef _WIN32
00045 __declspec( dllexport ) 
00046 #endif 
00047 GenericComponentController* FREECreateController(const char* pControllerID)
00048 {
00049   return ::FREE::ImageFilterCtrlrs::CreateController(pControllerID);
00050 };
00051 
00052 extern "C" 
00053 #ifdef _WIN32
00054 __declspec( dllexport ) 
00055 #endif 
00056 bool FREEDeleteController (GenericComponentController* pController)
00057 {
00058                 if (pController)
00059                 {
00060                         delete pController;
00061                 }
00062                 return true;
00063 };
00064 
00065 extern "C" 
00066 #ifdef _WIN32
00067 __declspec( dllexport ) 
00068 #endif 
00069     void FREELinkCentralAsDedicated (::FREE::ControllerCentral::ControllerListType* pDedicatedControllerList,
00070                                      ::FREE::ControllerCentral::LibraryHandleListType* pDedicatedLibraryHandles,
00071                                      ::FREE::ProgressEventBase* pfnOnControl, ::FREE::ProgressEventBase* pfnOnBuild,
00072                                      ::FREE::ControllerCentral::CtrlCallbackListType* pCtrlCallbackList,
00073                                      ::FREE::ControllerCentral::CtrlProgressListType* pCtrlProgressList,
00074                                      ::itk::MutexLock* pGlobalCallbackMutex,
00075                                      ::itk::MutexLock* pGlobalProgressMutex)
00076 {
00077     ::FREE::ControllerCentral::LinkControllerCentralAsDedicated(pDedicatedControllerList,pDedicatedLibraryHandles,pfnOnControl,pfnOnBuild,pCtrlCallbackList,pCtrlProgressList,pGlobalCallbackMutex,pGlobalProgressMutex);
00078 }
00079 
00080 } // end of anonymous namspace of dll interface
00081 
00082 #endif // __FREE_DISABLE_DLL_INTERFACE
00083 
00084 
00088 
00089 
00090 void ImageFilterCtrlrs::RegisterAllControllers(ControllerCentral* pCentral)
00091 {
00092         int iCount = 0;
00093         const char** pControllerIDs = 0;
00094 
00095         ImageFilterCtrlrs::GetControllerList(iCount,pControllerIDs);
00096 
00097         for (int iPos = 0; iPos < iCount; iPos++)
00098         {
00099                 pCentral->RegisterController(ImageFilterCtrlrs::CreateController(pControllerIDs[iPos]));
00100         }
00101 
00102         if (pControllerIDs) delete pControllerIDs;
00103 };
00104 
00105 void ImageFilterCtrlrs::GetControllerList(int& iControllerCount, const char**& pControllerIDs)
00106 {
00107         typedef std::vector<const char*> ControllerListType;
00108         ControllerListType internalControllerList;
00109 
00110   internalControllerList.push_back(ControllerID::SpatialRegionOfInterest2DImageFilterController);
00111   internalControllerList.push_back(ControllerID::SpatialRegionOfInterest3DImageFilterController);
00112 
00113         //create export array with controller names.
00114         iControllerCount = internalControllerList.size();
00115         pControllerIDs = new const char*[iControllerCount];
00116         for (unsigned int iPos = 0; iPos<iControllerCount; iPos++)
00117         {
00118                 pControllerIDs[iPos] = internalControllerList.at(iPos);
00119         }
00120 };
00121 
00122 GenericComponentController* ImageFilterCtrlrs::CreateController(const char* pControllerID)
00123 {
00124         std::string sControllerID(pControllerID);
00125 
00126   if (sControllerID == ControllerID::SpatialRegionOfInterest2DImageFilterController) return (GenericComponentController*) new SpatialRegionOfInterest2DImageFilterController;
00127         if (sControllerID == ControllerID::SpatialRegionOfInterest3DImageFilterController) return (GenericComponentController*) new SpatialRegionOfInterest3DImageFilterController;
00128 
00129         return NULL;
00130 };
00131 
00132 
00133 } //end of namespace free

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