MITK-IGT
IGT Extension of MITK
Loading...
Searching...
No Matches
mitkPolhemusInterface.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 mitkPolhemusInterface_h
14#define mitkPolhemusInterface_h
15
16#include <vector>
17#include <string>
18
19#include <MitkIGTExports.h>
20#include "mitkCommon.h"
21
22#include <itkObject.h>
23#include <itkObjectFactory.h>
24
25#include <windows.h>
26#include <tchar.h>
27#include <string>
28
29#include <mitkNavigationData.h>
30
31class CPDIdev;
32
33namespace mitk
34{
42 class MITKIGT_EXPORT PolhemusInterface : public itk::Object
43 {
44 public:
45
49
51 {
52 mitk::Point3D pos;
53 mitk::Quaternion rot;
54 BYTE id;
56 };
57
62 bool StartTracking();
63
68 bool StopTracking();
69
70 bool Connect();
71
72 bool Disconnect();
73
75 unsigned int GetNumberOfTools();
76
78 void SetHemisphereTrackingEnabled(bool _HemisphereTrackingEnabled, int _tool = -1);
79
83 void ToggleHemisphere(int _tool = -1);
84
86 void PrintStatus();
87
91 void SetHemisphere(int _tool, mitk::Vector3D _hemisphere);
92
96 mitk::Vector3D GetHemisphere(int _tool);
97
100 std::vector<int> GetToolPorts();
101
104 bool GetHemisphereTrackingEnabled(int _tool);
105
108 void AdjustHemisphere(int _tool);
109
111 std::vector<trackingData> GetSingleFrame();
112
114 std::vector<trackingData> AutoDetectTools();
115
117 std::vector<trackingData> GetLastFrame();
118
119 protected:
128
130 CPDIdev* m_pdiDev;
131
133 std::vector<mitk::PolhemusInterface::trackingData> ParsePolhemusRawData(PBYTE pBuf, DWORD dwSize);
134
135 bool InitializeDevice();
136
137 bool SetupDevice();
138
139 //returns the index in the arrays of tool _tool. Eg. sensor 3 (_tool = 3) is the second tool --> index 1 in m_Hemispheres etc.
140 int GetToolIndex(int _tool);
141
145 std::vector<trackingData> GetFrame();
146
147 private:
148 //returns vector with tool index as only element if tool != -1, else returns vector from 0 to numberOfTools
149 std::vector<int> GetToolIterator(int _tool);
150
151 //helper method to open connection
152 bool OpenConnection();
153
154
155 private:
156 //Stores the hemispheres for all sensors. Default is (1|0|0).
157 std::vector<mitk::Vector3D> m_Hemispheres;
158
159 //Stores, if hemisphereTracking is on for this Sensor.
160 std::vector<bool> m_HemisphereTracking;
161
162 //This vector stores the order of tools, which are available.
163 //E.g. only Sensor 1 and 3 are attached, then this vector maps the first tool (0) to Polhemus identifier 1 and the second tool (1) to Polhemus 3.
164 std::vector<int> m_ToolPorts;
165
166 unsigned int m_numberOfTools;
167
168 bool m_continousTracking;
169 };
170}//mitk
171#endif
An object of this class represents the interface to Polhemus trackers. All variables with the name "t...
mitkClassMacroItkParent(PolhemusInterface, itk::Object)
IGT Exceptions.