Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitk::NDITrackingDevice Class Reference

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

#include <mitkNDITrackingDevice.h>

Inheritance diagram for mitk::NDITrackingDevice:
Collaboration diagram for mitk::NDITrackingDevice:

Public Types

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

Public Member Functions

 mitkClassMacro (NDITrackingDevice, TrackingDevice)
 
Pointer Clone () const
 
virtual bool OpenConnection () override
 Set the type of the NDI Tracking Device because it can not jet handle this itself. More...
 
virtual bool CloseConnection () override
 Closes the connection. More...
 
bool InitializeWiredTools ()
 
virtual 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. More...
 
bool DiscoverWiredTools ()
 retrieves all wired tools from the tracking device More...
 
virtual bool StartTracking () override
 Start the tracking. More...
 
virtual TrackingToolGetTool (unsigned int toolNumber) const override
 return the tool with index toolNumber More...
 
virtual mitk::TrackingToolGetToolByName (std::string name) const override
 Returns the tool with the given tool name. More...
 
virtual unsigned int GetToolCount () const override
 return current number of tools More...
 
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. More...
 
virtual bool RemoveTool (TrackingTool *tool)
 Remove a passive 6D tool from the list of tracked tools. More...
 
virtual bool UpdateTool (mitk::TrackingTool *tool)
 reloads the srom file and reinitializes the tool More...
 
virtual void SetPortNumber (const PortNumber _arg)
 set port number for serial communication More...
 
virtual PortNumber GetPortNumber () const
 
virtual void SetDeviceName (std::string _arg)
 returns the port number for serial communication More...
 
virtual const char * GetDeviceName () const
 
virtual void SetBaudRate (const BaudRate _arg)
 returns the device name for serial communication More...
 
virtual BaudRate GetBaudRate () const
 
virtual void SetDataBits (const DataBits _arg)
 returns the baud rate for serial communication More...
 
virtual DataBits GetDataBits () const
 
virtual void SetParity (const Parity _arg)
 returns the data bits for serial communication More...
 
virtual Parity GetParity () const
 
virtual void SetStopBits (const StopBits _arg)
 returns the parity mode More...
 
virtual StopBits GetStopBits () const
 
virtual void SetHardwareHandshake (const HardwareHandshake _arg)
 returns the number of stop bits More...
 
virtual HardwareHandshake GetHardwareHandshake () const
 
virtual void SetIlluminationActivationRate (const IlluminationActivationRate _arg)
 returns the hardware handshake setting More...
 
virtual IlluminationActivationRate GetIlluminationActivationRate () const
 
virtual void SetDataTransferMode (const DataTransferMode _arg)
 returns the activation rate of IR illumator for polaris More...
 
virtual DataTransferMode GetDataTransferMode () const
 
virtual bool Beep (unsigned char count)
 returns the data transfer mode More...
 
NDIErrorCode GetErrorCode (const std::string *input)
 returns the error code for a string that contains an error code in hexadecimal format More...
 
virtual bool SetOperationMode (OperationMode mode)
 set operation mode to 6D tool tracking, 3D marker tracking or 6D&3D hybrid tracking (see OperationMode) More...
 
virtual OperationMode GetOperationMode ()
 get current operation mode More...
 
virtual bool GetMarkerPositions (MarkerPointContainerType *markerpositions)
 Get 3D marker positions (operation mode must be set to MarkerTracking3D or HybridTracking) More...
 
virtual int GetMajorFirmwareRevisionNumber ()
 Get major revision number from tracking device should not be called directly after starting to track. More...
 
virtual const char * GetFirmwareRevisionNumber ()
 Get revision number from tracking device as string should not be called directly after starting to track. More...
 
virtual void TrackTools ()
 TrackTools() continuously polls serial interface for new 6d tool positions until StopTracking is called. More...
 
virtual void TrackMarkerPositions ()
 continuously polls serial interface for new 3D marker positions until StopTracking is called. More...
 
virtual void TrackToolsAndMarkers ()
 continuously polls serial interface for new 3D marker positions and 6D tool positions until StopTracking is called. More...
 
- 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. More...
 
