CustusX  18.04-rc5
An IGT application
cxToolUsingIGSTK.h
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
12 #ifndef CXTOOLUSINGIGSTK_H_
13 #define CXTOOLUSINGIGSTK_H_
14 
15 #include "org_custusx_core_tracking_system_igstk_Export.h"
16 
17 #include "cxToolImpl.h"
18 
19 #include <limits.h>
20 #include <QTimer>
21 #include <boost/shared_ptr.hpp>
22 #include "cxTransform3D.h"
23 #include "cxDefinitions.h"
24 #include "vtkForwardDeclarations.h"
25 
26 class QStringList;
27 
28 namespace itk
29 {
30 class EventObject;
31 }
32 
33 namespace cx
34 {
35 typedef std::vector<double> DoubleVector;
36 typedef boost::shared_ptr<DoubleVector> DoubleVectorPtr;
37 typedef std::vector<Transform3DPtr> Transform3DVector;
38 typedef boost::shared_ptr<Transform3DVector> Transform3DVectorPtr;
39 typedef boost::shared_ptr<class IgstkTool> IgstkToolPtr;
40 
47 typedef boost::shared_ptr<class ProbeImpl> ProbeImplPtr;
48 
56 class org_custusx_core_tracking_system_igstk_EXPORT ToolUsingIGSTK : public ToolImpl
57 {
58  Q_OBJECT
59 
60 public:
61 
62  /* //only used for documentation purposes
63  TOOL_INVALID_REQUEST, ///< internal state machine didn't accept the request
64  TOOL_HW_CONFIGURED, ///< hardware accepted tool as configured
65  TOOL_ATTACHED_TO_TRACKER, ///< tool accepted by hardware as attached
66  TOOL_VISIBLE, ///< tool visible to hardware
67  TOOL_TRACKED, ///< tool tracked by hardware
68  TOOL_COORDINATESYSTEM_TRANSFORM, ///< transform received
69  TOOL_NDI_PORT_NUMBER, ///< hardware responds to NDI port number
70  TOOL_NDI_SROM_FILENAME, ///< hardware responds to NDI SROM filename
71  TOOL_NDI_PART_NUMBER, ///< hardware responds to NDI part number
72  TOOL_AURORA_CHANNEL_NUMBER ///< hardware responds to Aurora channel number
73  */
74 
75  ToolUsingIGSTK(IgstkToolPtr igstkTool);
76  virtual ~ToolUsingIGSTK();
77 
78  virtual bool getVisible() const;
79  virtual bool isInitialized() const;
80  virtual QString getUid() const;
81  virtual QString getName() const;
82  virtual int getIndex() const { return 0; }
83  virtual ProbePtr getProbe() const;
84  virtual double getTimestamp() const { return mTimestamp; } // TODO
85  virtual double getTooltipOffset() const;
86  virtual void setTooltipOffset(double val);
87 
88  virtual bool isCalibrated() const;
89  virtual Transform3D getCalibration_sMt() const;
90  virtual void setCalibration_sMt(Transform3D calibration);
91  QString getCalibrationFileName() const;
92 
93  TRACKING_SYSTEM getTrackerType();
94 
95  bool isValid() const;
96 
97  virtual void set_prMt(const Transform3D& prMt, double timestamp);
98  virtual void setVisible(bool vis);
99 
100  virtual void addXml(QDomNode& dataNode);
101  virtual void parseXml(QDomNode& dataNode);
102 
103 signals:
104  void attachedToTracker(bool);
105 
106 protected:
107  virtual ToolFileParser::ToolInternalStructurePtr getToolFileToolStructure() const;
108 private slots:
109  void toolTransformAndTimestampSlot(Transform3D matrix, double timestamp, ToolPositionMetadata metadata);
110  void calculateTpsSlot();
111  void toolVisibleSlot(bool);
112 
113 private:
114  void printInternalStructure();
115 
116  IgstkToolPtr mTool;
117 
118  bool mValid;
119  bool mConfigured;
120  bool mTracked;
121  ProbePtr mProbe;
122  QTimer mTpsTimer;
123  double mTimestamp;
124 };
125 typedef boost::shared_ptr<ToolUsingIGSTK> ToolUsingIGSTKPtr;
126 
130 } //namespace cx
131 #endif /* CXTOOLUSINGIGSTK_H_ */
boost::shared_ptr< ToolInternalStructure > ToolInternalStructurePtr
std::vector< double > DoubleVector
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
boost::shared_ptr< class IgstkTool > IgstkToolPtr
Common functionality for Tool subclasses.
Definition: cxToolImpl.h:30
Class representing the tools a navigation system can recognize.
boost::shared_ptr< DoubleVector > DoubleVectorPtr
std::vector< Transform3DPtr > Transform3DVector
boost::shared_ptr< Transform3DVector > Transform3DVectorPtr
boost::shared_ptr< Probe > ProbePtr
Definition: cxProbe.h:72
boost::shared_ptr< class ProbeImpl > ProbeImplPtr
virtual double getTimestamp() const
latest valid timestamp for the position matrix. 0 means indeterminate (for f.ex. manual tools) ...
boost::shared_ptr< ToolUsingIGSTK > ToolUsingIGSTKPtr
virtual int getIndex() const
Namespace for all CustusX production code.