Medical Imaging Interaction Toolkit  2023.12.00
Medical Imaging Interaction Toolkit
mitk::PolhemusTrackingDevice Class Reference

An object of this class represents Polhemus tracking device. You can add tools to this device, then open the connection and start tracking. The tracking device will then continuously update the tool coordinates. The tools which are used by Polhemus need to be connected to the correct port. The port of the tool is stored as m_ToolPort in PolhemusTool AND as identifier in the NavigationTool (ToolStorage). More...

#include <mitkPolhemusTrackingDevice.h>

Inheritance diagram for mitk::PolhemusTrackingDevice:
Collaboration diagram for mitk::PolhemusTrackingDevice:

Public Member Functions

 mitkClassMacro (PolhemusTrackingDevice, TrackingDevice)
 
Pointer Clone () const
 
virtual bool StartTracking () override
 Starts the tracking. More...
 
virtual bool StopTracking () override
 Stops the tracking. More...
 
virtual bool OpenConnection () override
 Opens the connection to the device. This have to be done before the tracking is started. More...
 
virtual bool CloseConnection () override
 Closes the connection and clears all resources. More...
 
virtual unsigned int GetToolCount () const override
 
TrackingToolGetTool (unsigned int toolNumber) const override
 
mitk::TrackingToolAddTool (const char *toolName, int toolPort)
 Create a new Polhemus tool with toolName and add it to the list of tools. More...
 
bool IsDeviceInstalled ()
 
virtual bool AutoDetectToolsAvailable ()
 
virtual mitk::NavigationToolStorage::Pointer AutoDetectTools ()
 
void SetHemisphereTrackingEnabled (bool _HemisphereTrackingEnabled)
 
bool GetHemisphereTrackingEnabled (int _tool)
 
void ToggleHemisphere (int _tool=-1)
 
void SetHemisphere (int _tool, mitk::Vector3D _hemisphere)
 
mitk::Vector3D GetHemisphere (int _tool)
 
void AdjustHemisphere (int _tool)
 
- Public Member Functions inherited from mitk::TrackingDevice
 mitkClassMacroItkParent (TrackingDevice, itk::Object)
 
virtual mitk::TrackingToolGetToolByName (std::string name) const
 Returns the tool with the given tool name. 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 AddSingleToolIsAvailable ()
 

Static Public Member Functions

static Pointer New ()
 

Protected Member Functions

 PolhemusTrackingDevice ()
 
 ~PolhemusTrackingDevice ()
 
bool InternalAddTool (PolhemusTool::Pointer tool)
 Adds a tool to the tracking device. More...
 
void TrackTools ()
 This method tracks tools as long as the variable m_Mode is set to "Tracking". Tracking tools means grabbing frames from the camera an updating the tools. More...
 
std::vector< PolhemusTool::Pointer > GetAllTools ()
 
PolhemusInterfaceGetDevice ()
 
void ThreadStartTracking ()
 
- Protected Member Functions inherited from mitk::TrackingDevice
void SetState (TrackingDeviceState state)
 change object state More...
 
 TrackingDevice ()
 
 ~TrackingDevice () override
 

Protected Attributes

std::vector< PolhemusTool::Pointer > m_AllTools
 vector holding all tools More...
 
PolhemusInterface::Pointer m_Device
 represents the interface to the tracking hardware More...
 
std::thread m_Thread
 
bool m_HemisphereTrackingEnabled
 
- Protected Attributes inherited from mitk::TrackingDevice
TrackingDeviceData m_Data
 current device Data More...
 
bool m_StopTracking
 signal stop to tracking thread More...
 
std::mutex m_StopTrackingMutex
 mutex to control access to m_StopTracking More...
 
std::mutex m_TrackingFinishedMutex
 mutex to manage control flow of StopTracking() More...
 
std::mutex m_StateMutex
 mutex to control access to m_State More...
 
RotationMode m_RotationMode
 defines the rotation mode Standard or Transposed, Standard is default More...
 

Additional Inherited Members

- Public Types inherited from mitk::TrackingDevice
enum  RotationMode { RotationStandard, RotationTransposed }
 
enum  TrackingDeviceState { Setup, Ready, Tracking }
 

Detailed Description

An object of this class represents Polhemus tracking device. You can add tools to this device, then open the connection and start tracking. The tracking device will then continuously update the tool coordinates. The tools which are used by Polhemus need to be connected to the correct port. The port of the tool is stored as m_ToolPort in PolhemusTool AND as identifier in the NavigationTool (ToolStorage).

Documentation:

Definition at line 33 of file mitkPolhemusTrackingDevice.h.

Constructor & Destructor Documentation

◆ PolhemusTrackingDevice()

mitk::PolhemusTrackingDevice::PolhemusTrackingDevice ( )
protected

◆ ~PolhemusTrackingDevice()

mitk::PolhemusTrackingDevice::~PolhemusTrackingDevice ( )
protected

Member Function Documentation

◆ AddTool()

mitk::TrackingTool* mitk::PolhemusTrackingDevice::AddTool ( const char *  toolName,
int  toolPort 
)

Create a new Polhemus tool with toolName and add it to the list of tools.

This method will create a new PolhemusTool object, set the tool name toolName 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 PolhemusTrackingDevice.

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

◆ AdjustHemisphere()

void mitk::PolhemusTrackingDevice::AdjustHemisphere ( int  _tool)

Adjust the Hemisphere for this tool. User needs to make sure, that the tool is located in hemisphere (1|0|0) when calling this function. In contrast to SetHemisphere(1,0,0), this method restores the original HemisphereTracking settings at the end.

