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

An object of this class represents the Optitrack 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. Remember that it will be necessary to to have a license for using the Optitrack System. See http://www.naturalpoint.com/ for details. More...

#include <mitkOptitrackTrackingDevice.h>

Inheritance diagram for mitk::OptitrackTrackingDevice:
Collaboration diagram for mitk::OptitrackTrackingDevice:

Public Types

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

Public Member Functions

 mitkClassMacro (OptitrackTrackingDevice, mitk::TrackingDevice)
 
virtual bool IsDeviceInstalled () override
 
virtual bool OpenConnection () override
 Open the Connection with the Tracker. Calls LoadCalibration function and set the system up with the calibration file. Remember that you have to set a calibration file first to open a correct connection to the Optical Tracking System. More...
 
virtual bool CloseConnection () override
 Close the Connection with the Tracker. Also CleanUp the Optitrack variables using the API: TT_CleanUp and TT_ShutDown. Sometimes API does not work properly and some problems during the Clean Up has been reported. More...
 
virtual bool StartTracking () override
 Start to Track the tools already defined. If no tools are defined for this tracker, it returns an error. Tools can be added using either AddToolByDescriptionFile or AddToolsByConfigurationFiles. More...
 
virtual bool StopTracking () override
 Stop the Tracking Thread and tools will not longer be updated. More...
 
TrackingToolGetTool (unsigned int toolNumber) const override
 Return the tool pointer of the tool number toolNumber. More...
 
OptitrackTrackingToolGetOptitrackTool (unsigned int toolNumber) const
 Return the tool pointer of the tool number toolNumber. More...
 
unsigned int GetToolCount () const override
 Returns the number of defined tools. More...
 
virtual void SetExp (int _arg)
 Sets the directory where the calibration file of the MicronTracker can be found. More...
 
virtual int GetExp ()
 Gets the current calibration directory. More...
 
virtual void SetLed (int _arg)
 Sets the directory where the calibration file of the MicronTracker can be found. More...
 
virtual int GetLed ()
 Gets the current calibration directory. More...
 
virtual void SetThr (int _arg)
 Sets the directory where the calibration file of the MicronTracker can be found. More...
 
virtual int GetThr ()
 Gets the current calibration directory. More...
 
void SetCalibrationPath (std::string calibrationPath)
 Sets the file where the calibration of the OptitrackTracker can be found. More...
 
virtual std::string GetcalibrationPath ()
 Gets the current calibration file. More...
 
void TrackTools ()
 Update each tool location in the list m_AllTools. More...
 
bool LoadCalibration ()
 Load the Calibration file to the Optitrack System and set the cameras in calibrated locations. More...
 
bool SetCameraParams (int exposure, int threshold, int intensity, int videoType=4)
 Set the Cameras Exposure, Threshold and Intensity of IR LEDs. By Default it set the Video type to 4: Precision Mode for tracking //== VideoType: //== 0 = Segment Mode //== 1 = Grayscale Mode //== 2 = Object Mode //== 4 = Precision Mode //== 6 = MJPEG Mode (V100R2 only) More...
 
bool InitializeCameras ()
 Initialize the Optitrack System. More...
 
bool AddToolByDefinitionFile (std::string fileName)
 Add a new tool using a text file which described the tool. The file must to have the next structure ToolName #NumberOfMarkers X Y Z - for the first marker X Y Z - for the second marker ... X Y Z - for the last marker, the number #NumberOfMarkers X Y Z - for the PIVOT point. 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 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...
 

Static Public Member Functions

static Pointer New ()
 
static ITK_THREAD_RETURN_TYPE ThreadStartTracking (void *data)
 Start the Tracking Thread for the tools. More...
 

Protected Member Functions

 OptitrackTrackingDevice ()
 This function load a file with Tools definitions provided for the software. More...
 
 ~OptitrackTrackingDevice ()
 
- Protected Member Functions inherited from mitk::TrackingDevice
void SetState (TrackingDeviceState state)
 change object state More...
 
 TrackingDevice ()
 
virtual ~TrackingDevice ()
 

Additional Inherited Members

- 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

An object of this class represents the Optitrack 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. Remember that it will be necessary to to have a license for using the Optitrack System. See http://www.naturalpoint.com/ for details.

Documentation:

Author
E. Marinetto (emari.nosp@m.nett.nosp@m.o@hgg.nosp@m.m.es) Instituto de Investigación Sanitaria Gregorio Marañón, Madrid, Spain. & M. Noll (matth.nosp@m.ias..nosp@m.noll@.nosp@m.igd..nosp@m.fraun.nosp@m.hofe.nosp@m.r.de) Cognitive Computing & Medical Imaging | Fraunhofer IGD

Definition at line 66 of file mitkOptitrackTrackingDevice.h.

Member Typedef Documentation

