Medical Imaging Interaction Toolkit  2023.04.00
Medical Imaging Interaction Toolkit
mitk::OpenIGTLinkTrackingDevice Class Reference

An object of this class represents the MicronTracker 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. More...

#include <mitkOpenIGTLinkTrackingDevice.h>

Inheritance diagram for mitk::OpenIGTLinkTrackingDevice:
Collaboration diagram for mitk::OpenIGTLinkTrackingDevice:

Public Member Functions

 mitkClassMacro (OpenIGTLinkTrackingDevice, TrackingDevice)
 
Pointer Clone () const
 
void SetPortNumber (int portNumber)
 
void SetHostname (std::string hostname)
 
int GetPortNumber ()
 
std::string GetHostname ()
 
bool StartTracking () override
 Starts the tracking. More...
 
bool StopTracking () override
 Stops the tracking. More...
 
bool OpenConnection () override
 Opens the connection to the device. This have to be done before the tracking is started. More...
 
bool CloseConnection () override
 Closes the connection and clears all resources. More...
 
unsigned int GetToolCount () const override
 
TrackingToolGetTool (unsigned int toolNumber) const override
 
bool DiscoverTools (int WaitingTime=10000)
 Discover the tools available from the connected OpenIGTLink device and adds these tools to this tracking device. Therefore, a connection is opened, the tools are discovered and added. More...
 
mitk::TrackingToolAddTool (const char *toolName, const char *fileName)
 Create a new OpenIGTLink tool with toolName and fileName and add it to the list of tools. More...
 
bool AutoDetectToolsAvailable () override
 
mitk::NavigationToolStorage::Pointer AutoDetectTools () override
 
bool IsDeviceInstalled () override
 
virtual void SetUpdateRate (int _arg)
 
virtual int GetUpdateRate () const
 Sets the update rate of the device in fps. Default value is 60 fps. More...
 
- 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

 OpenIGTLinkTrackingDevice ()
 Returns the update rate of the device in fps. More...
 
 ~OpenIGTLinkTrackingDevice () override
 
bool InternalAddTool (OpenIGTLinkTrackingTool::Pointer tool)
 Adds a tool to the tracking device. More...
 
void UpdateTools ()
 
mitk::IGTLMessage::Pointer ReceiveMessage (int waitingTime)
 
std::vector< OpenIGTLinkTrackingTool::Pointer > GetAllTools ()
 
- Protected Member Functions inherited from mitk::TrackingDevice
void SetState (TrackingDeviceState state)
 change object state More...
 
 TrackingDevice ()
 
 ~TrackingDevice () override
 

Protected Attributes

unsigned long m_MessageReceivedObserverTag
 
mitk::IGTLClient::Pointer m_OpenIGTLinkClient
 
mitk::IGTLTrackingDataDeviceSource::Pointer m_IGTLDeviceSource
 
mitk::IGTLMessageToNavigationDataFilter::Pointer m_IGTLMsgToNavDataFilter
 
std::vector< OpenIGTLinkTrackingTool::Pointer > m_AllTools
 vector holding all tools More...
 
int m_UpdateRate
 holds the update rate in FPS (will be set automatically when the OpenIGTLink connection is established) More...
 
- 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 the MicronTracker 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.

Documentation:

Definition at line 35 of file mitkOpenIGTLinkTrackingDevice.h.

Constructor & Destructor Documentation

◆ OpenIGTLinkTrackingDevice()

mitk::OpenIGTLinkTrackingDevice::OpenIGTLinkTrackingDevice ( )
protected

Returns the update rate of the device in fps.

◆ ~OpenIGTLinkTrackingDevice()

mitk::OpenIGTLinkTrackingDevice::~OpenIGTLinkTrackingDevice ( )
overrideprotected

Member Function Documentation

◆ AddTool()

mitk::TrackingTool* mitk::OpenIGTLinkTrackingDevice::AddTool ( const char *  toolName,
const char *  fileName 
)

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

Note that tools are usually provided by the OpenIGTLink connection. In most cases, the method DiscoverTools() should be used instead which automatically finds the provided tools. If you use this method to manually add tools be sure that you add the same number and type of tools that are provided by the connected device. Otherwise problems might occur when you try to start tracking.

◆ AutoDetectTools()

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

Autodetects tools from the current OpenIGTLink connection and returns them as a navigation tool storage.

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

Reimplemented from mitk::TrackingDevice.

◆ AutoDetectToolsAvailable()

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

Reimplemented from mitk::TrackingDevice.

◆ Clone()

Pointer mitk::OpenIGTLinkTrackingDevice::Clone ( ) const

◆ CloseConnection()

bool mitk::OpenIGTLinkTrackingDevice::CloseConnection ( )
overridevirtual

Closes the connection and clears all resources.

Implements mitk::TrackingDevice.

◆ DiscoverTools()