virtual RotationMode GetRotationMode () const
 
TrackingDeviceState GetState () const
 return current object state (Setup, Ready or Tracking) More...
 
TrackingDeviceType GetType () const
 Deprecated! Use the more specific getDeviceData instead. return device type identifier. More...
 
void SetType (TrackingDeviceType type)
 Deprecated! Use the more specific setDeviceData instead. set device type. More...
 
TrackingDeviceData GetData () const
 return device data More...
 
void SetData (TrackingDeviceData data)
 set device type More...
 
virtual bool IsDeviceInstalled ()
 

Static Public Member Functions

static Pointer New ()
 
static ITK_THREAD_RETURN_TYPE ThreadStartTracking (void *data)
 static start method for the tracking thread. More...
 

Protected Types

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

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). More...
 
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. More...
 
virtual bool InternalAddTool (NDIPassiveTool *tool)
 Add a passive 6D tool to the list of tracked tools. This method is used by AddTool. More...
 
virtual void InvalidateAll ()
 invalidate all tools More...
 
NDIPassiveToolGetInternalTool (std::string portHandle)
 returns the tool object that has been assigned the port handle or NULL if no tool can be found More...
 
NDIErrorCode FreePortHandles ()
 free all port handles that need to be freed More...
 
NDIErrorCode Send (const std::string *message, bool addCRC=true)
 Send message to tracking device. More...
 
NDIErrorCode Receive (std::string *answer, unsigned int numberOfBytes)
 receive numberOfBytes bytes from tracking device More...
 
NDIErrorCode ReceiveByte (char *answer)
 lightweight receive function, that reads just one byte More...
 
NDIErrorCode ReceiveLine (std::string *answer)
 receive characters until the first LF (The LF is included in the answer string) More...
 
void ClearSendBuffer ()
 empty send buffer of serial communication interface More...
 
void ClearReceiveBuffer ()
 empty receive buffer of serial communication interface More...
 
const std::string CalcCRC (const std::string *input)
 returns the CRC16 for input as a std::string More...
 
 NDITrackingDevice ()
 Constructor. More...
 
virtual ~NDITrackingDevice ()
 Destructor. More...
 
- Protected Member Functions inherited from mitk::TrackingDevice
void SetState (TrackingDeviceState state)
 change object state More...
 
 TrackingDevice ()
 
virtual ~TrackingDevice ()
 

Protected Attributes

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

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 44 of file mitkNDITrackingDevice.h.

Member Typedef Documentation

Baud rate of the serial connection.

Definition at line 53 of file mitkNDITrackingDevice.h.

Number of data bits used in the serial connection.

Definition at line 54 of file mitkNDITrackingDevice.h.

Hardware handshake mode of the serial connection.

Definition at line 57 of file mitkNDITrackingDevice.h.

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

Definition at line 51 of file mitkNDITrackingDevice.h.

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

vector of tracking volumes

Definition at line 214 of file mitkNDITrackingDevice.h.

Parity mode used in the serial connection.

Definition at line 55 of file mitkNDITrackingDevice.h.

Port number of the serial connection.

Definition at line 52 of file mitkNDITrackingDevice.h.

Number of stop bits used in the serial connection.

Definition at line 56 of file mitkNDITrackingDevice.h.

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

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

Definition at line 49 of file mitkNDITrackingDevice.h.

Tracking priority used for tracking a tool.

Definition at line 58 of file mitkNDITrackingDevice.h.

typedef std::vector<int> mitk::NDITrackingDevice::TrackingVolumeDimensionType
protected

List of the supported tracking volume dimensions.

Definition at line 215 of file mitkNDITrackingDevice.h.

Constructor & Destructor Documentation

mitk::NDITrackingDevice::~NDITrackingDevice ( )
protectedvirtual

Destructor.

Definition at line 96 of file mitkNDITrackingDevice.cpp.

Member Function Documentation

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 927 of file mitkNDITrackingDevice.cpp.

References mitk::NDIPassiveTool::New().

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

returns the data transfer mode

Beep the tracking device 1 to 9 times

Definition at line 915 of file mitkNDITrackingDevice.cpp.

