Medical Imaging Interaction Toolkit  2018.4.99-12ad79a3
Medical Imaging Interaction Toolkit
mitk::TrackingDevice Class Referenceabstract

Interface for all Tracking Devices. More...

#include <mitkTrackingDevice.h>

Inheritance diagram for mitk::TrackingDevice:
Collaboration diagram for mitk::TrackingDevice:

Public Types

enum  RotationMode { RotationStandard, RotationTransposed }
 
enum  TrackingDeviceState { Setup, Ready, Tracking }
 

Public Member Functions

 mitkClassMacroItkParent (TrackingDevice, itk::Object)
 
virtual bool OpenConnection ()=0
 Opens a connection to the device. More...
 
virtual bool CloseConnection ()=0
 Closes the connection to the device. More...
 
virtual bool StartTracking ()=0
 start retrieving tracking data from the device. More...
 
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 TrackingToolGetTool (unsigned int toolNumber) const =0
 Return tool with index toolNumber. More...
 
virtual mitk::TrackingToolGetToolByName (std::string name) const
 Returns the tool with the given tool name. More...
 
virtual unsigned int GetToolCount () const =0
 Returns number of tracking tools. More...
 
virtual void SetRotationMode (RotationMode r)
 
virtual RotationMode GetRotationMode () const
 
TrackingDeviceState GetState () const
 return current object state (Setup, Ready or Tracking) More...
 
TrackingDeviceType GetType () const
 Deprecated! Use the more specific getData or GetTrackingDeviceName instead. return device type identifier. More...
 
void SetType (TrackingDeviceType type)
 Deprecated! Use the more specific setDeviceData instead. set device type. More...
 
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. More...
 
TrackingDeviceData GetData () const
 return device data More...
 
void SetData (TrackingDeviceData data)
 set device type More...
 
virtual bool IsDeviceInstalled ()
 
virtual bool AutoDetectToolsAvailable ()
 
virtual bool AddSingleToolIsAvailable ()
 
virtual mitk::NavigationToolStorage::Pointer AutoDetectTools ()
 

Protected Member Functions

void SetState (TrackingDeviceState state)
 change object state More...
 
 TrackingDevice ()
 
 ~TrackingDevice () override
 

Protected Attributes

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

Interface for all Tracking Devices.

Documentation Defines the methods that are common for all tracking devices.

Definition at line 35 of file mitkTrackingDevice.h.

Member Enumeration Documentation

◆ RotationMode

Defines the rotation modes of this tracking device which results in different representations of quaternions.

  • Standard: normal representation, rawdata from the device is not changed (DEFAULT)
  • Transposed: the rotation is stored transposed, which is (by mistake!) expected by some older MITK classes due to an ambigious method naming in VNL.

CAUTION: The rotation mode can only be changed for backward compatibility of old WRONG code. PLEASE DO NOT CHANGE THE ROTATION MODE UNLESS YOU ARE KNOWING EXACTLY WHAT YOU ARE DOING!

use SetRotationMode to change the mode.

Enumerator
RotationStandard 
RotationTransposed 

Definition at line 53 of file mitkTrackingDevice.h.

◆ TrackingDeviceState

Enumerator
Setup 
Ready 
Tracking 

Definition at line 55 of file mitkTrackingDevice.h.

Constructor & Destructor Documentation

◆ TrackingDevice()

mitk::TrackingDevice::TrackingDevice ( )
protected

Definition at line 28 of file mitkTrackingDevice.cpp.

References m_StateMutex, m_StopTrackingMutex, and m_TrackingFinishedMutex.

◆ ~TrackingDevice()

mitk::TrackingDevice::~TrackingDevice ( )
overrideprotected

Definition at line 41 of file mitkTrackingDevice.cpp.

Member Function Documentation

◆ AddSingleToolIsAvailable()

bool mitk::TrackingDevice::AddSingleToolIsAvailable ( )
virtual
Returns
Returns true if it is possible to add a single tool. Default return is true.

Reimplemented in mitk::NDITrackingDevice.

Definition at line 58 of file mitkTrackingDevice.cpp.

◆ AutoDetectTools()

mitk::NavigationToolStorage::Pointer mitk::TrackingDevice::AutoDetectTools ( )
virtual

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 in mitk::NDITrackingDevice, mitk::OpenIGTLinkTrackingDevice, and mitk::PolhemusTrackingDevice.

Definition at line 63 of file mitkTrackingDevice.cpp.

References mitk::NavigationToolStorage::New().

◆ AutoDetectToolsAvailable()

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

Reimplemented in mitk::NDITrackingDevice, mitk::OpenIGTLinkTrackingDevice, and mitk::PolhemusTrackingDevice.

Definition at line 53 of file mitkTrackingDevice.cpp.

◆ CloseConnection()

virtual bool mitk::TrackingDevice::CloseConnection ( )
pure virtual

Closes the connection to the device.

This may only be called if there is currently a connection to the device, but tracking is not running (e.g. object is in Ready state)Closes the connection with the device

