MITK-IGT
IGT Extension of MITK
Loading...
Searching...
No Matches
mitk::NDITrackingDevice Class Reference

superclass for specific NDI tracking Devices that use serial communication. More...

#include <mitkNDITrackingDevice.h>

Inheritance diagram for mitk::NDITrackingDevice:
mitk::TrackingDevice

Public Types

typedef std::vector< NDIPassiveTool::Pointer > Tool6DContainerType
 List of 6D tools of the correct type for this tracking device.
 
typedef mitk::TrackingDeviceType NDITrackingDeviceType
 This enumeration includes the two types of NDI tracking devices (Polaris, Aurora).
 
typedef mitk::SerialCommunication::PortNumber PortNumber
 Port number of the serial connection.
 
typedef mitk::SerialCommunication::BaudRate BaudRate
 Baud rate of the serial connection.
 
typedef mitk::SerialCommunication::DataBits DataBits
 Number of data bits used in the serial connection.
 
typedef mitk::SerialCommunication::Parity Parity
 Parity mode used in the serial connection.
 
typedef mitk::SerialCommunication::StopBits StopBits
 Number of stop bits used in the serial connection.
 
typedef mitk::SerialCommunication::HardwareHandshake HardwareHandshake
 Hardware handshake mode of the serial connection.
 
typedef mitk::NDIPassiveTool::TrackingPriority TrackingPriority
 Tracking priority used for tracking a tool.
 
- Public Types inherited from mitk::TrackingDevice
enum  RotationMode { RotationStandard , RotationTransposed }
 
enum  TrackingDeviceState { Setup , Ready , Tracking }
 

Public Member Functions

 mitkClassMacro (NDITrackingDevice, TrackingDevice)
 
 itkFactorylessNewMacro (Self)
 
 itkCloneMacro (Self)
 
bool OpenConnection () override
 Set the type of the NDI Tracking Device because it can not jet handle this itself.
 
bool CloseConnection () override
 Closes the connection.
 
bool InitializeWiredTools ()
 
void SetRotationMode (RotationMode r) override
 
virtual mitk::TrackingDeviceType TestConnection ()
 TestConnection() tries to connect to a NDI tracking device on the current port/device and returns which device it has found.
 
bool DiscoverWiredTools ()
 retrieves all wired tools from the tracking device
 
bool StartTracking () override
 Start the tracking.
 
TrackingToolGetTool (unsigned int toolNumber) const override
 return the tool with index toolNumber
 
mitk::TrackingToolGetToolByName (std::string name) const override
 Returns the tool with the given tool name.
 
unsigned int GetToolCount () const override
 return current number of tools
 
mitk::TrackingToolAddTool (const char *toolName, const char *fileName, TrackingPriority p=NDIPassiveTool::Dynamic)
 Create a passive 6D tool with toolName and fileName and add it to the list of tools.
 
virtual bool RemoveTool (TrackingTool *tool)
 Remove a passive 6D tool from the list of tracked tools.
 
virtual bool UpdateTool (mitk::TrackingTool *tool)
 reloads the srom file and reinitializes the tool
 
virtual void SetPortNumber (const PortNumber _arg)
 set port number for serial communication
 
 itkGetConstMacro (PortNumber, PortNumber)
 returns the port number for serial communication
 
virtual void SetDeviceName (std::string _arg)
 set device name (e.g. COM1, /dev/ttyUSB0). If this is set, PortNumber will be ignored
 
 itkGetStringMacro (DeviceName)
 returns the device name for serial communication
 
virtual void SetBaudRate (const BaudRate _arg)
 set baud rate for serial communication
 
 itkGetConstMacro (BaudRate, BaudRate)
 returns the baud rate for serial communication
 
virtual void SetDataBits (const DataBits _arg)
 set number of data bits
 
 itkGetConstMacro (DataBits, DataBits)
 returns the data bits for serial communication
 
virtual void SetParity (const Parity _arg)
 set parity mode
 
 itkGetConstMacro (Parity, Parity)
 returns the parity mode
 
virtual void SetStopBits (const StopBits _arg)
 set number of stop bits
 
 itkGetConstMacro (StopBits, StopBits)
 returns the number of stop bits
 
virtual void SetHardwareHandshake (const HardwareHandshake _arg)
 set use hardware handshake for serial communication
 
 itkGetConstMacro (HardwareHandshake, HardwareHandshake)
 returns the hardware handshake setting
 
virtual void SetIlluminationActivationRate (const IlluminationActivationRate _arg)
 set activation rate of IR illumator for polaris
 
 itkGetConstMacro (IlluminationActivationRate, IlluminationActivationRate)
 returns the activation rate of IR illumator for polaris
 
