MITK-IGT
IGT Extension of MITK
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
mitkPMDModuleActivator.cpp
Go to the documentation of this file.
1/*============================================================================
2
3The Medical Imaging Interaction Toolkit (MITK)
4
5Copyright (c) German Cancer Research Center (DKFZ)
6All rights reserved.
7
8Use of this source code is governed by a 3-clause BSD license that can be
9found in the LICENSE file.
10
11============================================================================*/
12#ifndef __mitkToFCameraPMDModuleActivator_h
13#define __mitkToFCameraPMDModuleActivator_h
14
15// Microservices
16#include <usServiceRegistration.h>
17#include <usModuleContext.h>
18#include <usModuleActivator.h>
19
20//ToF
22#include "mitkToFConfig.h"
23#include "mitkToFPMDConfig.h"
26
27//The follwing heades only get implemented if the respective Devices are activated through Cmake
28#ifdef MITK_USE_TOF_PMDCAMCUBE
31#endif
32
33#ifdef MITK_USE_TOF_PMDO3
35#endif
36
37#ifdef MITK_USE_TOF_PMDCAMBOARD
40#endif
41
42namespace mitk
43{
48class PMDModuleActivator : public us::ModuleActivator {
49public:
50
55 void Load(us::ModuleContext* context)
56 {
57 //The PMD CamBoard-Factory gets activated as soon as the user toggels one the PMD-parameter in Cmake to on
58#ifdef MITK_USE_TOF_PMDCAMCUBE
59 //Register Cam Cube Factory
60 ToFCameraPMDCamCubeDeviceFactory* toFCameraPMDCamCubeDeviceFactory = new ToFCameraPMDCamCubeDeviceFactory();
61 us::ServiceProperties camCubeFactoryProps;
62 camCubeFactoryProps["ToFFactoryName"] = toFCameraPMDCamCubeDeviceFactory->GetFactoryName();
63 context->RegisterService<IToFDeviceFactory>(toFCameraPMDCamCubeDeviceFactory,camCubeFactoryProps);
64
65 toFCameraPMDCamCubeDeviceFactory->ConnectToFDevice();
66
67 //Register PMD Raw Data Cam Cube DeviceFactory
68 ToFCameraPMDRawDataCamCubeDeviceFactory* toFCameraPMDRawDataCamCubeDeviceFactory = new ToFCameraPMDRawDataCamCubeDeviceFactory();
69 us::ServiceProperties rawCamCubeFactoryProps;
70 rawCamCubeFactoryProps["ToFFactoryName"] = toFCameraPMDRawDataCamCubeDeviceFactory->GetFactoryName();
71 context->RegisterService<IToFDeviceFactory>(toFCameraPMDRawDataCamCubeDeviceFactory,rawCamCubeFactoryProps);
72
73 toFCameraPMDRawDataCamCubeDeviceFactory->ConnectToFDevice();
74
75 m_Factories.push_back(toFCameraPMDCamCubeDeviceFactory);
76 m_Factories.push_back(toFCameraPMDRawDataCamCubeDeviceFactory);
77#endif
78
79 //The PMD O3-Factory gets activated as soon as the user toggels one the PMD-parameter in Cmake to on
80#ifdef MITK_USE_TOF_PMDO3
81 //Implementing PMD O3D DeviceFactory
82 ToFCameraPMDO3DeviceFactory* toFCameraPMDO3DeviceFactory = new ToFCameraPMDO3DeviceFactory();
83 us::ServiceProperties o3FactoryProps;
84 o3FactoryProps["ToFFactoryName"] = toFCameraPMDO3DeviceFactory->GetFactoryName();
85 context->RegisterService<IToFDeviceFactory>(toFCameraPMDO3DeviceFactory,o3FactoryProps);
86
87 toFCameraPMDO3DeviceFactory->ConnectToFDevice();
88
89 m_Factories.push_back(toFCameraPMDO3DeviceFactory);
90#endif
91
92 //The PMD CamBoard-Factory gets activated as soon as the user toggels one the PMD-parameter in Cmake to on
93#ifdef MITK_USE_TOF_PMDCAMBOARD
94 //Implementing CamBoardDeviceFactory
95 ToFCameraPMDCamBoardDeviceFactory* toFCameraPMDCamBoardDeviceFactory = new ToFCameraPMDCamBoardDeviceFactory();
96 us::ServiceProperties camBoardFactoryProps;
97 camBoardFactoryProps["ToFFactoryName"] = toFCameraPMDCamBoardDeviceFactory->GetFactoryName();
98 context->RegisterService<IToFDeviceFactory>(toFCameraPMDCamBoardDeviceFactory, camBoardFactoryProps);
99
100 toFCameraPMDCamBoardDeviceFactory->ConnectToFDevice();
101
102
103 //Implementing PMD Raw Data Cam Board DeviceFactory
104 ToFCameraPMDRawDataCamBoardDeviceFactory* toFCameraPMDRawDataCamBoardDeviceFactory = new ToFCameraPMDRawDataCamBoardDeviceFactory();
105 us::ServiceProperties rawCamBoardFactoryProps;
106 rawCamBoardFactoryProps["ToFFactoryName"] = toFCameraPMDRawDataCamBoardDeviceFactory->GetFactoryName();
107 context->RegisterService<IToFDeviceFactory>(toFCameraPMDRawDataCamBoardDeviceFactory,rawCamBoardFactoryProps);
108
109 toFCameraPMDRawDataCamBoardDeviceFactory->ConnectToFDevice();
110
111 m_Factories.push_back(toFCameraPMDCamBoardDeviceFactory);
112 m_Factories.push_back(toFCameraPMDRawDataCamBoardDeviceFactory);
113#endif
114
115 //The PMD Player Device Factory gets activated as soon as the user toggels one of the PMD-parameters in Cmake to on
116 //Registrating the PMD Player DeviceFactory
117 ToFCameraPMDPlayerDeviceFactory* toFCameraPMDPlayerDeviceFactory = new ToFCameraPMDPlayerDeviceFactory();
118 us::ServiceProperties pMDPlayerFactoryProps;
119 pMDPlayerFactoryProps["ToFFactoryName"] = toFCameraPMDPlayerDeviceFactory->GetFactoryName();
120 context->RegisterService<IToFDeviceFactory>(toFCameraPMDPlayerDeviceFactory,pMDPlayerFactoryProps);
121
122 toFCameraPMDPlayerDeviceFactory->ConnectToFDevice();
123
124 m_Factories.push_back(toFCameraPMDPlayerDeviceFactory);
125
126 }
127
131 void Unload(us::ModuleContext* )
132 {
133 }
134
139 {
140 if(m_Factories.size() > 0)
141 {
142 for(std::list< IToFDeviceFactory* >::iterator it = m_Factories.begin(); it != m_Factories.end(); ++it)
143 {
144 delete (*it);
145 }
146 }
147 }
148
149private:
153 std::list< IToFDeviceFactory* > m_Factories;
154
155};
156}
157US_EXPORT_MODULE_ACTIVATOR(mitk::PMDModuleActivator)
158#endif
The PMDModuleActivator class This is the module activator for the "PMDModule" module....
void Unload(us::ModuleContext *)
Unload called when the module is unloaded.
~PMDModuleActivator()
Default destructor which deletes all registered factories.
void Load(us::ModuleContext *context)
Load This method is automatically called, when the PMDModule is activated. It will automatically regi...
ToFPMDCamBoardDeviceFactory is an implementation of the factory pattern to generate CamBoard devices....
std::string GetFactoryName()
Defining the Factorie´s Name, here for the ToFPMDCamBoard.
ToFPMDCamBoardDeviceFactory is an implementation of the factory pattern to generate Cam Cube Devices....
std::string GetFactoryName()
GetCurrentDeviceName Get the name of the current Cam Cube. First device is named "PMD CamCube 2....
ToFCameraPMDO3DeviceFactory is an implementation of the factory pattern to generate Do3 Devices....
std::string GetFactoryName()
Defining the Factories Name, here for the ToFPMDO3Device.
ToFPMDPlayerDeviceFactory is an implementation of the factory pattern to generate PMD Player Devices....
std::string GetFactoryName()
Get the name of the factory, here for the ToFPMDPlayer.
ToFPMDRawPlayerDeviceFactory is an implementation of the factory pattern to generate Raw Player Devic...
std::string GetFactoryName()
Defining the Factorie´s Name, here for the RawDataCamBoardDeviceFactory.
ToFPMDRawPlayerDeviceFactory is an implementation of the factory pattern to generate Raw Player Devic...
std::string GetFactoryName()
Get the name of the factory, here for the ToFPMDRawDataCamCube.
IGT Exceptions.
ToFCameraDevice::Pointer ConnectToFDevice()
ConnectToFDevice Use this method to connect a device.
This is the base of class for all ToFDeviceFactories.