Constructor & Destructor Documentation

mitk::OptitrackTrackingDevice::OptitrackTrackingDevice ( )
protected

This function load a file with Tools definitions provided for the software.

Returns
Returns true if file is correctly loaded with all the tools
Exceptions
mitk::IGTExceptionThrows an exception if there is an error during the Initialization Constructor & Destructor of the class

Definition at line 631 of file mitkOptitrackTrackingDevice.cpp.

References mitk::OptitrackErrorMessages::GetOptitrackErrorMessage(), and MITK_WARN.

mitk::OptitrackTrackingDevice::~OptitrackTrackingDevice ( )
protected

Member Function Documentation

bool mitk::OptitrackTrackingDevice::AddToolByDefinitionFile ( std::string  fileName)

Add a new tool using a text file which described the tool. The file must to have the next structure ToolName #NumberOfMarkers X Y Z - for the first marker X Y Z - for the second marker ... X Y Z - for the last marker, the number #NumberOfMarkers X Y Z - for the PIVOT point.

Returns
Returns true if system was initialized correctly
Exceptions
mitk::IGTExceptionThrows an exception if Tool could not be added or System is not Initialized

Definition at line 764 of file mitkOptitrackTrackingDevice.cpp.

References mitk::OptitrackErrorMessages::GetOptitrackErrorMessage(), and MITK_WARN.

bool mitk::OptitrackTrackingDevice::CloseConnection ( )
overridevirtual

Close the Connection with the Tracker. Also CleanUp the Optitrack variables using the API: TT_CleanUp and TT_ShutDown. Sometimes API does not work properly and some problems during the Clean Up has been reported.

Returns
Returns true if the cleaning up and shutdown worked correctly. Throws an exception if an error occures related to the Optitrack API messages.
Exceptions
mitk::IGTExceptionThrows an exception if the System cannot ShutDown now or was not initialized.

Implements mitk::TrackingDevice.

Definition at line 684 of file mitkOptitrackTrackingDevice.cpp.

References mitk::OptitrackErrorMessages::GetOptitrackErrorMessage(), and MITK_WARN.

virtual std::string mitk::OptitrackTrackingDevice::GetcalibrationPath ( )
virtual

Gets the current calibration file.

virtual int mitk::OptitrackTrackingDevice::GetExp ( )
virtual

Gets the current calibration directory.

virtual int mitk::OptitrackTrackingDevice::GetLed ( )
virtual

Gets the current calibration directory.

mitk::OptitrackTrackingTool * mitk::OptitrackTrackingDevice::GetOptitrackTool ( unsigned int  toolNumber) const

Return the tool pointer of the tool number toolNumber.

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.
Exceptions
mitk::IGTExceptionThrows an exception if there is the required tool does not exist.

Definition at line 720 of file mitkOptitrackTrackingDevice.cpp.

References mitk::OptitrackErrorMessages::GetOptitrackErrorMessage(), and MITK_WARN.

virtual int mitk::OptitrackTrackingDevice::GetThr ( )
virtual

Gets the current calibration directory.

mitk::TrackingTool * mitk::OptitrackTrackingDevice::GetTool ( unsigned int  toolNumber) const
overridevirtual

Return the tool pointer of the tool number toolNumber.

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.

Definition at line 755 of file mitkOptitrackTrackingDevice.cpp.

References mitk::OptitrackErrorMessages::GetOptitrackErrorMessage(), and MITK_WARN.

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

Returns the number of defined tools.

Returns
Returns the number of defined tools in the Optitrack device.

Implements mitk::TrackingDevice.

Definition at line 729 of file mitkOptitrackTrackingDevice.cpp.

References mitk::OptitrackErrorMessages::GetOptitrackErrorMessage(), and MITK_WARN.

bool mitk::OptitrackTrackingDevice::InitializeCameras ( )

Initialize the Optitrack System.

Returns
Returns true if system was initialized correctly
Exceptions
mitk::IGTExceptionThrows an exception if the Optitrack Tracking System cannot be initialized

Definition at line 658 of file mitkOptitrackTrackingDevice.cpp.

References mitk::OptitrackErrorMessages::GetOptitrackErrorMessage(), and MITK_WARN.

bool mitk::OptitrackTrackingDevice::IsDeviceInstalled ( )
overridevirtual
Returns
Returns true if the Optitrack tracker is installed on this build (means activated in CMAKE). False if not.

Reimplemented from mitk::TrackingDevice.

Definition at line 623 of file mitkOptitrackTrackingDevice.cpp.

bool mitk::OptitrackTrackingDevice::LoadCalibration ( )

Load the Calibration file to the Optitrack System and set the cameras in calibrated locations.

Returns
Returns true if the calibration was uploaded correctly
Exceptions
mitk::IGTExceptionThrows an exception if Calibration Path is empty, the System cannot load a calibration file or System is not ready for load a calibration file because it has not been initialized yet

