Medical Imaging Interaction Toolkit  2023.12.00
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 
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 
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 
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;
205  unsigned int m_NumberOfControlPoints;
206 
207  mitk::ScalarType m_Bounds[6];
211  };
212 }//mitk
213 #endif
mitk::VirtualTrackingDevice::ToolContainer
std::vector< VirtualTrackingTool::Pointer > ToolContainer
container type for tracking tools
Definition: mitkVirtualTrackingDevice.h:198
mitk::VirtualTrackingDevice::m_Thread
std::thread m_Thread
Definition: mitkVirtualTrackingDevice.h:202
mitk::VirtualTrackingDevice::m_GaussianNoiseEnabled
bool m_GaussianNoiseEnabled
adding Gaussian Noise to tracking coordinates or not, false by default
Definition: mitkVirtualTrackingDevice.h:208
mitkVirtualTrackingTool.h
mitk::VirtualTrackingDevice::m_MeanDistributionParam
double m_MeanDistributionParam
Definition: mitkVirtualTrackingDevice.h:209
mitk::VirtualTrackingTool
implements TrackingTool interface
Definition: mitkVirtualTrackingTool.h:35
mitk
Find image slices visible on a given plane.
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:210
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:125
mitk::VirtualTrackingDevice::ControlPointType
mitk::VirtualTrackingTool::SplineType::ControlPointType ControlPointType
Definition: mitkVirtualTrackingDevice.h:193
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:199
mitk::VirtualTrackingDevice::m_ToolsMutex
std::mutex m_ToolsMutex
mutex for coordinated access of tool container
Definition: mitkVirtualTrackingDevice.h:200
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:205
mitk::VirtualTrackingDevice::m_RefreshRate
unsigned int m_RefreshRate
refresh rate of the internal tracking thread in milliseconds (NOT refreshs per second!...
Definition: mitkVirtualTrackingDevice.h:204
mitk::ScalarType
double ScalarType
Definition: mitkNumericConstants.h:20