MITK-IGT
IGT Extension of MITK
Loading...
Searching...
No Matches
mitkVirtualTrackingDevice.h
Go to the documentation of this file.
1/*============================================================================
2
3The Medical Imaging Interaction Toolkit (MITK)
4
5Copyright (c) German Cancer Research Center (DKFZ)
6All rights reserved.
7
8Use of this source code is governed by a 3-clause BSD license that can be
9found in the LICENSE file.
10
11============================================================================*/
12
13#ifndef mitkVirtualTrackingDevice_h
14#define mitkVirtualTrackingDevice_h
15
16#include <MitkIGTExports.h>
17#include <mitkTrackingDevice.h>
19
20#include <mutex>
21#include <thread>
22#include <vector>
23
24namespace mitk
25{
35 class MITKIGT_EXPORT VirtualTrackingDevice : public TrackingDevice
36 {
37 public:
38
42
48 itkSetMacro(RefreshRate, unsigned int);
49
54 itkGetConstMacro(RefreshRate, unsigned int);
55
65 bool StartTracking() override;
66
71 bool StopTracking() override;
72
77 bool OpenConnection() override;
78
82 bool CloseConnection() override;
83
87 unsigned int GetToolCount() const override;
88
94 TrackingTool* GetTool(unsigned int toolNumber) const override;
95
105 TrackingTool* AddTool(const char* toolName);
106
107
117 itkSetVectorMacro(Bounds, mitk::ScalarType, 6);
118
125 const mitk::ScalarType* GetBounds() const
126 {
127 return m_Bounds;
128 };
129
138 mitk::ScalarType GetSplineChordLength(unsigned int idx);
139
151 void SetToolSpeed(unsigned int idx, mitk::ScalarType roundsPerSecond);
152
156 void EnableGaussianNoise();
157
161 void DisableGaussianNoise();
162
167 void SetParamsForGaussianNoise(double meanDistribution, double deviationDistribution);
168
172 double GetMeanDistribution();
173
177 double GetDeviationDistribution();
178
179 protected:
181 ~VirtualTrackingDevice() override;
187 void TrackTools();
188
189 void InitializeSpline(mitk::VirtualTrackingTool* t);
190
191 void ThreadStartTracking();
192
193 typedef mitk::VirtualTrackingTool::SplineType::ControlPointType ControlPointType;
194
195 ControlPointType GetRandomPoint();
196 mitk::VirtualTrackingTool* GetInternalTool(unsigned int idx);
197
198 typedef std::vector<VirtualTrackingTool::Pointer> ToolContainer;
200 mutable std::mutex m_ToolsMutex;
201
202 std::thread m_Thread;
203
204 unsigned int m_RefreshRate;
206
207 mitk::ScalarType m_Bounds[6];
211 };
212}//mitk
213#endif
Interface for all Tracking Devices.
Interface for all Tracking Tools.
Class representing a tracking device which generates random positions / orientations....
unsigned int m_RefreshRate
refresh rate of the internal tracking thread in milliseconds (NOT refreshs per second!...
std::vector< VirtualTrackingTool::Pointer > ToolContainer
container type for tracking tools
bool m_GaussianNoiseEnabled
adding Gaussian Noise to tracking coordinates or not, false by default
double m_DeviationDistributionParam
mean distribution for Gaussion Noise, 0.0 by default
mitk::VirtualTrackingTool::SplineType::ControlPointType ControlPointType
itkSetVectorMacro(Bounds, mitk::ScalarType, 6)
Set the tracking volume bounds.
itkGetConstMacro(RefreshRate, unsigned int)
Returns the refresh rate in ms.
std::mutex m_ToolsMutex
mutex for coordinated access of tool container
mitkClassMacro(VirtualTrackingDevice, TrackingDevice)
const mitk::ScalarType * GetBounds() const
return the tracking volume bounds
unsigned int m_NumberOfControlPoints
number of control points for the random path generation
ToolContainer m_AllTools
container for all tracking tools
itkSetMacro(RefreshRate, unsigned int)
Sets the refresh rate of the virtual tracking device in ms.
implements TrackingTool interface
IGT Exceptions.