MITK-IGT
IGT Extension of MITK
Loading...
Searching...
No Matches
mitkOpenIGTLinkTrackingDevice.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 mitkOpenIGTLinkTrackingDevice_h
14#define mitkOpenIGTLinkTrackingDevice_h
15
16#include <mitkIGTConfig.h>
17#include <mitkTrackingDevice.h>
19#include <mitkIGTLClient.h>
22#include <igtlQuaternionTrackingDataMessage.h>
23#include <igtlTrackingDataMessage.h>
24#include <igtlTransformMessage.h>
26
27namespace mitk
28{
35 class MITKIGT_EXPORT OpenIGTLinkTrackingDevice : public TrackingDevice
36 {
37 public:
41
43 void SetPortNumber(int portNumber);
44
46 void SetHostname(std::string hostname);
47
48 int GetPortNumber();
49
50 std::string GetHostname();
51
57 bool StartTracking() override;
58
63 bool StopTracking() override;
64
69 bool OpenConnection() override;
70
74 bool CloseConnection() override;
75
79 unsigned int GetToolCount() const override;
80
86 TrackingTool* GetTool(unsigned int toolNumber) const override;
87
95 bool DiscoverTools(int WaitingTime = 10000);
96
105 mitk::TrackingTool* AddTool(const char* toolName, const char* fileName);
106
108 bool AutoDetectToolsAvailable() override;
109
114 mitk::NavigationToolStorage::Pointer AutoDetectTools() override;
115
116 bool IsDeviceInstalled() override;
117
118 itkSetMacro(UpdateRate, int);
119 itkGetConstMacro(UpdateRate, int);
120
121 protected:
124
131 bool InternalAddTool(OpenIGTLinkTrackingTool::Pointer tool);
132
134 void UpdateTools();
136
139 mitk::IGTLMessage::Pointer ReceiveMessage(int waitingTime);
140
144 std::vector<OpenIGTLinkTrackingTool::Pointer> GetAllTools();
145
146 //OpenIGTLink connection class
147 mitk::IGTLClient::Pointer m_OpenIGTLinkClient;
148
149 //OpenIGTLink pipeline
150 mitk::IGTLTrackingDataDeviceSource::Pointer m_IGTLDeviceSource;
151 mitk::IGTLMessageToNavigationDataFilter::Pointer m_IGTLMsgToNavDataFilter;
152
153 std::vector<OpenIGTLinkTrackingTool::Pointer> m_AllTools;
154
156
157 private:
158 enum TrackingMessageType
159 {
160 TDATA, TRANSFORM, QTDATA, UNKNOWN
161 };
162
163 mitk::OpenIGTLinkTrackingDevice::TrackingMessageType GetMessageTypeFromString(const char* messageTypeString);
164
167 mitk::NavigationToolStorage::Pointer DiscoverToolsAndConvertToNavigationTools(mitk::OpenIGTLinkTrackingDevice::TrackingMessageType type, int NumberOfMessagesToWait = 50);
168
169 void AddNewToolForName(std::string name, int i);
170
171 mitk::NavigationTool::Pointer ConstructDefaultOpenIGTLinkTool(std::string name, std::string identifier);
172 };
173}//mitk
174#endif
An object of this class represents the MicronTracker device. You can add tools to this device,...
std::vector< OpenIGTLinkTrackingTool::Pointer > m_AllTools
vector holding all tools
int m_UpdateRate
holds the update rate in FPS (will be set automatically when the OpenIGTLink connection is establishe...
mitk::IGTLTrackingDataDeviceSource::Pointer m_IGTLDeviceSource
mitk::IGTLMessageToNavigationDataFilter::Pointer m_IGTLMsgToNavDataFilter
itkGetConstMacro(UpdateRate, int)
Returns the update rate of the device in fps.
itkSetMacro(UpdateRate, int)
Sets the update rate of the device in fps. Default value is 60 fps.
mitkClassMacro(OpenIGTLinkTrackingDevice, TrackingDevice)
Interface for all Tracking Devices.
Interface for all Tracking Tools.
IGT Exceptions.