◆ AutoDetectTools()

virtual mitk::NavigationToolStorage::Pointer mitk::PolhemusTrackingDevice::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 from mitk::TrackingDevice.

◆ AutoDetectToolsAvailable()

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

Reimplemented from mitk::TrackingDevice.

◆ Clone()

Pointer mitk::PolhemusTrackingDevice::Clone ( ) const

◆ CloseConnection()

virtual bool mitk::PolhemusTrackingDevice::CloseConnection ( )
overridevirtual

Closes the connection and clears all resources.

Implements mitk::TrackingDevice.

◆ GetAllTools()

std::vector<PolhemusTool::Pointer> mitk::PolhemusTrackingDevice::GetAllTools ( )
protected
Returns
Returns all tools of the tracking device.

◆ GetDevice()

PolhemusInterface* mitk::PolhemusTrackingDevice::GetDevice ( )
protected
Returns
Gives back the device which is represented by an object of the class PolhemusInterface.

◆ GetHemisphere()

mitk::Vector3D mitk::PolhemusTrackingDevice::GetHemisphere ( int  _tool)

Get the Hemisphere for _tool as mitk vector

◆ GetHemisphereTrackingEnabled()

bool mitk::PolhemusTrackingDevice::GetHemisphereTrackingEnabled ( int  _tool)

Is Hemisphere Tracking Enabled for this tool?

◆ GetTool()

TrackingTool* mitk::PolhemusTrackingDevice::GetTool ( unsigned int  toolNumber) const
overridevirtual
Parameters
toolNumberThe number of the tool which should be given back.
Returns
Returns the tool which the number "toolNumber". Returns NULL, if there is no tool with this number.

Implements mitk::TrackingDevice.

◆ GetToolCount()

virtual unsigned int mitk::PolhemusTrackingDevice::GetToolCount ( ) const
overridevirtual
Returns
Returns the number of tools which have been added to the device.

Implements mitk::TrackingDevice.

◆ InternalAddTool()

bool mitk::PolhemusTrackingDevice::InternalAddTool ( PolhemusTool::Pointer  tool)
protected

Adds a tool to the tracking device.

Parameters
toolThe tool which will be added.
Returns
Returns true if the tool has been added, false otherwise.

◆ IsDeviceInstalled()

bool mitk::PolhemusTrackingDevice::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 from mitk::TrackingDevice.

◆ mitkClassMacro()

mitk::PolhemusTrackingDevice::mitkClassMacro ( PolhemusTrackingDevice  ,
TrackingDevice   
)

◆ New()

static Pointer mitk::PolhemusTrackingDevice::New ( )
static

◆ OpenConnection()

virtual bool mitk::PolhemusTrackingDevice::OpenConnection ( )
overridevirtual

Opens the connection to the device. This have to be done before the tracking is started.

Exceptions
mitk::IGTHardwareExceptionThrows an exception if there is an error during open connection.

Implements mitk::TrackingDevice.

◆ SetHemisphere()

void mitk::PolhemusTrackingDevice::SetHemisphere ( int  _tool,
mitk::Vector3D  _hemisphere 
)

Sets the Hemisphere of tool _tool to the vector _hemisphere

◆ SetHemisphereTrackingEnabled()

void mitk::PolhemusTrackingDevice::SetHemisphereTrackingEnabled ( bool  _HemisphereTrackingEnabled)

Enables/disables hemisphere tracking for all sensors.

◆ StartTracking()

virtual bool mitk::PolhemusTrackingDevice::StartTracking ( )
overridevirtual

Starts the tracking.

Returns
Returns true if the tracking is started. Throws an exception if an error occures.
Exceptions
mitk::IGTHardwareExceptionThrows an exception if there is an error during start tracking.

Implements mitk::TrackingDevice.

◆ StopTracking()

virtual bool mitk::PolhemusTrackingDevice::StopTracking ( )
overridevirtual

Stops the tracking.

Returns
Returns true if the tracking is stopped.

Reimplemented from mitk::TrackingDevice.

◆ ThreadStartTracking()

void mitk::PolhemusTrackingDevice::ThreadStartTracking ( )
protected

◆ ToggleHemisphere()

void mitk::PolhemusTrackingDevice::ToggleHemisphere ( int  _tool = -1)

Toggles the current hemisphere. Parameter _tool describes, for which tool the hemisphere should change. Default -1 toggles all tools.

◆ TrackTools()

void mitk::PolhemusTrackingDevice::TrackTools ( )
protected

This method tracks tools as long as the variable m_Mode is set to "Tracking". Tracking tools means grabbing frames from the camera an updating the tools.

Exceptions
mitk::IGTHardwareExceptionThrows an exception if there is an error during tracking of tools.

Member Data Documentation

◆ m_AllTools

std::vector<PolhemusTool::Pointer> mitk::PolhemusTrackingDevice::m_AllTools
protected

vector holding all tools

Definition at line 154 of file mitkPolhemusTrackingDevice.h.

◆ m_Device

PolhemusInterface::Pointer mitk::PolhemusTrackingDevice::m_Device
protected

represents the interface to the tracking hardware

Definition at line 155 of file mitkPolhemusTrackingDevice.h.

◆ m_HemisphereTrackingEnabled

bool mitk::PolhemusTrackingDevice::m_HemisphereTrackingEnabled
protected

Definition at line 157 of file mitkPolhemusTrackingDevice.h.

◆ m_Thread

std::thread mitk::PolhemusTrackingDevice::m_Thread
protected

Definition at line 156 of file mitkPolhemusTrackingDevice.h.


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