References mitk::NDIOKAY, and Setup().

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

returns the CRC16 for input as a std::string

Definition at line 336 of file mitkNDITrackingDevice.cpp.

void mitk::NDITrackingDevice::ClearReceiveBuffer ( )
protected

empty receive buffer of serial communication interface

Definition at line 329 of file mitkNDITrackingDevice.cpp.

void mitk::NDITrackingDevice::ClearSendBuffer ( )
protected

empty send buffer of serial communication interface

Definition at line 322 of file mitkNDITrackingDevice.cpp.

Pointer mitk::NDITrackingDevice::Clone ( ) const
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 676 of file mitkNDITrackingDevice.cpp.

References Setup().

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.

Definition at line 1081 of file mitkNDITrackingDevice.cpp.

References mitk::NDIPassiveTool::Dynamic, mitkThrowException, mitk::NDIINITIALIZATIONFAILED, mitk::NDIOKAY, mitk::NDIPassiveTool::New(), and mitk::OCCUPIED.

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 1152 of file mitkNDITrackingDevice.cpp.

References mitk::FREED, mitkThrowException, mitk::NDIERROR, and mitk::NDIOKAY.

virtual BaudRate mitk::NDITrackingDevice::GetBaudRate ( ) const
virtual
virtual DataBits mitk::NDITrackingDevice::GetDataBits ( ) const
virtual
virtual DataTransferMode mitk::NDITrackingDevice::GetDataTransferMode ( ) const
virtual
virtual const char* mitk::NDITrackingDevice::GetDeviceName ( ) const
virtual
NDIErrorCode mitk::NDITrackingDevice::GetErrorCode ( const std::string *  input)

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

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 1202 of file mitkNDITrackingDevice.cpp.

References MITK_ERROR, and mitk::NDIOKAY.

virtual HardwareHandshake mitk::NDITrackingDevice::GetHardwareHandshake ( ) const
virtual
virtual IlluminationActivationRate mitk::NDITrackingDevice::GetIlluminationActivationRate ( ) const
virtual
mitk::NDIPassiveTool * mitk::NDITrackingDevice::GetInternalTool ( std::string  portHandle)
protected

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

Definition at line 897 of file mitkNDITrackingDevice.cpp.

int mitk::NDITrackingDevice::GetMajorFirmwareRevisionNumber ( )
virtual

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

Definition at line 1188 of file mitkNDITrackingDevice.cpp.

References MITK_ERROR, and mitk::NDIOKAY.

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

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

Definition at line 1072 of file mitkNDITrackingDevice.cpp.

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

get current operation mode

Definition at line 1066 of file mitkNDITrackingDevice.cpp.

Referenced by ThreadStartTracking().

virtual Parity mitk::NDITrackingDevice::GetParity ( ) const
virtual
virtual PortNumber mitk::NDITrackingDevice::GetPortNumber ( ) const
virtual
virtual StopBits mitk::NDITrackingDevice::GetStopBits ( ) const
virtual
bool mitk::NDITrackingDevice::GetSupportedVolumes ( unsigned int *  numberOfVolumes,
NDITrackingVolumeContainerType volumes,
TrackingVolumeDimensionType volumesDimensions 
)
protectedvirtual
mitk::TrackingTool * mitk::NDITrackingDevice::GetTool ( unsigned int  toolNumber) const
overridevirtual

return the tool with index toolNumber

Implements mitk::TrackingDevice.

Definition at line 877 of file mitkNDITrackingDevice.cpp.

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 NULL if no tool with that name exists

Reimplemented from mitk::TrackingDevice.

Definition at line 886 of file mitkNDITrackingDevice.cpp.

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

return current number of tools

Implements mitk::TrackingDevice.

Definition at line 908 of file mitkNDITrackingDevice.cpp.

bool mitk::NDITrackingDevice::InitializeWiredTools ( )
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 940 of file mitkNDITrackingDevice.cpp.

References mitkThrowException, mitk::NDIOKAY, mitk::NDIPassiveTool::SetPortHandle(), and Setup().

void mitk::NDITrackingDevice::InvalidateAll ( )
protectedvirtual

