Medical Imaging Interaction Toolkit
2018.4.99-389bf124
Medical Imaging Interaction Toolkit
|
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>
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 |
TrackingTool * | GetTool (unsigned int toolNumber) const override |
mitk::TrackingTool * | AddTool (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) |
![]() | |
mitkClassMacroItkParent (TrackingDevice, itk::Object) | |
virtual mitk::TrackingTool * | GetToolByName (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 () |
PolhemusInterface * | GetDevice () |
![]() | |
void | SetState (TrackingDeviceState state) |
change object state More... | |
TrackingDevice () | |
~TrackingDevice () override | |
Static Protected Member Functions | |
static ITK_THREAD_RETURN_TYPE | ThreadStartTracking (void *data) |
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... | |
itk::MultiThreader::Pointer | m_MultiThreader |
int | m_ThreadID |
bool | m_HemisphereTrackingEnabled |
![]() | |
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... | |
Additional Inherited Members | |
![]() | |
enum | RotationMode { RotationStandard, RotationTransposed } |
enum | TrackingDeviceState { Setup, Ready, Tracking } |
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.
|
protected |
Definition at line 25 of file mitkPolhemusTrackingDevice.cpp.
References mitk::PolhemusTrackerTypeInformation::GetDeviceDataPolhemusTrackerLiberty(), mitk::TrackingDevice::m_Data, m_Device, m_MultiThreader, m_ThreadID, and mitk::PolhemusInterface::New().
|
protected |
Definition at line 36 of file mitkPolhemusTrackingDevice.cpp.
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.
Definition at line 45 of file mitkPolhemusTrackingDevice.cpp.
References InternalAddTool(), m_AllTools, MITK_DEBUG, and mitk::PolhemusTool::New().
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.
Definition at line 322 of file mitkPolhemusTrackingDevice.cpp.
References m_Device.
|
virtual |
Autodetects tools from this device and returns them as a navigation tool storage.
Reimplemented from mitk::TrackingDevice.
Definition at line 262 of file mitkPolhemusTrackingDevice.cpp.
References mitk::PolhemusTrackerTypeInformation::GetDeviceDataPolhemusTrackerLiberty(), mitk::PolhemusInterface::trackingData::id, m_Device, MITK_INFO, mitk::NavigationTool::New(), and mitk::NavigationToolStorage::New().
|
virtual |
Reimplemented from mitk::TrackingDevice.
Definition at line 257 of file mitkPolhemusTrackingDevice.cpp.
Pointer mitk::PolhemusTrackingDevice::Clone | ( | ) | const |
|
overridevirtual |
Closes the connection and clears all resources.
Implements mitk::TrackingDevice.
Definition at line 157 of file mitkPolhemusTrackingDevice.cpp.
References mitk::TrackingDevice::GetState(), m_Device, mitk::TrackingDevice::SetState(), and mitk::TrackingDevice::Setup.
Referenced by OpenConnection().
|
protected |
Definition at line 174 of file mitkPolhemusTrackingDevice.cpp.
References m_AllTools.
Referenced by TrackTools().
|
protected |
Definition at line 169 of file mitkPolhemusTrackingDevice.cpp.
References m_Device.
Referenced by TrackTools().
mitk::Vector3D mitk::PolhemusTrackingDevice::GetHemisphere | ( | int | _tool | ) |
Get the Hemisphere for _tool as mitk vector
Definition at line 312 of file mitkPolhemusTrackingDevice.cpp.
References m_Device.
bool mitk::PolhemusTrackingDevice::GetHemisphereTrackingEnabled | ( | int | _tool | ) |
Is Hemisphere Tracking Enabled for this tool?
Definition at line 317 of file mitkPolhemusTrackingDevice.cpp.
References m_Device.
|
overridevirtual |
toolNumber | The number of the tool which should be given back. |
Implements mitk::TrackingDevice.
Definition at line 103 of file mitkPolhemusTrackingDevice.cpp.
References GetToolCount(), and m_AllTools.
|
overridevirtual |
Implements mitk::TrackingDevice.
Definition at line 98 of file mitkPolhemusTrackingDevice.cpp.
References m_AllTools.
Referenced by GetTool(), and OpenConnection().
|
protected |
Adds a tool to the tracking device.
tool | The tool which will be added. |
Definition at line 65 of file mitkPolhemusTrackingDevice.cpp.
References m_AllTools.
Referenced by AddTool().
|
virtual |
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.
Definition at line 40 of file mitkPolhemusTrackingDevice.cpp.
mitk::PolhemusTrackingDevice::mitkClassMacro | ( | PolhemusTrackingDevice | , |
TrackingDevice | |||
) |
|
static |
Referenced by QmitkPolhemusTrackerWidget::GetTrackingDevice().
|
overridevirtual |
Opens the connection to the device. This have to be done before the tracking is started.
mitk::IGTHardwareException | Throws an exception if there is an error during open connection. |
Implements mitk::TrackingDevice.
Definition at line 111 of file mitkPolhemusTrackingDevice.cpp.
References CloseConnection(), GetToolCount(), m_AllTools, m_Device, m_HemisphereTrackingEnabled, MITK_ERROR, mitk::PolhemusInterface::New(), mitk::TrackingDevice::Ready, and mitk::TrackingDevice::SetState().
void mitk::PolhemusTrackingDevice::SetHemisphere | ( | int | _tool, |
mitk::Vector3D | _hemisphere | ||
) |
Sets the Hemisphere of tool _tool to the vector _hemisphere
Definition at line 302 of file mitkPolhemusTrackingDevice.cpp.
References m_Device, and m_HemisphereTrackingEnabled.
void mitk::PolhemusTrackingDevice::SetHemisphereTrackingEnabled | ( | bool | _HemisphereTrackingEnabled | ) |
Enables/disables hemisphere tracking for all sensors.
Definition at line 286 of file mitkPolhemusTrackingDevice.cpp.
References m_Device, and m_HemisphereTrackingEnabled.
|
overridevirtual |
Starts the tracking.
mitk::IGTHardwareException | Throws an exception if there is an error during start tracking. |
Implements mitk::TrackingDevice.
Definition at line 71 of file mitkPolhemusTrackingDevice.cpp.
References mitk::IGTTimeStamp::GetInstance(), m_Device, m_MultiThreader, mitk::TrackingDevice::m_StopTracking, mitk::TrackingDevice::m_StopTrackingMutex, m_ThreadID, mitkThrowException, mitk::TrackingDevice::Ready, mitk::TrackingDevice::SetState(), mitk::IGTTimeStamp::Start(), ThreadStartTracking(), and mitk::TrackingDevice::Tracking.
|
overridevirtual |
Stops the tracking.
Reimplemented from mitk::TrackingDevice.
Definition at line 92 of file mitkPolhemusTrackingDevice.cpp.
References m_Device.
Referenced by TrackTools().
|
staticprotected |
Definition at line 237 of file mitkPolhemusTrackingDevice.cpp.
References TrackTools().
Referenced by StartTracking().
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.
Definition at line 297 of file mitkPolhemusTrackingDevice.cpp.
References m_Device.
|
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.
mitk::IGTHardwareException | Throws an exception if there is an error during tracking of tools. |
Definition at line 179 of file mitkPolhemusTrackingDevice.cpp.
References GetAllTools(), GetDevice(), mitk::IGTTimeStamp::GetInstance(), mitk::PolhemusInterface::GetLastFrame(), mitk::TrackingDevice::GetState(), m_AllTools, mitk::TrackingDevice::m_StopTracking, mitk::TrackingDevice::m_StopTrackingMutex, mitk::TrackingDevice::m_TrackingFinishedMutex, MITK_WARN, mitkThrowException, StopTracking(), and mitk::TrackingDevice::Tracking.
Referenced by ThreadStartTracking().
|
protected |
vector holding all tools
Definition at line 154 of file mitkPolhemusTrackingDevice.h.
Referenced by AddTool(), GetAllTools(), GetTool(), GetToolCount(), InternalAddTool(), OpenConnection(), and TrackTools().
|
protected |
represents the interface to the tracking hardware
Definition at line 155 of file mitkPolhemusTrackingDevice.h.
Referenced by AdjustHemisphere(), AutoDetectTools(), CloseConnection(), GetDevice(), GetHemisphere(), GetHemisphereTrackingEnabled(), OpenConnection(), PolhemusTrackingDevice(), SetHemisphere(), SetHemisphereTrackingEnabled(), StartTracking(), StopTracking(), and ToggleHemisphere().
|
protected |
Definition at line 158 of file mitkPolhemusTrackingDevice.h.
Referenced by OpenConnection(), SetHemisphere(), and SetHemisphereTrackingEnabled().
|
protected |
Definition at line 156 of file mitkPolhemusTrackingDevice.h.
Referenced by PolhemusTrackingDevice(), and StartTracking().
|
protected |
Definition at line 157 of file mitkPolhemusTrackingDevice.h.
Referenced by PolhemusTrackingDevice(), and StartTracking().