MITK-IGT
IGT Extension of MITK
Loading...
Searching...
No Matches
mitkOptitrackTrackingDevice.h
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
13#ifndef mitkOptitrackTrackingDevice_h
14#define mitkOptitrackTrackingDevice_h
15
16#include <MitkIGTExports.h>
17#include <mitkTrackingDevice.h>
18#include <mitkTrackingTypes.h>
19#include <mitkIGTTimeStamp.h>
20#include <itksys/SystemTools.hxx>
21#include <string>
22#include <cstdlib>
23#include <cstdio>
24#include <ctime>
25#include <thread>
26#include <mutex>
27
31#include "mitkIGTIOException.h"
32#include "mitkIGTTimeStamp.h"
33#include "mitkIGTException.h"
34
39
40
41namespace mitk
42{
52 class MITKIGT_EXPORT OptitrackTrackingDevice : public mitk::TrackingDevice
53 {
54
56
57 public:
60
64 bool IsDeviceInstalled() override;
65
66 // Define the Type of Tracker as DefinitionOfTool (MITK)
68
75 bool OpenConnection() override;
76
83 bool CloseConnection() override;
84
91 bool StartTracking() override;
92
98 bool StopTracking() override;
99
106 TrackingTool* GetTool(unsigned int toolNumber) const override;
107
115 OptitrackTrackingTool* GetOptitrackTool(unsigned int toolNumber) const;
116
121 unsigned int GetToolCount() const override;
122
124 itkSetMacro(Exp,int);
125
127 itkGetMacro(Exp,int);
128
130 itkSetMacro(Led,int);
131
133 itkGetMacro(Led,int);
134
136 itkSetMacro(Thr,int);
137
139 itkGetMacro(Thr,int);
140
142 void SetCalibrationPath(std::string calibrationPath);
143
145 itkGetMacro(calibrationPath,std::string);
146
150 void ThreadStartTracking();
151
156 void TrackTools();
157
163 bool LoadCalibration();
164
176 bool SetCameraParams(int exposure, int threshold, int intensity, int videoType = 4);
177
183 bool InitializeCameras();
184
198 bool AddToolByDefinitionFile(std::string fileName); // ^????? We should give an example of defined tool
199
200 protected:
202 ~OptitrackTrackingDevice() override;
203
204
205 private:
210 std::string m_calibrationPath;
211
215 int m_Exp;
216
220 int m_Led;
221
225 int m_Thr;
226
231 bool m_initialized;
232
236 std::vector<mitk::OptitrackTrackingTool::Pointer> m_AllTools;
237
241 mutable std::mutex m_ToolsMutex;
242
243 std::thread m_Thread;
244
245
246/* TODO:
247
248// For Tracking
249-bool AddToolByConfigurationFil(std::string fileName);
250TTAPI NPRESULT TT_LoadTrackables (const char *filename); //== Load Trackables ======----
251TTAPI NPRESULT TT_SaveTrackables (const char *filename); //== Save Trackables ======----
252TTAPI NPRESULT TT_AddTrackables (const char *filename); //== Add Trackables ======----
253TTAPI void TT_ClearTrackableList(); //== Clear all trackables =====---
254TTAPI NPRESULT TT_RemoveTrackable(int Index); //== Remove single trackable ====---
255TTAPI void TT_SetTrackableEnabled(int index, bool enabled); //== Set Tracking ====---
256TTAPI bool TT_TrackableEnabled(int index); //== Get Tracking ====---
257TTAPI int TT_TrackableMarkerCount(int index); //== Get marker count ====---
258TTAPI void TT_TrackableMarker(int RigidIndex, //== Get Trackable mrkr ====---
259 int MarkerIndex, float *x, float *y, float *z);
260
261//For projects
262TTAPI NPRESULT TT_LoadProject(const char *filename); //== Load Project File ==========--
263TTAPI NPRESULT TT_SaveProject(const char *filename); //== Save Project File ==========--
264
265// For VRPN connection
266TTAPI NPRESULT TT_StreamVRPN(bool enabled, int port);//== Start/stop VRPN Stream ===----
267
268// For frame testing
269TTAPI int TT_FrameMarkerCount(); //== Returns Frame Markers Count ---
270TTAPI float TT_FrameMarkerX(int index); //== Returns X Coord of Marker -----
271TTAPI float TT_FrameMarkerY(int index); //== Returns Y Coord of Marker -----
272TTAPI float TT_FrameMarkerZ(int index); //== Returns Z Coord of Marker -----
273TTAPI int TT_FrameMarkerLabel(int index); //== Returns Label of Marker -------
274TTAPI double TT_FrameTimeStamp(); //== Time Stamp of Frame (seconds) -
275
276// For cameras handling
277TTAPI int TT_CameraCount(); //== Returns Camera Count =====-----
278TTAPI float TT_CameraXLocation(int index); //== Returns Camera's X Coord =-----
279TTAPI float TT_CameraYLocation(int index); //== Returns Camera's Y Coord =-----
280TTAPI float TT_CameraZLocation(int index); //== Returns Camera's Z Coord =-----
281TTAPI float TT_CameraOrientationMatrix(int camera, int index); //== Orientation -----
282
283
284*/
285
286
287};
288
289
290}
291#endif
An object of this class represents the Optitrack device. You can add tools to this device,...
itkSetMacro(Thr, int)
Sets the directory where the calibration file of the MicronTracker can be found.
itkGetMacro(Exp, int)
Gets the current calibration directory.
mitk::TrackingDeviceType OptiTrackTrackingDeviceType
itkSetMacro(Exp, int)
Sets the directory where the calibration file of the MicronTracker can be found.
mitkClassMacro(OptitrackTrackingDevice, mitk::TrackingDevice)
itkGetMacro(calibrationPath, std::string)
Gets the current calibration file.
itkGetMacro(Led, int)
Gets the current calibration directory.
itkGetMacro(Thr, int)
Gets the current calibration directory.
itkSetMacro(Led, int)
Sets the directory where the calibration file of the MicronTracker can be found.
An object of this class represents the a Tool tracked by Optitrack System. You can define the tool by...
Interface for all Tracking Devices.
Interface for all Tracking Tools.
IGT Exceptions.
std::string TrackingDeviceType