Implemented in mitk::OptitrackTrackingDevice, mitk::NDITrackingDevice, mitk::VirtualTrackingDevice, mitk::OpenIGTLinkTrackingDevice, mitk::ClaronTrackingDevice, mitk::PolhemusTrackingDevice, and mitk::MicroBirdTrackingDevice.

◆ GetData()

mitk::TrackingDeviceData mitk::TrackingDevice::GetData ( ) const

return device data

Definition at line 112 of file mitkTrackingDevice.cpp.

References m_Data.

Referenced by GetTrackingDeviceName().

◆ GetRotationMode()

virtual RotationMode mitk::TrackingDevice::GetRotationMode ( ) const
virtual
Returns
Returns the rotation mode of this class. See documentation of enum RotationMode for details on the different modes.

Referenced by mitk::NDIProtocol::TX().

◆ GetState()

mitk::TrackingDevice::TrackingDeviceState mitk::TrackingDevice::GetState ( ) const

return current object state (Setup, Ready or Tracking)

Definition at line 69 of file mitkTrackingDevice.cpp.

References m_StateMutex.

Referenced by mitk::NDITrackingDevice::Beep(), mitk::PolhemusTrackingDevice::CloseConnection(), mitk::ClaronTrackingDevice::CloseConnection(), mitk::OpenIGTLinkTrackingDevice::CloseConnection(), mitk::VirtualTrackingDevice::CloseConnection(), mitk::NDITrackingDevice::CloseConnection(), mitk::NDITrackingDevice::InternalAddTool(), mitk::MicroBirdTrackingDevice::OpenConnection(), mitk::OpenIGTLinkTrackingDevice::OpenConnection(), mitk::NDITrackingDevice::OpenConnection(), mitk::NDITrackingDevice::RemoveTool(), mitk::NDITrackingDevice::SetBaudRate(), mitk::NDITrackingDevice::SetDataBits(), mitk::NDITrackingDevice::SetDeviceName(), mitk::NDITrackingDevice::SetHardwareHandshake(), mitk::NDITrackingDevice::SetIlluminationActivationRate(), mitk::NDITrackingDevice::SetOperationMode(), mitk::NDITrackingDevice::SetParity(), mitk::NDITrackingDevice::SetPortNumber(), mitk::NDITrackingDevice::SetStopBits(), mitk::OpenIGTLinkTrackingDevice::StartTracking(), mitk::MicroBirdTrackingDevice::StartTracking(), mitk::VirtualTrackingDevice::StartTracking(), mitk::NDITrackingDevice::StartTracking(), mitk::OpenIGTLinkTrackingDevice::StopTracking(), mitk::VirtualTrackingDevice::StopTracking(), StopTracking(), mitk::NDITrackingDevice::TestConnection(), mitk::NDITrackingDevice::TrackMarkerPositions(), mitk::MicroBirdTrackingDevice::TrackTools(), mitk::ClaronTrackingDevice::TrackTools(), mitk::PolhemusTrackingDevice::TrackTools(), mitk::VirtualTrackingDevice::TrackTools(), mitk::NDITrackingDevice::TrackTools(), mitk::NDITrackingDevice::TrackToolsAndMarkers(), mitk::NDITrackingDevice::UpdateTool(), mitk::OpenIGTLinkTrackingDevice::UpdateTools(), mitk::NDITrackingDevice::~NDITrackingDevice(), and mitk::VirtualTrackingDevice::~VirtualTrackingDevice().

◆ GetTool()

virtual TrackingTool* mitk::TrackingDevice::GetTool ( unsigned int  toolNumber) const
pure virtual

◆ GetToolByName()

mitk::TrackingTool * mitk::TrackingDevice::GetToolByName ( std::string  name) const
virtual

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 in mitk::NDITrackingDevice.

Definition at line 141 of file mitkTrackingDevice.cpp.

References GetTool(), and GetToolCount().

◆ GetToolCount()

virtual unsigned int mitk::TrackingDevice::GetToolCount ( ) const
pure virtual

◆ GetTrackingDeviceName()

std::string mitk::TrackingDevice::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.

Definition at line 150 of file mitkTrackingDevice.cpp.

References GetData(), and mitk::TrackingDeviceData::Line.

◆ GetType()

mitk::TrackingDeviceType mitk::TrackingDevice::GetType ( ) const

Deprecated! Use the more specific getData or GetTrackingDeviceName instead. return device type identifier.

Definition at line 94 of file mitkTrackingDevice.cpp.

References mitk::TrackingDeviceData::Line, and m_Data.

Referenced by mitk::NDITrackingDevice::AddSingleToolIsAvailable(), mitk::NDITrackingDevice::AutoDetectTools(), mitk::NDITrackingDevice::AutoDetectToolsAvailable(), and mitk::NDITrackingDevice::OpenConnection().

◆ IsDeviceInstalled()

