Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef MITKVIRTUALTRACKINGDEVICE_H_HEADER_INCLUDED_
18 #define MITKVIRTUALTRACKINGDEVICE_H_HEADER_INCLUDED_
19 
20 #include <MitkIGTExports.h>
21 #include <mitkTrackingDevice.h>
23 #include <itkMultiThreader.h>
24 
25 #include "itkFastMutexLock.h"
26 #include <vector>
27 
28 namespace mitk
29 {
39  class MITKIGT_EXPORT VirtualTrackingDevice : public TrackingDevice
40  {
41  public:
42 
44  itkFactorylessNewMacro(Self)
45  itkCloneMacro(Self)
46 
47 
48 
54  itkSetMacro(RefreshRate, unsigned int)
55 
56 
60  itkGetConstMacro(RefreshRate, unsigned int)
61 
62 
71  virtual bool StartTracking() override;
72 
77  virtual bool StopTracking() override;
78 
83  virtual bool OpenConnection() override;
84 
88  virtual bool CloseConnection() override;
89 
93  virtual unsigned int GetToolCount() const override;
94 
100  TrackingTool* GetTool(unsigned int toolNumber) const override;
101 
111  TrackingTool* AddTool(const char* toolName);
112 
113 
123  itkSetVectorMacro(Bounds, mitk::ScalarType, 6);
124 
132  {
133  return m_Bounds;
134  };
135 
144  mitk::ScalarType GetSplineChordLength(unsigned int idx);
145 
157  void SetToolSpeed(unsigned int idx, mitk::ScalarType roundsPerSecond);
158 
162  void EnableGaussianNoise();
163 
167  void DisableGaussianNoise();
168 
173  void SetParamsForGaussianNoise(double meanDistribution, double deviationDistribution);
174 
178  double GetMeanDistribution();
179 
183  double GetDeviationDistribution();
184 
185  protected:
193  void TrackTools();
194 
195  void InitializeSpline(mitk::VirtualTrackingTool* t);
196 
197  static ITK_THREAD_RETURN_TYPE ThreadStartTracking(void* data);
198 
200 
201  ControlPointType GetRandomPoint();
202  mitk::VirtualTrackingTool* GetInternalTool(unsigned int idx);
203 
204  typedef std::vector<VirtualTrackingTool::Pointer> ToolContainer;
205  ToolContainer m_AllTools;
207 
210 
211  unsigned int m_RefreshRate;
212  unsigned int m_NumberOfControlPoints;
213 
214  mitk::ScalarType m_Bounds[6];
218  };
219 }//mitk
220 #endif /* MITKVIRTUALTRACKINGDEVICE_H_HEADER_INCLUDED_ */
Interface for all Tracking Tools.
itk::FastMutexLock::Pointer m_ToolsMutex
mutex for coordinated access of tool container
itk::SmartPointer< Self > Pointer
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.
itk::MultiThreader::Pointer m_MultiThreader
MultiThreader that starts continuous tracking update.
std::vector< VirtualTrackingTool::Pointer > ToolContainer
container type for tracking tools
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:44
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.
const mitk::ScalarType * GetBounds() const
return the tracking volume bounds