Definition at line 667 of file mitkOptitrackTrackingDevice.cpp.

References mitk::OptitrackErrorMessages::GetOptitrackErrorMessage(), and MITK_WARN.

mitk::OptitrackTrackingDevice::mitkClassMacro ( OptitrackTrackingDevice  ,
mitk::TrackingDevice   
)
static Pointer mitk::OptitrackTrackingDevice::New ( )
static
bool mitk::OptitrackTrackingDevice::OpenConnection ( )
overridevirtual

Open the Connection with the Tracker. Calls LoadCalibration function and set the system up with the calibration file. Remember that you have to set a calibration file first to open a correct connection to the Optical Tracking System.

Returns
Returns true if the connection is well done. Throws an exception if an error occures related to the Optitrack API messages.
Exceptions
mitk::IGTExceptionThrows an exception if InitializeCameras or LoadCalibration failed.

Implements mitk::TrackingDevice.

Definition at line 649 of file mitkOptitrackTrackingDevice.cpp.

References mitk::OptitrackErrorMessages::GetOptitrackErrorMessage(), and MITK_WARN.

void mitk::OptitrackTrackingDevice::SetCalibrationPath ( std::string  calibrationPath)

Sets the file where the calibration of the OptitrackTracker can be found.

Definition at line 676 of file mitkOptitrackTrackingDevice.cpp.

References mitk::OptitrackErrorMessages::GetOptitrackErrorMessage(), and MITK_WARN.

bool mitk::OptitrackTrackingDevice::SetCameraParams ( int  exposure,
int  threshold,
int  intensity,
int  videoType = 4 
)

Set the Cameras Exposure, Threshold and Intensity of IR LEDs. By Default it set the Video type to 4: Precision Mode for tracking //== VideoType: //== 0 = Segment Mode //== 1 = Grayscale Mode //== 2 = Object Mode //== 4 = Precision Mode //== 6 = MJPEG Mode (V100R2 only)

Returns
Returns true if all cameras were set up correctly
Exceptions
mitk::IGTExceptionThrows an exception if System is not Initialized

Definition at line 746 of file mitkOptitrackTrackingDevice.cpp.

References mitk::OptitrackErrorMessages::GetOptitrackErrorMessage(), and MITK_WARN.

virtual void mitk::OptitrackTrackingDevice::SetExp ( int  _arg)
virtual

Sets the directory where the calibration file of the MicronTracker can be found.

virtual void mitk::OptitrackTrackingDevice::SetLed ( int  _arg)
virtual

Sets the directory where the calibration file of the MicronTracker can be found.

virtual void mitk::OptitrackTrackingDevice::SetThr ( int  _arg)
virtual

Sets the directory where the calibration file of the MicronTracker can be found.

bool mitk::OptitrackTrackingDevice::StartTracking ( )
overridevirtual

Start to Track the tools already defined. If no tools are defined for this tracker, it returns an error. Tools can be added using either AddToolByDescriptionFile or AddToolsByConfigurationFiles.

Returns
Returns true at least one tool was defined and the tracking is correct
Exceptions
mitk::IGTExceptionThrows an exception if the System is not in State Ready .

Implements mitk::TrackingDevice.

Definition at line 693 of file mitkOptitrackTrackingDevice.cpp.

References mitk::OptitrackErrorMessages::GetOptitrackErrorMessage(), and MITK_WARN.

bool mitk::OptitrackTrackingDevice::StopTracking ( )
overridevirtual

Stop the Tracking Thread and tools will not longer be updated.

Returns
Returns true if Tracking thread could be stopped.
Exceptions
mitk::IGTExceptionThrows an exception if System is not in State Tracking.

Reimplemented from mitk::TrackingDevice.

Definition at line 702 of file mitkOptitrackTrackingDevice.cpp.

References mitk::OptitrackErrorMessages::GetOptitrackErrorMessage(), and MITK_WARN.

ITK_THREAD_RETURN_TYPE mitk::OptitrackTrackingDevice::ThreadStartTracking ( void *  data)
static

Start the Tracking Thread for the tools.

Exceptions
mitk::IGTExceptionThrows an exception if variable trackingDevice is NULL

Definition at line 711 of file mitkOptitrackTrackingDevice.cpp.

References mitk::OptitrackErrorMessages::GetOptitrackErrorMessage(), and MITK_WARN.

void mitk::OptitrackTrackingDevice::TrackTools ( )

Update each tool location in the list m_AllTools.

Exceptions
mitk::IGTExceptionThrows an exception if the getting data operation failed for a defined tool

Definition at line 738 of file mitkOptitrackTrackingDevice.cpp.

References mitk::OptitrackErrorMessages::GetOptitrackErrorMessage(), and MITK_WARN.


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