Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkOpenIGTLinkTrackingDevice.h
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef MITKOPENIGTLINKTRACKINGDEVICE_H_HEADER_INCLUDED_
18 #define MITKOPENIGTLINKTRACKINGDEVICE_H_HEADER_INCLUDED_
19 
20 #include <mitkIGTConfig.h>
21 #include <mitkTrackingDevice.h>
23 #include <mitkIGTLClient.h>
24 #include <mitkIGTLDeviceSource.h>
26 #include <itkMultiThreader.h>
27 #include <igtlQuaternionTrackingDataMessage.h>
28 #include <igtlTrackingDataMessage.h>
29 #include <igtlTransformMessage.h>
31 
32 namespace mitk
33 {
40  class MITKIGT_EXPORT OpenIGTLinkTrackingDevice : public TrackingDevice
41  {
42  public:
44  itkFactorylessNewMacro(Self)
45  itkCloneMacro(Self)
46 
47 
48  void SetPortNumber(int portNumber);
49 
51  void SetHostname(std::string hostname);
52 
53  int GetPortNumber();
54 
55  std::string GetHostname();
56 
62  virtual bool StartTracking();
63 
68  virtual bool StopTracking();
69 
74  virtual bool OpenConnection();
75 
79  virtual bool CloseConnection();
80 
84  virtual unsigned int GetToolCount() const;
85 
91  TrackingTool* GetTool(unsigned int toolNumber) const;
92 
100  bool DiscoverTools(int WaitingTime = 10000);
101 
110  mitk::TrackingTool* AddTool(const char* toolName, const char* fileName);
111 
112  bool IsDeviceInstalled();
113 
114  itkSetMacro(UpdateRate, int);
115  itkGetConstMacro(UpdateRate, int);
116 
117  protected:
120 
127  bool InternalAddTool(OpenIGTLinkTrackingTool::Pointer tool);
128 
130  void UpdateTools();
132 
136  std::vector<OpenIGTLinkTrackingTool::Pointer> GetAllTools();
137 
138  //OpenIGTLink connection class
140 
141  //OpenIGTLink pipeline
144 
145  std::vector<OpenIGTLinkTrackingTool::Pointer> m_AllTools;
146 
148 
149  private:
150  enum TrackingMessageType
151  {
152  TDATA, TRANSFORM, QTDATA, UNKNOWN
153  };
154 
155  mitk::OpenIGTLinkTrackingDevice::TrackingMessageType GetMessageTypeFromString(const char* messageTypeString);
156 
157  bool DiscoverToolsFromTData(igtl::TrackingDataMessage::Pointer msg);
158 
159  bool DiscoverToolsFromQTData(igtl::QuaternionTrackingDataMessage::Pointer msg);
160 
161  bool DiscoverToolsFromTransform();
162 
163  void AddNewToolForName(std::string name, int i);
164  };
165 }//mitk
166 #endif /* MITKOpenIGTLinkTRACKINGDEVICE_H_HEADER_INCLUDED_ */
Interface for all Tracking Tools.
itk::SmartPointer< Self > Pointer
An object of this class represents the MicronTracker device. You can add tools to this device...
DataCollection - Class to facilitate loading/accessing structured data.
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...
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:44
Interface for all Tracking Devices.
mitk::IGTLMessageToNavigationDataFilter::Pointer m_IGTLMsgToNavDataFilter
mitk::IGTLTransformDeviceSource::Pointer m_IGTLDeviceSource