bool mitk::OpenIGTLinkTrackingDevice::DiscoverTools ( int  WaitingTime = 10000)

Discover the tools available from the connected OpenIGTLink device and adds these tools to this tracking device. Therefore, a connection is opened, the tools are discovered and added.

Parameters
WaitingTimeDefines how long the method waits for an answer from the server (in milliseconds). Default value is 10000 (10 seconds).
Returns
Returns true if the connection was established and the tools were discovered successfully and - if at least one tool was found - were added to this device. Retruns false if no valid connection is available.

◆ GetAllTools()

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

◆ GetHostname()

std::string mitk::OpenIGTLinkTrackingDevice::GetHostname ( )

◆ GetPortNumber()

int mitk::OpenIGTLinkTrackingDevice::GetPortNumber ( )

◆ GetTool()

TrackingTool* mitk::OpenIGTLinkTrackingDevice::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 nullptr, if there is no tool with this number.

Implements mitk::TrackingDevice.

◆ GetToolCount()

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

Implements mitk::TrackingDevice.

◆ GetUpdateRate()

virtual int mitk::OpenIGTLinkTrackingDevice::GetUpdateRate ( ) const
virtual

Sets the update rate of the device in fps. Default value is 60 fps.

◆ InternalAddTool()

bool mitk::OpenIGTLinkTrackingDevice::InternalAddTool ( OpenIGTLinkTrackingTool::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::OpenIGTLinkTrackingDevice::IsDeviceInstalled ( )
overridevirtual
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::OpenIGTLinkTrackingDevice::mitkClassMacro ( OpenIGTLinkTrackingDevice  ,
TrackingDevice   
)

◆ New()

static Pointer mitk::OpenIGTLinkTrackingDevice::New ( )
static

◆ OpenConnection()

bool mitk::OpenIGTLinkTrackingDevice::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.

◆ ReceiveMessage()

mitk::IGTLMessage::Pointer mitk::OpenIGTLinkTrackingDevice::ReceiveMessage ( int  waitingTime)
protected

Receives one message from the OpenIGTLink connection. Starts the tracking stream if required.

◆ SetHostname()

void mitk::OpenIGTLinkTrackingDevice::SetHostname ( std::string  hostname)

Sets the hostname for the Open IGT Link connection. Default value is 127.0.0.1 (localhost).

◆ SetPortNumber()

void mitk::OpenIGTLinkTrackingDevice::SetPortNumber ( int  portNumber)

Sets the port number for the Open IGT Link connection. Default value is -1 (invalid).

◆ SetUpdateRate()

virtual void mitk::OpenIGTLinkTrackingDevice::SetUpdateRate ( int  _arg)
virtual

◆ StartTracking()

bool mitk::OpenIGTLinkTrackingDevice::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()

bool mitk::OpenIGTLinkTrackingDevice::StopTracking ( )
overridevirtual

Stops the tracking.

Returns
Returns true if the tracking is stopped.

Reimplemented from mitk::TrackingDevice.

◆ UpdateTools()

void mitk::OpenIGTLinkTrackingDevice::UpdateTools ( )
protected

Updates the tools from the open IGT link connection. Is called every time a message received event is invoked.

Member Data Documentation

◆ m_AllTools

std::vector<OpenIGTLinkTrackingTool::Pointer> mitk::OpenIGTLinkTrackingDevice::m_AllTools
protected

vector holding all tools

Definition at line 153 of file mitkOpenIGTLinkTrackingDevice.h.

◆ m_IGTLDeviceSource

mitk::IGTLTrackingDataDeviceSource::Pointer mitk::OpenIGTLinkTrackingDevice::m_IGTLDeviceSource
protected

Definition at line 150 of file mitkOpenIGTLinkTrackingDevice.h.

◆ m_IGTLMsgToNavDataFilter

mitk::IGTLMessageToNavigationDataFilter::Pointer mitk::OpenIGTLinkTrackingDevice::m_IGTLMsgToNavDataFilter
protected

Definition at line 151 of file mitkOpenIGTLinkTrackingDevice.h.

◆ m_MessageReceivedObserverTag

unsigned long mitk::OpenIGTLinkTrackingDevice::m_MessageReceivedObserverTag
protected

Definition at line 135 of file mitkOpenIGTLinkTrackingDevice.h.

◆ m_OpenIGTLinkClient

mitk::IGTLClient::Pointer mitk::OpenIGTLinkTrackingDevice::m_OpenIGTLinkClient
protected

Definition at line 147 of file mitkOpenIGTLinkTrackingDevice.h.

◆ m_UpdateRate

int mitk::OpenIGTLinkTrackingDevice::m_UpdateRate
protected

holds the update rate in FPS (will be set automatically when the OpenIGTLink connection is established)

Definition at line 155 of file mitkOpenIGTLinkTrackingDevice.h.


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