virtual void SetDataTransferMode (const DataTransferMode _arg)
 set data transfer mode to text (TX) or binary (BX).
 
 itkGetConstMacro (DataTransferMode, DataTransferMode)
 returns the data transfer mode
 
virtual bool Beep (unsigned char count)
 Beep the tracking device 1 to 9 times.
 
NDIErrorCode GetErrorCode (const std::string *input)
 returns the error code for a string that contains an error code in hexadecimal format
 
virtual bool SetOperationMode (OperationMode mode)
 set operation mode to 6D tool tracking, 3D marker tracking or 6D&3D hybrid tracking (see OperationMode)
 
virtual OperationMode GetOperationMode ()
 get current operation mode
 
virtual bool GetMarkerPositions (MarkerPointContainerType *markerpositions)
 Get 3D marker positions (operation mode must be set to MarkerTracking3D or HybridTracking)
 
virtual int GetMajorFirmwareRevisionNumber ()
 Get major revision number from tracking device should not be called directly after starting to track.
 
virtual const char * GetFirmwareRevisionNumber ()
 Get revision number from tracking device as string should not be called directly after starting to track.
 
bool AutoDetectToolsAvailable () override
 
bool AddSingleToolIsAvailable () override
 
mitk::NavigationToolStorage::Pointer AutoDetectTools () override
 
virtual void TrackTools ()
 TrackTools() continuously polls serial interface for new 6d tool positions until StopTracking is called.
 
virtual void TrackMarkerPositions ()
 continuously polls serial interface for new 3D marker positions until StopTracking is called.
 
virtual void TrackToolsAndMarkers ()
 continuously polls serial interface for new 3D marker positions and 6D tool positions until StopTracking is called.
 
void ThreadStartTracking ()
 start method for the tracking thread.
 
- Public Member Functions inherited from mitk::TrackingDevice
 mitkClassMacroItkParent (TrackingDevice, itk::Object)
 
virtual bool StopTracking ()
 stop retrieving tracking data from the device. stop retrieving tracking data from the device. This may only be called after StartTracking was called (e.g. the object is in Tracking mode). This will change the object state from Tracking to Ready.
 
 itkGetConstMacro (RotationMode, RotationMode)
 
TrackingDeviceState GetState () const
 return current object state (Setup, Ready or Tracking)
 
TrackingDeviceType GetType () const
 Deprecated! Use the more specific getData or GetTrackingDeviceName instead. return device type identifier.
 
void SetType (TrackingDeviceType type)
 Deprecated! Use the more specific setDeviceData instead. set device type.
 
std::string GetTrackingDeviceName ()
 Convenient Method to get the Name of the Tracking Device. This is identical with GetData().Line and can be used to compare with TrackingDeviceTypeInformation::GetTrackingDeviceName() to check if you have a specific device.
 
TrackingDeviceData GetData () const
 return device data
 
void SetData (TrackingDeviceData data)
 set device type
 
virtual bool IsDeviceInstalled ()
 

Protected Types

typedef std::vector< std::string > NDITrackingVolumeContainerType
 vector of tracking volumes
 
typedef std::vector< int > TrackingVolumeDimensionType
 List of the supported tracking volume dimensions.
 

Protected Member Functions

virtual bool GetSupportedVolumes (unsigned int *numberOfVolumes, NDITrackingVolumeContainerType *volumes, TrackingVolumeDimensionType *volumesDimensions)
 Get number of supported tracking volumes, a vector containing the supported volumes and a vector containing the signed dimensions in mm. For each volume 10 boundaries are stored in the order of the supported volumes (see AURORA API GUIDE: SFLIST p.54).
 
virtual bool SetVolume (mitk::TrackingDeviceData volume)
 Sets the desired tracking volume. Returns true if the volume type could be set. It is set in the OpenConnection() Method and sets the tracking volume out of m_Data.
 
virtual bool InternalAddTool (NDIPassiveTool *tool)
 Add a passive 6D tool to the list of tracked tools. This method is used by AddTool.
 
virtual void InvalidateAll ()
 invalidate all tools
 
NDIPassiveToolGetInternalTool (std::string portHandle)
 returns the tool object that has been assigned the port handle or nullptr if no tool can be found
 
NDIErrorCode FreePortHandles ()
 free all port handles that need to be freed
 
NDIErrorCode Send (const std::string *message, bool addCRC=true)
 Send message to tracking device.
 
NDIErrorCode Receive (std::string *answer, unsigned int numberOfBytes)
 receive numberOfBytes bytes from tracking device
 
NDIErrorCode ReceiveByte (char *answer)
 lightweight receive function, that reads just one byte
 
NDIErrorCode ReceiveLine (std::string *answer)
 receive characters until the first LF (The LF is included in the answer string)
 
void ClearSendBuffer ()
 empty send buffer of serial communication interface
 