invalidate all tools

Definition at line 1047 of file mitkNDITrackingDevice.cpp.

mitk::NDITrackingDevice::mitkClassMacro ( NDITrackingDevice  ,
TrackingDevice   
)
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 366 of file mitkNDITrackingDevice.cpp.

References mitk::SerialCommunication::BaudRate9600, mitk::SerialCommunication::DataBits8, mitk::NDIPolarisTypeInformation::GetTrackingDeviceName(), mitk::UnspecifiedTrackingTypeInformation::GetTrackingDeviceName(), MITK_WARN, mitkThrowException, mitk::NDIOKAY, mitk::SerialCommunication::New(), mitk::SerialCommunication::None, Setup(), and mitk::SerialCommunication::StopBits1.

Referenced by mitk::NDIAuroraTypeInformation::CreateTrackingDeviceSource().

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

receive numberOfBytes bytes from tracking device

Definition at line 268 of file mitkNDITrackingDevice.cpp.

References mitk::NDIOKAY, and mitk::SERIALRECEIVEERROR.

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

lightweight receive function, that reads just one byte

Definition at line 283 of file mitkNDITrackingDevice.cpp.

References mitk::NDIOKAY, and mitk::SERIALRECEIVEERROR.

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 302 of file mitkNDITrackingDevice.cpp.

References LF, mitk::NDIOKAY, and mitk::SERIALRECEIVEERROR.

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 998 of file mitkNDITrackingDevice.cpp.

References mitk::NDIPassiveTool::GetPortHandle(), mitk::NDIOKAY, and Setup().

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

Send message to tracking device.

Definition at line 241 of file mitkNDITrackingDevice.cpp.

References CR, mitk::NDIOKAY, and mitk::SERIALSENDERROR.

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

returns the device name for serial communication

set baud rate for serial communication

Definition at line 150 of file mitkNDITrackingDevice.cpp.

References Setup().

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

returns the baud rate for serial communication

set number of data bits

Definition at line 163 of file mitkNDITrackingDevice.cpp.

References Setup().

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

returns the activation rate of IR illumator for polaris

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

Warning
: only TX is supportet at the moment

Definition at line 230 of file mitkNDITrackingDevice.cpp.

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

returns the port number for serial communication

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

Definition at line 137 of file mitkNDITrackingDevice.cpp.

References Setup().

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

returns the number of stop bits

set use hardware handshake for serial communication

Definition at line 202 of file mitkNDITrackingDevice.cpp.

References Setup().

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

returns the hardware handshake setting

set activation rate of IR illumator for polaris

Definition at line 215 of file mitkNDITrackingDevice.cpp.

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 1056 of file mitkNDITrackingDevice.cpp.

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

returns the data bits for serial communication

set parity mode

Definition at line 176 of file mitkNDITrackingDevice.cpp.

References Setup().

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

set port number for serial communication

Definition at line 124 of file mitkNDITrackingDevice.cpp.

References Setup().

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 91 of file mitkNDITrackingDevice.cpp.

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

returns the parity mode

set number of stop bits

Definition at line 189 of file mitkNDITrackingDevice.cpp.

References Setup().

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 1274 of file mitkNDITrackingDevice.cpp.

References mitkThrowException, and mitk::NDIOKAY.

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 725 of file mitkNDITrackingDevice.cpp.

References mitk::IGTTimeStamp::GetInstance(), and mitk::IGTTimeStamp::Start().

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 606 of file mitkNDITrackingDevice.cpp.

References mitk::SerialCommunication::BaudRate9600, mitk::SerialCommunication::DataBits8, mitk::UnspecifiedTrackingTypeInformation::GetTrackingDeviceName(), mitkThrowException, mitk::NDIOKAY, mitk::SerialCommunication::New(), mitk::SerialCommunication::None, Setup(), and mitk::SerialCommunication::StopBits1.

ITK_THREAD_RETURN_TYPE mitk::NDITrackingDevice::ThreadStartTracking ( void *  data)
static
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 789 of file mitkNDITrackingDevice.cpp.

References mitk::NDICRCDOESNOTMATCH, mitk::NDICRCERROR, mitk::NDIOKAY, and mitk::ToolTracking6D.

Referenced by ThreadStartTracking().

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 741 of file mitkNDITrackingDevice.cpp.

References mitkThrowException, mitk::NDICRCDOESNOTMATCH, mitk::NDICRCERROR, mitk::NDIOKAY, and mitk::TX.

Referenced by ThreadStartTracking().

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 835 of file mitkNDITrackingDevice.cpp.

References mitk::HybridTracking, mitk::NDICRCDOESNOTMATCH, mitk::NDICRCERROR, and mitk::NDIOKAY.

Referenced by ThreadStartTracking().

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

Member Data Documentation

Tool6DContainerType mitk::NDITrackingDevice::m_6DTools
protected

list of 6D tools

Definition at line 310 of file mitkNDITrackingDevice.h.

Referenced by NDITrackingDevice().

BaudRate mitk::NDITrackingDevice::m_BaudRate
protected

COM Port Baud Rate.

Definition at line 302 of file mitkNDITrackingDevice.h.

DataBits mitk::NDITrackingDevice::m_DataBits
protected

Number of Data Bits per token.

Definition at line 303 of file mitkNDITrackingDevice.h.

DataTransferMode mitk::NDITrackingDevice::m_DataTransferMode
protected

use TX (text) or BX (binary) (

Warning
currently, only TX mode is supported)

Definition at line 309 of file mitkNDITrackingDevice.h.

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

Device Name.

Definition at line 300 of file mitkNDITrackingDevice.h.

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

create and parse NDI protocol strings

Definition at line 315 of file mitkNDITrackingDevice.h.

Referenced by NDITrackingDevice().

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 306 of file mitkNDITrackingDevice.h.

IlluminationActivationRate mitk::NDITrackingDevice::m_IlluminationActivationRate
protected

update rate of IR illuminator for Polaris

Definition at line 308 of file mitkNDITrackingDevice.h.

MarkerPointContainerType mitk::NDITrackingDevice::m_MarkerPoints
protected

container for markers (3D point tracking mode)

Definition at line 321 of file mitkNDITrackingDevice.h.

Referenced by NDITrackingDevice().

itk::FastMutexLock::Pointer mitk::NDITrackingDevice::m_MarkerPointsMutex
protected

mutex for marker point data container

Definition at line 320 of file mitkNDITrackingDevice.h.

Referenced by NDITrackingDevice().

itk::MultiThreader::Pointer mitk::NDITrackingDevice::m_MultiThreader
protected

creates tracking thread that continuously polls serial interface for new tracking data

Definition at line 317 of file mitkNDITrackingDevice.h.

Referenced by NDITrackingDevice().

OperationMode mitk::NDITrackingDevice::m_OperationMode
protected

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

Definition at line 319 of file mitkNDITrackingDevice.h.

Parity mitk::NDITrackingDevice::m_Parity
protected

Parity mode for communication.

Definition at line 304 of file mitkNDITrackingDevice.h.

PortNumber mitk::NDITrackingDevice::m_PortNumber
protected

COM Port Number.

Definition at line 301 of file mitkNDITrackingDevice.h.

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

serial communication interface

Definition at line 313 of file mitkNDITrackingDevice.h.

itk::FastMutexLock::Pointer mitk::NDITrackingDevice::m_SerialCommunicationMutex
protected

mutex for coordinated access of serial communication interface

Definition at line 314 of file mitkNDITrackingDevice.h.

Referenced by NDITrackingDevice().

StopBits mitk::NDITrackingDevice::m_StopBits
protected

number of stop bits per token

Definition at line 305 of file mitkNDITrackingDevice.h.

int mitk::NDITrackingDevice::m_ThreadID
protected

ID of tracking thread.

Definition at line 318 of file mitkNDITrackingDevice.h.

Referenced by ThreadStartTracking().

itk::FastMutexLock::Pointer mitk::NDITrackingDevice::m_ToolsMutex
protected

mutex for coordinated access of tool container

Definition at line 312 of file mitkNDITrackingDevice.h.

Referenced by NDITrackingDevice().


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