bool mitk::TrackingDevice::IsDeviceInstalled ( )
virtual
Returns
Returns true if the device is installed on this system an can be used. Installed means activated in MITK, in some cases this means the MITK installation / build has to know the installation path of the device libraries on this system. This path is usually given as cmake variable during the build configuration in devellopers mode. If the device should be available for end users with an installer the libraries can be included into the installer or the installer has to be adapted such that it asks for the path. Returns fals if the device is not installed. It cannot be used on this build in this case.

Note that some tracking systems communicate via a standard interface (e.g., serial port) and don't need any library or installation. These devices are always "installed".

Reimplemented in mitk::OpenIGTLinkTrackingDevice, mitk::PolhemusTrackingDevice, mitk::OptitrackTrackingDevice, and mitk::ClaronTrackingDevice.

Definition at line 45 of file mitkTrackingDevice.cpp.

◆ mitkClassMacroItkParent()

mitk::TrackingDevice::mitkClassMacroItkParent ( TrackingDevice  ,
itk::Object   
)

◆ OpenConnection()

virtual bool mitk::TrackingDevice::OpenConnection ( )
pure virtual

Opens a connection to the device.

This may only be called if there is currently no connection to the device. If OpenConnection() is successful, the object will change from Setup state to Ready state

Implemented in mitk::OptitrackTrackingDevice, mitk::VirtualTrackingDevice, mitk::NDITrackingDevice, mitk::OpenIGTLinkTrackingDevice, mitk::ClaronTrackingDevice, mitk::PolhemusTrackingDevice, and mitk::MicroBirdTrackingDevice.

◆ SetData()

void mitk::TrackingDevice::SetData ( mitk::TrackingDeviceData  data)

set device type

Definition at line 117 of file mitkTrackingDevice.cpp.

References m_Data.

◆ SetRotationMode()

void mitk::TrackingDevice::SetRotationMode ( RotationMode  r)
virtual

Sets the rotation mode of this class. See documentation of enum RotationMode for details on the different modes. This method has to be implemented in a deriving class to become functional / if different rotation modes should be supported. CAUTION: The rotation mode can only be changed for backward compatibility of old WRONG code. PLEASE DO NOT CHANGE THE ROTATION MODE UNLESS YOU ARE KNOWING EXACTLY WHAT YOU ARE DOING!

Reimplemented in mitk::NDITrackingDevice.

Definition at line 89 of file mitkTrackingDevice.cpp.

References MITK_WARN.

◆ SetState()

◆ SetType()

void mitk::TrackingDevice::SetType ( mitk::TrackingDeviceType  deviceType)

Deprecated! Use the more specific setDeviceData instead. set device type.

Definition at line 98 of file mitkTrackingDevice.cpp.

References mitk::TrackingDeviceTypeCollection::GetFirstCompatibleDeviceDataForLine(), us::GetModuleContext(), m_Data, and MITK_ERROR.

Referenced by mitk::NDITrackingDevice::OpenConnection().

◆ StartTracking()

virtual bool mitk::TrackingDevice::StartTracking ( )
pure virtual

start retrieving tracking data from the device.

This may only be called after the connection to the device has been established with a call to OpenConnection() (E.g. object is in Ready mode). This will change the object state from Ready to Tracking

Implemented in mitk::NDITrackingDevice, mitk::OptitrackTrackingDevice, mitk::MicroBirdTrackingDevice, mitk::VirtualTrackingDevice, mitk::OpenIGTLinkTrackingDevice, mitk::ClaronTrackingDevice, and mitk::PolhemusTrackingDevice.

◆ StopTracking()

bool mitk::TrackingDevice::StopTracking ( )
virtual

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.

Reimplemented in mitk::OptitrackTrackingDevice, mitk::VirtualTrackingDevice, mitk::MicroBirdTrackingDevice, mitk::OpenIGTLinkTrackingDevice, mitk::ClaronTrackingDevice, and mitk::PolhemusTrackingDevice.

Definition at line 122 of file mitkTrackingDevice.cpp.

References mitk::IGTTimeStamp::GetInstance(), GetState(), m_StopTracking, m_StopTrackingMutex, m_TrackingFinishedMutex, Ready, SetState(), mitk::IGTTimeStamp::Stop(), and Tracking.

Referenced by mitk::NDITrackingDevice::AutoDetectTools(), mitk::MicroBirdTrackingDevice::StopTracking(), and mitk::NDITrackingDevice::~NDITrackingDevice().

Member Data Documentation

◆ m_Data

◆ m_RotationMode

RotationMode mitk::TrackingDevice::m_RotationMode
protected

defines the rotation mode Standard or Transposed, Standard is default

Definition at line 201 of file mitkTrackingDevice.h.

Referenced by mitk::NDITrackingDevice::SetRotationMode().

◆ m_StateMutex

itk::FastMutexLock::Pointer mitk::TrackingDevice::m_StateMutex
protected

mutex to control access to m_State

Definition at line 200 of file mitkTrackingDevice.h.

Referenced by GetState(), SetState(), and TrackingDevice().

◆ m_StopTracking

◆ m_StopTrackingMutex

◆ m_TrackingFinishedMutex


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