void ClearReceiveBuffer ()
 empty receive buffer of serial communication interface
 
const std::string CalcCRC (const std::string *input)
 returns the CRC16 for input as a std::string
 
 NDITrackingDevice ()
 Constructor.
 
 ~NDITrackingDevice () override
 Destructor.
 
- Protected Member Functions inherited from mitk::TrackingDevice
void SetState (TrackingDeviceState state)
 change object state
 
 TrackingDevice ()
 
 ~TrackingDevice () override
 

Protected Attributes

std::string m_DeviceName
 Device Name.
 
PortNumber m_PortNumber
 COM Port Number.
 
BaudRate m_BaudRate
 COM Port Baud Rate.
 
DataBits m_DataBits
 Number of Data Bits per token.
 
Parity m_Parity
 Parity mode for communication.
 
StopBits m_StopBits
 number of stop bits per token
 
HardwareHandshake m_HardwareHandshake
 which tracking volume is currently used (if device supports multiple volumes) (
 
IlluminationActivationRate m_IlluminationActivationRate
 update rate of IR illuminator for Polaris
 
DataTransferMode m_DataTransferMode
 use TX (text) or BX (binary) (
 
Tool6DContainerType m_6DTools
 list of 6D tools
 
std::mutex m_ToolsMutex
 mutex for coordinated access of tool container
 
mitk::SerialCommunication::Pointer m_SerialCommunication
 serial communication interface
 
std::mutex m_SerialCommunicationMutex
 mutex for coordinated access of serial communication interface
 
NDIProtocol::Pointer m_DeviceProtocol
 create and parse NDI protocol strings
 
std::thread m_Thread
 ID of tracking thread.
 
OperationMode m_OperationMode
 tracking mode (6D tool tracking, 3D marker tracking,...)
 
std::mutex m_MarkerPointsMutex
 mutex for marker point data container
 
MarkerPointContainerType m_MarkerPoints
 container for markers (3D point tracking mode)
 
- Protected Attributes inherited from mitk::TrackingDevice
TrackingDeviceData m_Data
 current device Data
 
bool m_StopTracking
 signal stop to tracking thread
 
std::mutex m_StopTrackingMutex
 mutex to control access to m_StopTracking
 
std::mutex m_TrackingFinishedMutex
 mutex to manage control flow of StopTracking()
 
std::mutex m_StateMutex
 mutex to control access to m_State
 
RotationMode m_RotationMode
 defines the rotation mode Standard or Transposed, Standard is default
 

Friends

class NDIProtocol
 

Detailed Description

superclass for specific NDI tracking Devices that use serial communication.

Documentation

implements the TrackingDevice interface for NDI tracking devices (POLARIS, AURORA)

Definition at line 40 of file mitkNDITrackingDevice.h.

Member Typedef Documentation

◆ BaudRate

Baud rate of the serial connection.

Definition at line 49 of file mitkNDITrackingDevice.h.

◆ DataBits

Number of data bits used in the serial connection.

Definition at line 50 of file mitkNDITrackingDevice.h.

◆ HardwareHandshake

Hardware handshake mode of the serial connection.

Definition at line 53 of file mitkNDITrackingDevice.h.

◆ NDITrackingDeviceType

This enumeration includes the two types of NDI tracking devices (Polaris, Aurora).

Definition at line 47 of file mitkNDITrackingDevice.h.

◆ NDITrackingVolumeContainerType

std::vector<std::string> mitk::NDITrackingDevice::NDITrackingVolumeContainerType
protected

vector of tracking volumes

Definition at line 220 of file mitkNDITrackingDevice.h.

◆ Parity

Parity mode used in the serial connection.

Definition at line 51 of file mitkNDITrackingDevice.h.

◆ PortNumber

Port number of the serial connection.

Definition at line 48 of file mitkNDITrackingDevice.h.

◆ StopBits

Number of stop bits used in the serial connection.

Definition at line 52 of file mitkNDITrackingDevice.h.

◆ Tool6DContainerType

std::vector<NDIPassiveTool::Pointer> mitk::NDITrackingDevice::Tool6DContainerType

List of 6D tools of the correct type for this tracking device.

Definition at line 45 of file mitkNDITrackingDevice.h.

◆ TrackingPriority

Tracking priority used for tracking a tool.

Definition at line 54 of file mitkNDITrackingDevice.h.

◆ TrackingVolumeDimensionType

List of the supported tracking volume dimensions.

Definition at line 221 of file mitkNDITrackingDevice.h.

Constructor & Destructor Documentation

◆ NDITrackingDevice()

mitk::NDITrackingDevice::NDITrackingDevice ( )
protected

Constructor.

Definition at line 31 of file mitkNDITrackingDevice.cpp.

◆ ~NDITrackingDevice()

mitk::NDITrackingDevice::~NDITrackingDevice ( )
overrideprotected

Destructor.

Definition at line 85 of file mitkNDITrackingDevice.cpp.

Member Function Documentation

◆ AddSingleToolIsAvailable()

bool mitk::NDITrackingDevice::AddSingleToolIsAvailable ( )
overridevirtual
Returns
Returns true if it is possible to add a single tool. True for Polaris, false for Aurora.

Reimplemented from mitk::TrackingDevice.

Definition at line 1215 of file mitkNDITrackingDevice.cpp.

◆ AddTool()

mitk::TrackingTool * mitk::NDITrackingDevice::AddTool ( const char * toolName,
const char * fileName,
TrackingPriority p = NDIPassiveTool::Dynamic )

Create a passive 6D tool with toolName and fileName and add it to the list of tools.

This method will create a new NDIPassiveTool object, load the SROM file fileName, set the tool name toolName and the tracking priority p and then add it to the list of tools. It returns a pointer of type mitk::TrackingTool to the tool that can be used to read tracking data from it. This is the only way to add tools to NDITrackingDevice.

Exceptions
mitk::IGTHardwareExceptionThrows an exception if there are errors while adding the tool.
Warning
adding tools is not possible in tracking mode, only in setup and ready.

Definition at line 883 of file mitkNDITrackingDevice.cpp.

◆ AutoDetectTools()

mitk::NavigationToolStorage::Pointer mitk::NDITrackingDevice::AutoDetectTools ( )
overridevirtual

Autodetects tools from this device and returns them as a navigation tool storage.

Returns
Returns the detected tools. Returns an empty storage if no tools are present or if detection is not possible

Reimplemented from mitk::TrackingDevice.

Definition at line 1223 of file mitkNDITrackingDevice.cpp.

◆ AutoDetectToolsAvailable()

bool mitk::NDITrackingDevice::AutoDetectToolsAvailable ( )
overridevirtual
Returns
Returns true if this device can autodetects its tools.

Reimplemented from mitk::TrackingDevice.

Definition at line 1209 of file mitkNDITrackingDevice.cpp.

◆ Beep()

bool mitk::NDITrackingDevice::Beep ( unsigned char count)
virtual

Beep the tracking device 1 to 9 times.

Definition at line 871 of file mitkNDITrackingDevice.cpp.

◆ CalcCRC()

const std::string mitk::NDITrackingDevice::CalcCRC ( const std::string * input)
protected

returns the CRC16 for input as a std::string

Definition at line 307 of file mitkNDITrackingDevice.cpp.

◆ ClearReceiveBuffer()

void mitk::NDITrackingDevice::ClearReceiveBuffer ( )
protected

empty receive buffer of serial communication interface

Definition at line 301 of file mitkNDITrackingDevice.cpp.

◆ ClearSendBuffer()

void mitk::NDITrackingDevice::ClearSendBuffer ( )
protected

empty send buffer of serial communication interface

Definition at line 295 of file mitkNDITrackingDevice.cpp.

◆ CloseConnection()

bool mitk::NDITrackingDevice::CloseConnection ( )
overridevirtual

Closes the connection.

CloseConnection() resets the tracking device, invalidates all tools and then closes the serial port.

Implements mitk::TrackingDevice.

Definition at line 659 of file mitkNDITrackingDevice.cpp.

◆ DiscoverWiredTools()

bool mitk::NDITrackingDevice::DiscoverWiredTools ( )

retrieves all wired tools from the tracking device

This method queries the tracking device for all wired tools, initializes them and creates TrackingTool representation objects for them

Returns
True if the method was executed successful.
Exceptions
mitk::IGTHardwareExceptionThrows an exception if there are errors while connecting to the device.
mitk::IGTExceptionThrows a normal IGT exception if an error occures which is not related to the hardware.

NDI handling (PHSR 02, PINIT, PHSR 02, PHSR 00) => all initialized and all handles available

  1. Create MITK tracking tool representations of NDI tools
  2. NDI enable all tools (PENA)

NDI get all serial numbers (PHINF)

Definition at line 1032 of file mitkNDITrackingDevice.cpp.

◆ FreePortHandles()

mitk::NDIErrorCode mitk::NDITrackingDevice::FreePortHandles ( )
protected

free all port handles that need to be freed

This method retrieves a list of all port handles that need to be freed (e.g. tool got disconnected) and frees the handles at the tracking device and it removes the tools from the internal tool list

Warning
This method can remove TrackingTools from the tool list! After calling this method, GetTool(i) could return a different tool, because tool indices could have changed.
Exceptions
mitk::IGTHardwareExceptionThrows an exception if there are errors while communicating with the device.
Returns
returns NDIOKAY if everything was sucessfull, returns an error code otherwise

Definition at line 1144 of file mitkNDITrackingDevice.cpp.

◆ GetErrorCode()

NDIErrorCode mitk::NDITrackingDevice::GetErrorCode ( const std::string * input)

returns the error code for a string that contains an error code in hexadecimal format

◆ GetFirmwareRevisionNumber()

const char * mitk::NDITrackingDevice::GetFirmwareRevisionNumber ( )
virtual

Get revision number from tracking device as string should not be called directly after starting to track.

Definition at line 1197 of file mitkNDITrackingDevice.cpp.

◆ GetInternalTool()

mitk::NDIPassiveTool * mitk::NDITrackingDevice::GetInternalTool ( std::string portHandle)
protected

returns the tool object that has been assigned the port handle or nullptr if no tool can be found

Definition at line 855 of file mitkNDITrackingDevice.cpp.

◆ GetMajorFirmwareRevisionNumber()

int mitk::NDITrackingDevice::GetMajorFirmwareRevisionNumber ( )
virtual

Get major revision number from tracking device should not be called directly after starting to track.

Definition at line 1183 of file mitkNDITrackingDevice.cpp.

◆ GetMarkerPositions()

bool mitk::NDITrackingDevice::GetMarkerPositions ( MarkerPointContainerType * markerpositions)
virtual

Get 3D marker positions (operation mode must be set to MarkerTracking3D or HybridTracking)

Definition at line 1024 of file mitkNDITrackingDevice.cpp.

◆ GetOperationMode()

mitk::OperationMode mitk::NDITrackingDevice::GetOperationMode ( )
virtual

get current operation mode

Definition at line 1019 of file mitkNDITrackingDevice.cpp.

◆ GetSupportedVolumes()

bool mitk::NDITrackingDevice::GetSupportedVolumes ( unsigned int * numberOfVolumes,
NDITrackingVolumeContainerType * volumes,
TrackingVolumeDimensionType * volumesDimensions )
protectedvirtual

Get number of supported tracking volumes, a vector containing the supported volumes and a vector containing the signed dimensions in mm. For each volume 10 boundaries are stored in the order of the supported volumes (see AURORA API GUIDE: SFLIST p.54).

Definition at line 1257 of file mitkNDITrackingDevice.cpp.

◆ GetTool()

mitk::TrackingTool * mitk::NDITrackingDevice::GetTool ( unsigned int toolNumber) const
overridevirtual

return the tool with index toolNumber

Implements mitk::TrackingDevice.

Definition at line 837 of file mitkNDITrackingDevice.cpp.

◆ GetToolByName()

mitk::TrackingTool * mitk::NDITrackingDevice::GetToolByName ( std::string name) const
overridevirtual

Returns the tool with the given tool name.

Note: subclasses can and should implement optimized versions of this method

Returns
the given tool or nullptr if no tool with that name exists

Reimplemented from mitk::TrackingDevice.

Definition at line 845 of file mitkNDITrackingDevice.cpp.

◆ GetToolCount()

unsigned int mitk::NDITrackingDevice::GetToolCount ( ) const
overridevirtual

return current number of tools

Implements mitk::TrackingDevice.

Definition at line 865 of file mitkNDITrackingDevice.cpp.

◆ InitializeWiredTools()

bool mitk::NDITrackingDevice::InitializeWiredTools ( )
Exceptions
mitk::IGTHardwareExceptionThrows an exception if there are errors while connecting to the device.

Definition at line 542 of file mitkNDITrackingDevice.cpp.

◆ InternalAddTool()

bool mitk::NDITrackingDevice::InternalAddTool ( mitk::NDIPassiveTool * tool)
protectedvirtual

Add a passive 6D tool to the list of tracked tools. This method is used by AddTool.

Exceptions
mitk::IGTHardwareExceptionThrows an exception if there are errors while adding the tool.
Warning
adding tools is not possible in tracking mode, only in setup and ready.

Definition at line 895 of file mitkNDITrackingDevice.cpp.

◆ InvalidateAll()

void mitk::NDITrackingDevice::InvalidateAll ( )
protectedvirtual

invalidate all tools

Definition at line 1002 of file mitkNDITrackingDevice.cpp.

◆ itkCloneMacro()

mitk::NDITrackingDevice::itkCloneMacro ( Self )

◆ itkFactorylessNewMacro()

mitk::NDITrackingDevice::itkFactorylessNewMacro ( Self )

◆ itkGetConstMacro() [1/8]

mitk::NDITrackingDevice::itkGetConstMacro ( BaudRate ,
BaudRate  )

returns the baud rate for serial communication

◆ itkGetConstMacro() [2/8]

mitk::NDITrackingDevice::itkGetConstMacro ( DataBits ,
DataBits  )

returns the data bits for serial communication

◆ itkGetConstMacro() [3/8]

mitk::NDITrackingDevice::itkGetConstMacro ( DataTransferMode ,
DataTransferMode  )

returns the data transfer mode

◆ itkGetConstMacro() [4/8]

mitk::NDITrackingDevice::itkGetConstMacro ( HardwareHandshake ,
HardwareHandshake  )

returns the hardware handshake setting

◆ itkGetConstMacro() [5/8]

mitk::NDITrackingDevice::itkGetConstMacro ( IlluminationActivationRate ,
IlluminationActivationRate  )

returns the activation rate of IR illumator for polaris

◆ itkGetConstMacro() [6/8]

mitk::NDITrackingDevice::itkGetConstMacro ( Parity ,
Parity  )

returns the parity mode

◆ itkGetConstMacro() [7/8]

mitk::NDITrackingDevice::itkGetConstMacro ( PortNumber ,
PortNumber  )

returns the port number for serial communication

◆ itkGetConstMacro() [8/8]

mitk::NDITrackingDevice::itkGetConstMacro ( StopBits ,
StopBits  )

returns the number of stop bits

◆ itkGetStringMacro()

mitk::NDITrackingDevice::itkGetStringMacro ( DeviceName )

returns the device name for serial communication

◆ mitkClassMacro()

mitk::NDITrackingDevice::mitkClassMacro ( NDITrackingDevice ,
TrackingDevice  )

◆ OpenConnection()

bool mitk::NDITrackingDevice::OpenConnection ( )
overridevirtual

Set the type of the NDI Tracking Device because it can not jet handle this itself.

initialize the connection to the tracking device

OpenConnection() establishes the connection to the tracking device by:

  • initializing the serial port with the given parameters (port number, baud rate, ...)
  • connection to the tracking device
  • initializing the device
  • initializing all manually added passive tools (user supplied srom file)
  • initializing active tools that are connected to the tracking device
    Exceptions
    mitk::IGTHardwareExceptionThrows an exception if there are errors while connecting to the device.
    mitk::IGTExceptionThrows a normal IGT exception if an error occures which is not related to the hardware.

now add tools to the tracking system

POLARIS: initialize the tools that were added manually

Implements mitk::TrackingDevice.

Definition at line 336 of file mitkNDITrackingDevice.cpp.

◆ Receive()

mitk::NDIErrorCode mitk::NDITrackingDevice::Receive ( std::string * answer,
unsigned int numberOfBytes )
protected

receive numberOfBytes bytes from tracking device

Definition at line 244 of file mitkNDITrackingDevice.cpp.

◆ ReceiveByte()

mitk::NDIErrorCode mitk::NDITrackingDevice::ReceiveByte ( char * answer)
protected

lightweight receive function, that reads just one byte

Definition at line 258 of file mitkNDITrackingDevice.cpp.

◆ ReceiveLine()

mitk::NDIErrorCode mitk::NDITrackingDevice::ReceiveLine ( std::string * answer)
protected

receive characters until the first LF (The LF is included in the answer string)

Definition at line 276 of file mitkNDITrackingDevice.cpp.

◆ RemoveTool()

bool mitk::NDITrackingDevice::RemoveTool ( mitk::TrackingTool * tool)
virtual

Remove a passive 6D tool from the list of tracked tools.

Warning
removing tools is not possible in tracking mode, only in setup and ready modes.

Definition at line 954 of file mitkNDITrackingDevice.cpp.

◆ Send()

mitk::NDIErrorCode mitk::NDITrackingDevice::Send ( const std::string * message,
bool addCRC = true )
protected

Send message to tracking device.

Definition at line 218 of file mitkNDITrackingDevice.cpp.

◆ SetBaudRate()

void mitk::NDITrackingDevice::SetBaudRate ( const BaudRate _arg)
virtual

set baud rate for serial communication

Definition at line 134 of file mitkNDITrackingDevice.cpp.

◆ SetDataBits()

void mitk::NDITrackingDevice::SetDataBits ( const DataBits _arg)
virtual

set number of data bits

Definition at line 146 of file mitkNDITrackingDevice.cpp.

◆ SetDataTransferMode()

void mitk::NDITrackingDevice::SetDataTransferMode ( const DataTransferMode _arg)
virtual

set data transfer mode to text (TX) or binary (BX).

Warning
: only TX is supportet at the moment

Definition at line 208 of file mitkNDITrackingDevice.cpp.

◆ SetDeviceName()

void mitk::NDITrackingDevice::SetDeviceName ( std::string _arg)
virtual

set device name (e.g. COM1, /dev/ttyUSB0). If this is set, PortNumber will be ignored

Definition at line 122 of file mitkNDITrackingDevice.cpp.

◆ SetHardwareHandshake()

void mitk::NDITrackingDevice::SetHardwareHandshake ( const HardwareHandshake _arg)
virtual

set use hardware handshake for serial communication

Definition at line 182 of file mitkNDITrackingDevice.cpp.

◆ SetIlluminationActivationRate()

void mitk::NDITrackingDevice::SetIlluminationActivationRate ( const IlluminationActivationRate _arg)
virtual

set activation rate of IR illumator for polaris

Definition at line 194 of file mitkNDITrackingDevice.cpp.

◆ SetOperationMode()

bool mitk::NDITrackingDevice::SetOperationMode ( OperationMode mode)
virtual

set operation mode to 6D tool tracking, 3D marker tracking or 6D&3D hybrid tracking (see OperationMode)

Definition at line 1010 of file mitkNDITrackingDevice.cpp.

◆ SetParity()

void mitk::NDITrackingDevice::SetParity ( const Parity _arg)
virtual

set parity mode

Definition at line 158 of file mitkNDITrackingDevice.cpp.

◆ SetPortNumber()

void mitk::NDITrackingDevice::SetPortNumber ( const PortNumber _arg)
virtual

set port number for serial communication

Definition at line 110 of file mitkNDITrackingDevice.cpp.

◆ SetRotationMode()

void mitk::NDITrackingDevice::SetRotationMode ( RotationMode r)
overridevirtual

Sets the rotation mode of this class. See documentation of enum RotationMode for details on the different modes.

Reimplemented from mitk::TrackingDevice.

Definition at line 80 of file mitkNDITrackingDevice.cpp.

◆ SetStopBits()

void mitk::NDITrackingDevice::SetStopBits ( const StopBits _arg)
virtual

set number of stop bits

Definition at line 170 of file mitkNDITrackingDevice.cpp.

◆ SetVolume()

bool mitk::NDITrackingDevice::SetVolume ( mitk::TrackingDeviceData volume)
protectedvirtual

Sets the desired tracking volume. Returns true if the volume type could be set. It is set in the OpenConnection() Method and sets the tracking volume out of m_Data.

Exceptions
mitk::IGTHardwareExceptionThrows an IGT hardware exception if the volume could not be set.

Definition at line 1317 of file mitkNDITrackingDevice.cpp.

◆ StartTracking()

bool mitk::NDITrackingDevice::StartTracking ( )
overridevirtual

Start the tracking.

A new thread is created, which continuously reads the position and orientation information of each tool and stores them inside the tools. Depending on the current operation mode (see SetOperationMode()), either the 6D tools (ToolTracking6D), 5D tools (ToolTracking5D), 3D marker positions (MarkerTracking3D) or both 6D tools and 3D markers (HybridTracking) are updated. Call StopTracking() to stop the tracking thread.

Implements mitk::TrackingDevice.

Definition at line 690 of file mitkNDITrackingDevice.cpp.

◆ TestConnection()

mitk::TrackingDeviceType mitk::NDITrackingDevice::TestConnection ( )
virtual

TestConnection() tries to connect to a NDI tracking device on the current port/device and returns which device it has found.

TestConnection() tries to connect to a NDI tracking device on the current port/device.

Returns
It returns the type of the device that answers at the port/device. Throws an exception if no device is available on that port.
Exceptions
mitk::IGTHardwareExceptionThrows an exception if there are errors while connecting to the device.

Definition at line 591 of file mitkNDITrackingDevice.cpp.

◆ ThreadStartTracking()

void mitk::NDITrackingDevice::ThreadStartTracking ( )

start method for the tracking thread.

Definition at line 676 of file mitkNDITrackingDevice.cpp.

◆ TrackMarkerPositions()

void mitk::NDITrackingDevice::TrackMarkerPositions ( )
virtual

continuously polls serial interface for new 3D marker positions until StopTracking is called.

Continuously tracks the 3D position of all markers until StopTracking() is called. This function is executed by the tracking thread (through StartTracking() and ThreadStartTracking()). It should not be called directly.

Definition at line 752 of file mitkNDITrackingDevice.cpp.

◆ TrackTools()

void mitk::NDITrackingDevice::TrackTools ( )
virtual

TrackTools() continuously polls serial interface for new 6d tool positions until StopTracking is called.

Continuously tracks the 6D position of all tools until StopTracking() is called. This function is executed by the tracking thread (through StartTracking() and ThreadStartTracking()). It should not be called directly.

Exceptions
mitk::IGTHardwareExceptionThrows an exception if there are errors while tracking the tools.

Definition at line 705 of file mitkNDITrackingDevice.cpp.

◆ TrackToolsAndMarkers()

void mitk::NDITrackingDevice::TrackToolsAndMarkers ( )
virtual

continuously polls serial interface for new 3D marker positions and 6D tool positions until StopTracking is called.

Continuously tracks the 3D position of all markers and the 6D position of all tools until StopTracking() is called. This function is executed by the tracking thread (through StartTracking() and ThreadStartTracking()). It should not be called directly.

Definition at line 797 of file mitkNDITrackingDevice.cpp.

◆ UpdateTool()

bool mitk::NDITrackingDevice::UpdateTool ( mitk::TrackingTool * tool)
virtual

reloads the srom file and reinitializes the tool

Definition at line 47 of file mitkNDITrackingDevice.cpp.

Friends And Related Symbol Documentation

◆ NDIProtocol

friend class NDIProtocol
friend

Definition at line 42 of file mitkNDITrackingDevice.h.

Member Data Documentation

◆ m_6DTools

Tool6DContainerType mitk::NDITrackingDevice::m_6DTools
protected

list of 6D tools

Definition at line 316 of file mitkNDITrackingDevice.h.

◆ m_BaudRate

BaudRate mitk::NDITrackingDevice::m_BaudRate
protected

COM Port Baud Rate.

Definition at line 308 of file mitkNDITrackingDevice.h.

◆ m_DataBits

DataBits mitk::NDITrackingDevice::m_DataBits
protected

Number of Data Bits per token.

Definition at line 309 of file mitkNDITrackingDevice.h.

◆ m_DataTransferMode

DataTransferMode mitk::NDITrackingDevice::m_DataTransferMode
protected

use TX (text) or BX (binary) (

Warning
currently, only TX mode is supported)

Definition at line 315 of file mitkNDITrackingDevice.h.

◆ m_DeviceName

std::string mitk::NDITrackingDevice::m_DeviceName
protected

Device Name.

Definition at line 306 of file mitkNDITrackingDevice.h.

◆ m_DeviceProtocol

NDIProtocol::Pointer mitk::NDITrackingDevice::m_DeviceProtocol
protected

create and parse NDI protocol strings

Definition at line 321 of file mitkNDITrackingDevice.h.

◆ m_HardwareHandshake

HardwareHandshake mitk::NDITrackingDevice::m_HardwareHandshake
protected

which tracking volume is currently used (if device supports multiple volumes) (

use hardware handshake for serial port connection

Warning
This parameter is not used yet)

Definition at line 312 of file mitkNDITrackingDevice.h.

◆ m_IlluminationActivationRate

IlluminationActivationRate mitk::NDITrackingDevice::m_IlluminationActivationRate
protected

update rate of IR illuminator for Polaris

Definition at line 314 of file mitkNDITrackingDevice.h.

◆ m_MarkerPoints

MarkerPointContainerType mitk::NDITrackingDevice::m_MarkerPoints
protected

container for markers (3D point tracking mode)

Definition at line 326 of file mitkNDITrackingDevice.h.

◆ m_MarkerPointsMutex

std::mutex mitk::NDITrackingDevice::m_MarkerPointsMutex
protected

mutex for marker point data container

Definition at line 325 of file mitkNDITrackingDevice.h.

◆ m_OperationMode

OperationMode mitk::NDITrackingDevice::m_OperationMode
protected

tracking mode (6D tool tracking, 3D marker tracking,...)

Definition at line 324 of file mitkNDITrackingDevice.h.

◆ m_Parity

Parity mitk::NDITrackingDevice::m_Parity
protected

Parity mode for communication.

Definition at line 310 of file mitkNDITrackingDevice.h.

◆ m_PortNumber

PortNumber mitk::NDITrackingDevice::m_PortNumber
protected

COM Port Number.

Definition at line 307 of file mitkNDITrackingDevice.h.

◆ m_SerialCommunication

mitk::SerialCommunication::Pointer mitk::NDITrackingDevice::m_SerialCommunication
protected

serial communication interface

Definition at line 319 of file mitkNDITrackingDevice.h.

◆ m_SerialCommunicationMutex

std::mutex mitk::NDITrackingDevice::m_SerialCommunicationMutex
protected

mutex for coordinated access of serial communication interface

Definition at line 320 of file mitkNDITrackingDevice.h.

◆ m_StopBits

StopBits mitk::NDITrackingDevice::m_StopBits
protected

number of stop bits per token

Definition at line 311 of file mitkNDITrackingDevice.h.

◆ m_Thread

std::thread mitk::NDITrackingDevice::m_Thread
protected

ID of tracking thread.

Definition at line 323 of file mitkNDITrackingDevice.h.

◆ m_ToolsMutex

std::mutex mitk::NDITrackingDevice::m_ToolsMutex
mutableprotected

mutex for coordinated access of tool container

Definition at line 318 of file mitkNDITrackingDevice.h.


The documentation for this class was generated from the following files: