Medical Imaging Interaction Toolkit  2018.04.99-74b4982f
Medical Imaging Interaction Toolkit
mitkNDIProtocol.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 (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 
14 #ifndef MITKNDIPROTOCOL_H_HEADER_INCLUDED_
15 #define MITKNDIPROTOCOL_H_HEADER_INCLUDED_
16 
17 #include <itkObject.h>
18 #include <itkObjectFactory.h>
19 
20 #include <MitkIGTExports.h>
22 #include "mitkNDIPassiveTool.h"
23 
24 namespace mitk
25 {
26  class NDITrackingDevice;
27 
32  {
33  NDIOKAY = 0,
34  NDIERROR = 1,
40  NDICRCERROR, // reply has crc error, local computer detected the error
44  NDICRCDOESNOTMATCH, // command had crc error, tracking device detected the error
78  };
79 
86  class MITKIGT_EXPORT NDIProtocol : public itk::Object
87  {
88  public:
90  itkFactorylessNewMacro(Self);
91  itkCloneMacro(Self);
92  itkSetObjectMacro(TrackingDevice, NDITrackingDevice);
93 
101 
104  NDIErrorCode APIREV(std::string* revision);
105  NDIErrorCode PHINF(std::string portHandle, std::string* portInfo);
106  NDIErrorCode PSOUT(std::string portHandle, std::string state);
108  NDIErrorCode INIT();
109  NDIErrorCode DSTART();
110  NDIErrorCode DSTOP();
111  NDIErrorCode IRINIT();
112  NDIErrorCode IRCHK(bool* IRdetected);
113  NDIErrorCode PHSR(PHSRQueryType queryType, std::string* portHandles);
114  NDIErrorCode PHF(std::string* portHandle);
115  NDIErrorCode PHRQ(std::string* portHandle);
116  NDIErrorCode PVWR(std::string* portHandle, const unsigned char* sromData, unsigned int sromDataLength);
117  NDIErrorCode PINIT(std::string* portHandle);
118  NDIErrorCode PENA(std::string* portHandle, TrackingPriority prio);
119  NDIErrorCode PDIS(std::string* portHandle);
121  NDIErrorCode BEEP(unsigned char count);
122  NDIErrorCode SFLIST(std::string* info);
123  NDIErrorCode TSTART(bool resetFrameCounter = false);
124  NDIErrorCode TSTOP();
125  NDIErrorCode TX(bool trackIndividualMarkers = false, MarkerPointContainerType* markerPositions = nullptr);
126  NDIErrorCode BX();
127  NDIErrorCode POS3D(MarkerPointContainerType* markerPositions);
129  NDIErrorCode VSEL(mitk::TrackingDeviceData deviceData);
130  NDIErrorCode TX1000(MarkerPointContainerType* markerPositions);
131  unsigned int ByteToNbBitsOn(char& c) const;
132  itkGetConstMacro(UseCRC, bool);
133  itkSetMacro(UseCRC, bool);
134  itkBooleanMacro(UseCRC);
135  protected:
136  NDIProtocol();
137  ~NDIProtocol() override;
138 
144  NDIErrorCode ParseOkayError();
145 
151  NDIErrorCode GenericCommand(const std::string command, const std::string* parameter = nullptr);
152 
156  NDIErrorCode GetErrorCode(const std::string* input);
157 
159  bool m_UseCRC;
160  };
161 } // namespace mitk
162 #endif /* MITKNDIPROTOCOL_H_HEADER_INCLUDED_ */
mitk::SerialCommunication::StopBits StopBits
Number of stop bits used in the serial connection.
mitk::SerialCommunication::DataBits DataBits
Number of data bits used in the serial connection.
mitk::SerialCommunication::HardwareHandshake HardwareHandshake
Hardware handshake mode of the serial connection.
IlluminationActivationRate
activation rate of IR illuminator for NDI Polaris tracking device
DataCollection - Class to facilitate loading/accessing structured data.
PHSRQueryType
Query mode for NDI tracking devices.
mitk::NDIPassiveTool::TrackingPriority TrackingPriority
Tracking priority used for tracking a tool.
mitk::SerialCommunication::Parity Parity
Parity mode used in the serial connection.
#define MITKIGT_EXPORT
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:49
NDITrackingDevice * m_TrackingDevice
tracking device to which the commands will be send
Interface for all Tracking Devices.
mitk::SerialCommunication::BaudRate BaudRate
Baud rate of the serial connection.
std::vector< MarkerPointType > MarkerPointContainerType
std::string TrackingDeviceType
superclass for specific NDI tracking Devices that use serial communication.
TrackingPriority
tracking priority for NDI tracking devices
NDIErrorCode
Error codes of NDI tracking devices.
bool m_UseCRC
whether to append a CRC16 checksum to each message
The NDI Protocol class provides building and parsing of command strings and answers to and from a NDI...
mitk::SerialCommunication::PortNumber PortNumber
Port number of the serial connection.