00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
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 }
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
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 }