00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "freInterpolatorCtrlrs.h"
00023
00024 #include "freNearestNeighborInterpolateController.h"
00025 #include "freLinearInterpolateController.h"
00026 #include "freBSplineInterpolateController.h"
00027
00028 namespace FREE
00029 {
00030
00031 #ifndef __FREE_DISABLE_DLL_INTERFACE
00032
00033 namespace
00034 {
00035
00036 extern "C"
00037 #ifdef _WIN32
00038 __declspec( dllexport )
00039 #endif
00040 void FREEGetControllerList(int& iControllerCount, const char**& pControllerIDs)
00041 {
00042 ::FREE::InterpolatorCtrlrs::GetControllerList(iControllerCount, pControllerIDs);
00043 };
00044
00045 extern "C"
00046 #ifdef _WIN32
00047 __declspec( dllexport )
00048 #endif
00049 GenericComponentController* FREECreateController(const char* pControllerID)
00050 {
00051 return ::FREE::InterpolatorCtrlrs::CreateController(pControllerID);
00052 };
00053
00054 extern "C"
00055 #ifdef _WIN32
00056 __declspec( dllexport )
00057 #endif
00058 bool FREEDeleteController (GenericComponentController* pController)
00059 {
00060 if (pController)
00061 {
00062 delete pController;
00063 }
00064 return true;
00065 };
00066
00067 extern "C"
00068 #ifdef _WIN32
00069 __declspec( dllexport )
00070 #endif
00071 void FREELinkCentralAsDedicated (::FREE::ControllerCentral::ControllerListType* pDedicatedControllerList,
00072 ::FREE::ControllerCentral::LibraryHandleListType* pDedicatedLibraryHandles,
00073 ::FREE::ProgressEventBase* pfnOnControl, ::FREE::ProgressEventBase* pfnOnBuild,
00074 ::FREE::ControllerCentral::CtrlCallbackListType* pCtrlCallbackList,
00075 ::FREE::ControllerCentral::CtrlProgressListType* pCtrlProgressList,
00076 ::itk::MutexLock* pGlobalCallbackMutex,
00077 ::itk::MutexLock* pGlobalProgressMutex)
00078 {
00079 ::FREE::ControllerCentral::LinkControllerCentralAsDedicated(pDedicatedControllerList,pDedicatedLibraryHandles,pfnOnControl,pfnOnBuild,pCtrlCallbackList,pCtrlProgressList,pGlobalCallbackMutex,pGlobalProgressMutex);
00080 }
00081
00082
00083 }
00084
00085 #endif // __FREE_DISABLE_DLL_INTERFACE
00086
00090
00091
00092 void InterpolatorCtrlrs::RegisterAllControllers(ControllerCentral* pCentral)
00093 {
00094 int iCount = 0;
00095 const char** pControllerIDs = 0;
00096
00097 InterpolatorCtrlrs::GetControllerList(iCount,pControllerIDs);
00098
00099 for (int iPos = 0; iPos < iCount; iPos++)
00100 {
00101 pCentral->RegisterController(InterpolatorCtrlrs::CreateController(pControllerIDs[iPos]));
00102 }
00103
00104 if (pControllerIDs)
00105 delete pControllerIDs;
00106 };
00107
00108 void InterpolatorCtrlrs::GetControllerList(int& iControllerCount, const char**& pControllerIDs)
00109 {
00110 typedef std::vector<const char*> ControllerListType;
00111 ControllerListType internalControllerList;
00112
00113
00114 internalControllerList.push_back(ControllerID::NearestNeighbor2DInterpolateController);
00115 internalControllerList.push_back(ControllerID::Linear2DInterpolateController);
00116 internalControllerList.push_back(ControllerID::BSpline2DInterpolateController);
00117
00118 internalControllerList.push_back(ControllerID::NearestNeighbor3DInterpolateController);
00119 internalControllerList.push_back(ControllerID::Linear3DInterpolateController);
00120 internalControllerList.push_back(ControllerID::BSpline3DInterpolateController);
00121
00122
00123 iControllerCount = internalControllerList.size();
00124 pControllerIDs = new const char*[iControllerCount];
00125 for (unsigned int iPos = 0; iPos<iControllerCount; iPos++)
00126 {
00127 pControllerIDs[iPos] = internalControllerList.at(iPos);
00128 }
00129 };
00130
00131 GenericComponentController* InterpolatorCtrlrs::CreateController(const char* pControllerID)
00132 {
00133 std::string sControllerID(pControllerID);
00134
00135
00136 if (sControllerID == ControllerID::NearestNeighbor2DInterpolateController)
00137 return(GenericComponentController*)new NearestNeighbor2DInterpolateController;
00138 if (sControllerID == ControllerID::Linear2DInterpolateController)
00139 return(GenericComponentController*)new Linear2DInterpolateController;
00140 if (sControllerID == ControllerID::BSpline2DInterpolateController)
00141 return(GenericComponentController*)new BSpline2DInterpolateController;
00142
00143 if (sControllerID == ControllerID::NearestNeighbor3DInterpolateController)
00144 return(GenericComponentController*)new NearestNeighbor3DInterpolateController;
00145 if (sControllerID == ControllerID::Linear3DInterpolateController)
00146 return(GenericComponentController*)new Linear3DInterpolateController;
00147 if (sControllerID == ControllerID::BSpline3DInterpolateController)
00148 return(GenericComponentController*)new BSpline3DInterpolateController;
00149
00150 return NULL;
00151 };
00152
00153
00154 }