Medical Imaging Interaction Toolkit
2018.4.99-389bf124
Medical Imaging Interaction Toolkit
|
Class representing a tracking device which generates random positions / orientations. No hardware is needed for tracking device. More...
#include <mitkVirtualTrackingDevice.h>
Public Member Functions | |
mitkClassMacro (VirtualTrackingDevice, TrackingDevice) | |
Pointer | Clone () const |
virtual void | SetRefreshRate (unsigned int _arg) |
Sets the refresh rate of the virtual tracking device in ms. More... | |
virtual unsigned int | GetRefreshRate () const |
Returns the refresh rate in ms. More... | |
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 |
TrackingTool * | GetTool (unsigned int toolNumber) const override |
TrackingTool * | AddTool (const char *toolName) |
Adds a tool to the tracking device. More... | |
virtual void | SetBounds (mitk::ScalarType data[]) |
Set the tracking volume bounds. More... | |
const mitk::ScalarType * | GetBounds () const |
return the tracking volume bounds More... | |
mitk::ScalarType | GetSplineChordLength (unsigned int idx) |
return the approximate length of the spline for tool with index idx in millimeter More... | |
void | SetToolSpeed (unsigned int idx, mitk::ScalarType roundsPerSecond) |
sets the speed of the tool idx in rounds per second More... | |
void | EnableGaussianNoise () |
enable addition of Gaussian Noise to tracking coordinates More... | |
void | DisableGaussianNoise () |
disable addition of Gaussian Noise to Trackin coordinates More... | |
void | SetParamsForGaussianNoise (double meanDistribution, double deviationDistribution) |
sets the mean distribution and the standard deviation for the Gaussian Noise More... | |
double | GetMeanDistribution () |
returns the mean distribution for the Gaussian Noise More... | |
double | GetDeviationDistribution () |
returns the deviation distribution for the Gaussian Noise More... | |
![]() | |
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 | IsDeviceInstalled () |
virtual bool | AutoDetectToolsAvailable () |
virtual bool | AddSingleToolIsAvailable () |
virtual mitk::NavigationToolStorage::Pointer | AutoDetectTools () |
Static Public Member Functions | |
static Pointer | New () |
Protected Types | |
typedef mitk::VirtualTrackingTool::SplineType::ControlPointType | ControlPointType |
typedef std::vector< VirtualTrackingTool::Pointer > | ToolContainer |
container type for tracking tools More... | |
Protected Member Functions | |
VirtualTrackingDevice () | |
~VirtualTrackingDevice () override | |
void | TrackTools () |
This method tracks tools as long as the variable m_Mode is set to "Tracking". Tracking tools means generating random numbers for the tool position and orientation. More... | |
void | InitializeSpline (mitk::VirtualTrackingTool *t) |
initializes the spline path of the tool t with random control points inside the current tracking volume More... | |
ControlPointType | GetRandomPoint () |
returns a random position inside the tracking volume (defined by m_Bounds) More... | |
mitk::VirtualTrackingTool * | GetInternalTool (unsigned int idx) |
![]() | |
void | SetState (TrackingDeviceState state) |
change object state More... | |
TrackingDevice () | |
~TrackingDevice () override | |
Static Protected Member Functions | |
static ITK_THREAD_RETURN_TYPE | ThreadStartTracking (void *data) |
static start method for tracking thread More... | |
Protected Attributes | |
ToolContainer | m_AllTools |
container for all tracking tools More... | |
itk::FastMutexLock::Pointer | m_ToolsMutex |
mutex for coordinated access of tool container More... | |
itk::MultiThreader::Pointer | m_MultiThreader |
MultiThreader that starts continuous tracking update. More... | |
int | m_ThreadID |
unsigned int | m_RefreshRate |
refresh rate of the internal tracking thread in milliseconds (NOT refreshs per second!) More... | |
unsigned int | m_NumberOfControlPoints |
number of control points for the random path generation More... | |
mitk::ScalarType | m_Bounds [6] |
bounding box of the tracking volume stored as {xMin, xMax, yMin, yMax, zMin, zMax} More... | |
bool | m_GaussianNoiseEnabled |
adding Gaussian Noise to tracking coordinates or not, false by default More... | |
double | m_MeanDistributionParam |
double | m_DeviationDistributionParam |
mean distribution for Gaussion Noise, 0.0 by default More... | |
![]() | |
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 } |
Class representing a tracking device which generates random positions / orientations. No hardware is needed for tracking device.
Documentation This TrackingDevice class does not interface with a physical tracking device. It simulates a tracking device by moving the tools on a randomly generated spline path.
Definition at line 35 of file mitkVirtualTrackingDevice.h.
|
protected |
Definition at line 194 of file mitkVirtualTrackingDevice.h.
|
protected |
container type for tracking tools
Definition at line 199 of file mitkVirtualTrackingDevice.h.
|
protected |
Definition at line 28 of file mitkVirtualTrackingDevice.cpp.
References mitk::VirtualTrackerTypeInformation::GetDeviceDataVirtualTracker(), m_Bounds, mitk::TrackingDevice::m_Data, and m_ToolsMutex.
|
overrideprotected |
Definition at line 38 of file mitkVirtualTrackingDevice.cpp.
References CloseConnection(), mitk::TrackingDevice::GetState(), m_AllTools, m_MultiThreader, m_ThreadID, mitk::TrackingDevice::Ready, StopTracking(), and mitk::TrackingDevice::Tracking.
mitk::TrackingTool * mitk::VirtualTrackingDevice::AddTool | ( | const char * | toolName | ) |
Adds a tool to the tracking device.
The tool will have a random path on which it will move around. The path is created with a spline function and random control points inside the tracking volume.
toolName | The tool which will be added. |
Definition at line 57 of file mitkVirtualTrackingDevice.cpp.
References InitializeSpline(), m_AllTools, m_ToolsMutex, and mitk::VirtualTrackingTool::New().
Pointer mitk::VirtualTrackingDevice::Clone | ( | ) | const |
|
overridevirtual |
Closes the connection and clears all resources.
Implements mitk::TrackingDevice.
Definition at line 171 of file mitkVirtualTrackingDevice.cpp.
References mitk::TrackingDevice::GetState(), mitk::TrackingDevice::SetState(), and mitk::TrackingDevice::Setup.
Referenced by ~VirtualTrackingDevice().
void mitk::VirtualTrackingDevice::DisableGaussianNoise | ( | ) |
disable addition of Gaussian Noise to Trackin coordinates
Definition at line 312 of file mitkVirtualTrackingDevice.cpp.
References m_GaussianNoiseEnabled.
void mitk::VirtualTrackingDevice::EnableGaussianNoise | ( | ) |
enable addition of Gaussian Noise to tracking coordinates
Definition at line 307 of file mitkVirtualTrackingDevice.cpp.
References m_GaussianNoiseEnabled.
|
inline |
return the tracking volume bounds
This will return the tracking volume as an axis aligned bounding box defined by the six bounds values xMin, xMax, yMin, yMax, zMin, zMax
Definition at line 126 of file mitkVirtualTrackingDevice.h.
double mitk::VirtualTrackingDevice::GetDeviationDistribution | ( | ) |
returns the deviation distribution for the Gaussian Noise
Definition at line 323 of file mitkVirtualTrackingDevice.cpp.
References m_DeviationDistributionParam.
|
protected |
Definition at line 202 of file mitkVirtualTrackingDevice.cpp.
References m_AllTools, and m_ToolsMutex.
Referenced by GetSplineChordLength(), SetToolSpeed(), and TrackTools().
double mitk::VirtualTrackingDevice::GetMeanDistribution | ( | ) |
returns the mean distribution for the Gaussian Noise
Definition at line 328 of file mitkVirtualTrackingDevice.cpp.
References m_MeanDistributionParam.
|
protected |
returns a random position inside the tracking volume (defined by m_Bounds)
Definition at line 297 of file mitkVirtualTrackingDevice.cpp.
References m_Bounds.
Referenced by InitializeSpline().
|
virtual |
Returns the refresh rate in ms.
mitk::ScalarType mitk::VirtualTrackingDevice::GetSplineChordLength | ( | unsigned int | idx | ) |
return the approximate length of the spline for tool with index idx in millimeter
if the index idx is not a valid tool index, a std::invalid_argument exception is thrown. GetSplineChordLength() returns the distance between all control points of the spline in millimeter. This can be used as an approximation for the length of the spline path.
Definition at line 181 of file mitkVirtualTrackingDevice.cpp.
References GetInternalTool(), and mitk::VirtualTrackingTool::GetSplineLength().
|
overridevirtual |
toolNumber | The number of the tool which should be given back. |
Implements mitk::TrackingDevice.
Definition at line 117 of file mitkVirtualTrackingDevice.cpp.
References m_AllTools, and m_ToolsMutex.
|
overridevirtual |
Implements mitk::TrackingDevice.
Definition at line 111 of file mitkVirtualTrackingDevice.cpp.
References m_AllTools, and m_ToolsMutex.
Referenced by TrackTools().
|
protected |
initializes the spline path of the tool t with random control points inside the current tracking volume
Definition at line 137 of file mitkVirtualTrackingDevice.cpp.
References GetRandomPoint(), mitk::VirtualTrackingTool::GetSpline(), itk::NonUniformBSpline< TDimension >::GetSplineOrder(), m_NumberOfControlPoints, itk::NonUniformBSpline< TDimension >::SetControlPoints(), itk::NonUniformBSpline< TDimension >::SetKnots(), and mitk::VirtualTrackingTool::SetSplineLength().
Referenced by AddTool().
mitk::VirtualTrackingDevice::mitkClassMacro | ( | VirtualTrackingDevice | , |
TrackingDevice | |||
) |
|
static |
Referenced by QmitkVirtualTrackerWidget::GetTrackingDevice(), main(), and mitkTrackingDeviceSourceTest().
|
overridevirtual |
Opens the connection to the device. This have to be done before the tracking is started.
mitk::IGTException | Throws an exception if there are two less control points to start the the virtual device. |
Implements mitk::TrackingDevice.
Definition at line 125 of file mitkVirtualTrackingDevice.cpp.
References m_NumberOfControlPoints, mitkThrowException, mitk::TrackingDevice::Ready, and mitk::TrackingDevice::SetState().
|
virtual |
Set the tracking volume bounds.
This will set the tracking volume as an axis aligned bounding box defined by the six bounds values xMin, xMax, yMin, yMax, zMin, zMax. Note that the random path of existing tools will not be updated with the new tracking volume. Tools that are created after calling SetBounds() will use the new tracking volume
void mitk::VirtualTrackingDevice::SetParamsForGaussianNoise | ( | double | meanDistribution, |
double | deviationDistribution | ||
) |
sets the mean distribution and the standard deviation for the Gaussian Noise
Definition at line 317 of file mitkVirtualTrackingDevice.cpp.
References m_DeviationDistributionParam, and m_MeanDistributionParam.
|
virtual |
Sets the refresh rate of the virtual tracking device in ms.
void mitk::VirtualTrackingDevice::SetToolSpeed | ( | unsigned int | idx, |
mitk::ScalarType | roundsPerSecond | ||
) |
sets the speed of the tool idx in rounds per second
The virtual tools will travel along a closed spline path. This method sets the speed of a tool as a factor of how many rounds per second the tool should move. A setting of 1.0 will indicate one complete round per second. Together with GetSplineChordLength(), the speed in millimeter per second can be estimated. roundsPerSecond must be positive and larger than 0.0001.
Definition at line 190 of file mitkVirtualTrackingDevice.cpp.
References GetInternalTool(), and mitk::VirtualTrackingTool::SetVelocity().
|
overridevirtual |
Starts the tracking.
After StartTracking() is called, the tools will move on their spline paths with a constant velocity that can be set with SetToolSpeed(). The standard velocity is 10 seconds for one complete cycle along the spline path.
Implements mitk::TrackingDevice.
Definition at line 73 of file mitkVirtualTrackingDevice.cpp.
References mitk::IGTTimeStamp::GetInstance(), mitk::TrackingDevice::GetState(), m_MultiThreader, mitk::TrackingDevice::m_StopTracking, mitk::TrackingDevice::m_StopTrackingMutex, m_ThreadID, 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 93 of file mitkVirtualTrackingDevice.cpp.
References mitk::IGTTimeStamp::GetInstance(), mitk::TrackingDevice::GetState(), mitk::TrackingDevice::m_StopTracking, mitk::TrackingDevice::m_StopTrackingMutex, mitk::TrackingDevice::m_TrackingFinishedMutex, mitk::TrackingDevice::Ready, mitk::TrackingDevice::SetState(), mitk::IGTTimeStamp::Stop(), and mitk::TrackingDevice::Tracking.
Referenced by ~VirtualTrackingDevice().
|
staticprotected |
static start method for tracking thread
Definition at line 276 of file mitkVirtualTrackingDevice.cpp.
References m_ThreadID, and TrackTools().
Referenced by StartTracking().
|
protected |
This method tracks tools as long as the variable m_Mode is set to "Tracking". Tracking tools means generating random numbers for the tool position and orientation.
mitk::IGTException | Throws an mitk::IGTException if there is an error during virtual tool tracking. |
Definition at line 211 of file mitkVirtualTrackingDevice.cpp.
References GetInternalTool(), mitk::TrackingDevice::GetState(), GetToolCount(), mitk::itk2vtk(), m_DeviationDistributionParam, m_GaussianNoiseEnabled, m_MeanDistributionParam, m_RefreshRate, mitk::TrackingDevice::m_StopTracking, mitk::TrackingDevice::m_StopTrackingMutex, mitk::TrackingDevice::m_TrackingFinishedMutex, and mitk::TrackingDevice::Tracking.
Referenced by ThreadStartTracking().
|
protected |
container for all tracking tools
Definition at line 200 of file mitkVirtualTrackingDevice.h.
Referenced by AddTool(), GetInternalTool(), GetTool(), GetToolCount(), and ~VirtualTrackingDevice().
|
protected |
bounding box of the tracking volume stored as {xMin, xMax, yMin, yMax, zMin, zMax}
Definition at line 209 of file mitkVirtualTrackingDevice.h.
Referenced by GetRandomPoint(), and VirtualTrackingDevice().
|
protected |
mean distribution for Gaussion Noise, 0.0 by default
deviation distribution for Gaussian Noise, 1.0 by default
Definition at line 212 of file mitkVirtualTrackingDevice.h.
Referenced by GetDeviationDistribution(), SetParamsForGaussianNoise(), and TrackTools().
|
protected |
adding Gaussian Noise to tracking coordinates or not, false by default
Definition at line 210 of file mitkVirtualTrackingDevice.h.
Referenced by DisableGaussianNoise(), EnableGaussianNoise(), and TrackTools().
|
protected |
Definition at line 211 of file mitkVirtualTrackingDevice.h.
Referenced by GetMeanDistribution(), SetParamsForGaussianNoise(), and TrackTools().
|
protected |
MultiThreader that starts continuous tracking update.
Definition at line 203 of file mitkVirtualTrackingDevice.h.
Referenced by StartTracking(), and ~VirtualTrackingDevice().
|
protected |
number of control points for the random path generation
Definition at line 207 of file mitkVirtualTrackingDevice.h.
Referenced by InitializeSpline(), and OpenConnection().
|
protected |
refresh rate of the internal tracking thread in milliseconds (NOT refreshs per second!)
Definition at line 206 of file mitkVirtualTrackingDevice.h.
Referenced by TrackTools().
|
protected |
Definition at line 204 of file mitkVirtualTrackingDevice.h.
Referenced by StartTracking(), ThreadStartTracking(), and ~VirtualTrackingDevice().
|
protected |
mutex for coordinated access of tool container
Definition at line 201 of file mitkVirtualTrackingDevice.h.
Referenced by AddTool(), GetInternalTool(), GetTool(), GetToolCount(), and VirtualTrackingDevice().