Medical Imaging Interaction Toolkit  2023.04.00
Medical Imaging Interaction Toolkit
mitkVirtualTrackingDevice.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found 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 
24 namespace mitk
25 {
35  class MITKIGT_EXPORT VirtualTrackingDevice : public TrackingDevice
36  {
37  public:
38 
40  itkFactorylessNewMacro(Self);
41  itkCloneMacro(Self);
42 
49  itkSetMacro(RefreshRate, unsigned int);
50 
55  itkGetConstMacro(RefreshRate, unsigned int);
56 
66  bool StartTracking() override;
67 
72  bool StopTracking() override;
73 
78  bool OpenConnection() override;
79 
83  bool CloseConnection() override;
84 
88  unsigned int GetToolCount() const override;
89 
95  TrackingTool* GetTool(unsigned int toolNumber) const override;
96 
106  TrackingTool* AddTool(const char* toolName);
107 
108 
118  itkSetVectorMacro(Bounds, mitk::ScalarType, 6);
119 
127  {
128  return m_Bounds;
129  };
130 
139  mitk::ScalarType GetSplineChordLength(unsigned int idx);
140 
152  void SetToolSpeed(unsigned int idx, mitk::ScalarType roundsPerSecond);
153 
157  void EnableGaussianNoise();
158 
162  void DisableGaussianNoise();
163 
168  void SetParamsForGaussianNoise(double meanDistribution, double deviationDistribution);
169 
173  double GetMeanDistribution();
174 
178  double GetDeviationDistribution();
179 
180  protected:
182  ~VirtualTrackingDevice() override;
188  void TrackTools();
189 
190  void InitializeSpline(mitk::VirtualTrackingTool* t);
191 
192  void ThreadStartTracking();
193 
195 
196  ControlPointType GetRandomPoint();
197  mitk::VirtualTrackingTool* GetInternalTool(unsigned int idx);
198 
199  typedef std::vector<VirtualTrackingTool::Pointer> ToolContainer;
201  mutable std::mutex m_ToolsMutex;
202 
203  std::thread m_Thread;
204 
205  unsigned int m_RefreshRate;
206  unsigned int m_NumberOfControlPoints;
207 
208  mitk::ScalarType m_Bounds[6];
212  };
213 }//mitk
214 #endif
mitk::VirtualTrackingDevice::ToolContainer
std::vector< VirtualTrackingTool::Pointer > ToolContainer
container type for tracking tools
Definition: mitkVirtualTrackingDevice.h:199
mitk::VirtualTrackingDevice::m_Thread
std::thread m_Thread
Definition: mitkVirtualTrackingDevice.h:203
mitk::VirtualTrackingDevice::m_GaussianNoiseEnabled
bool m_GaussianNoiseEnabled
adding Gaussian Noise to tracking coordinates or not, false by default
Definition: mitkVirtualTrackingDevice.h:209
mitkVirtualTrackingTool.h
mitk::VirtualTrackingDevice::m_MeanDistributionParam
double m_MeanDistributionParam
Definition: mitkVirtualTrackingDevice.h:210
mitk::VirtualTrackingTool
implements TrackingTool interface
Definition: mitkVirtualTrackingTool.h:35
mitk
DataCollection - Class to facilitate loading/accessing structured data.
Definition: RenderingTests.dox:1
mitk::TrackingDevice
Interface for all Tracking Devices.
Definition: mitkTrackingDevice.h:34
mitk::VirtualTrackingDevice::m_DeviationDistributionParam
double m_DeviationDistributionParam
mean distribution for Gaussion Noise, 0.0 by default
Definition: mitkVirtualTrackingDevice.h:211
mitk::VirtualTrackingDevice
Class representing a tracking device which generates random positions / orientations....
Definition: mitkVirtualTrackingDevice.h:35
itk::NonUniformBSpline::ControlPointType
itk::Point< double, TDimension > ControlPointType
Definition: mitkItkNonUniformBSpline.h:72
mitk::VirtualTrackingDevice::GetBounds
const mitk::ScalarType * GetBounds() const
return the tracking volume bounds
Definition: mitkVirtualTrackingDevice.h:126
mitk::VirtualTrackingDevice::ControlPointType
mitk::VirtualTrackingTool::SplineType::ControlPointType ControlPointType
Definition: mitkVirtualTrackingDevice.h:194
mitk::TrackingTool
Interface for all Tracking Tools.
Definition: mitkTrackingTool.h:42
mitk::VirtualTrackingDevice::m_AllTools
ToolContainer m_AllTools
container for all tracking tools
Definition: mitkVirtualTrackingDevice.h:200
mitk::VirtualTrackingDevice::m_ToolsMutex
std::mutex m_ToolsMutex
mutex for coordinated access of tool container
Definition: mitkVirtualTrackingDevice.h:201
mitkClassMacro
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:36
mitkTrackingDevice.h
mitk::VirtualTrackingDevice::m_NumberOfControlPoints
unsigned int m_NumberOfControlPoints
number of control points for the random path generation
Definition: mitkVirtualTrackingDevice.h:206
mitk::VirtualTrackingDevice::m_RefreshRate
unsigned int m_RefreshRate
refresh rate of the internal tracking thread in milliseconds (NOT refreshs per second!...
Definition: mitkVirtualTrackingDevice.h:205
mitk::ScalarType
double ScalarType
Definition: mitkNumericConstants.h:20