Medical Imaging Interaction Toolkit  2018.4.99-3e3f1a6e
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_HEADER_INCLUDED_
14 #define MITKVIRTUALTRACKINGDEVICE_H_HEADER_INCLUDED_
15 
16 #include <MitkIGTExports.h>
17 #include <mitkTrackingDevice.h>
19 #include <itkMultiThreader.h>
20 
21 #include "itkFastMutexLock.h"
22 #include <vector>
23 
24 namespace mitk
25 {
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  static ITK_THREAD_RETURN_TYPE ThreadStartTracking(void* data);
193 
195 
196  ControlPointType GetRandomPoint();
197  mitk::VirtualTrackingTool* GetInternalTool(unsigned int idx);
198 
199  typedef std::vector<VirtualTrackingTool::Pointer> ToolContainer;
200  ToolContainer m_AllTools;
201  itk::FastMutexLock::Pointer m_ToolsMutex;
202 
203  itk::MultiThreader::Pointer m_MultiThreader;
205 
206  unsigned int m_RefreshRate;
207  unsigned int m_NumberOfControlPoints;
208 
209  mitk::ScalarType m_Bounds[6];
213  };
214 }//mitk
215 #endif /* MITKVIRTUALTRACKINGDEVICE_H_HEADER_INCLUDED_ */
Interface for all Tracking Tools.
itk::FastMutexLock::Pointer m_ToolsMutex
mutex for coordinated access of tool container
unsigned int m_NumberOfControlPoints
number of control points for the random path generation
ToolContainer m_AllTools
container for all tracking tools
double ScalarType
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
DataCollection - Class to facilitate loading/accessing structured data.
const mitk::ScalarType * GetBounds() const
return the tracking volume bounds
itk::MultiThreader::Pointer m_MultiThreader
MultiThreader that starts continuous tracking update.
std::vector< VirtualTrackingTool::Pointer > ToolContainer
container type for tracking tools
#define MITKIGT_EXPORT
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:40
Interface for all Tracking Devices.
mitk::VirtualTrackingTool::SplineType::ControlPointType ControlPointType
unsigned int m_RefreshRate
refresh rate of the internal tracking thread in milliseconds (NOT refreshs per second!) ...
itk::Point< double, TDimension > ControlPointType
implements TrackingTool interface
Class representing a tracking device which generates random positions / orientations. No hardware is needed for tracking device.