Fraxinus  2023.01.05-dev+develop.0da12
An IGT application
cxOpenIGTLinkTool.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 CXOPENIGTLINKTOOL_H
13 #define CXOPENIGTLINKTOOL_H
14 
15 #include "org_custusx_core_openigtlink3_Export.h"
16 
17 #include "cxToolImpl.h"
18 
19 #include <QTimer>
20 #include <boost/shared_ptr.hpp>
21 
22 #include "igtlioBaseConverter.h"
23 
24 #include "cxTransform3D.h"
26 
27 class QStringList;
28 
29 namespace cx
30 {
31 typedef std::vector<double> DoubleVector;
32 typedef boost::shared_ptr<DoubleVector> DoubleVectorPtr;
33 typedef std::vector<Transform3DPtr> Transform3DVector;
34 typedef boost::shared_ptr<Transform3DVector> Transform3DVectorPtr;
35 typedef boost::shared_ptr<class IgstkTool> IgstkToolPtr;
36 typedef boost::shared_ptr<class ProbeImpl> ProbeImplPtr;
37 
52 class org_custusx_core_openigtlink3_EXPORT OpenIGTLinkTool: public ToolImpl
53 {
55  Q_OBJECT
56 
57 public:
59  virtual ~OpenIGTLinkTool();
60 
61  virtual bool getVisible() const;
62  virtual bool isInitialized() const;
63  virtual QString getUid() const;
64  virtual QString getName() const;
65  virtual ProbePtr getProbe() const;
66  virtual double getTimestamp() const;
67  virtual double getTooltipOffset() const;
68  virtual void setTooltipOffset(double val);
69 
70  virtual bool isCalibrated() const;
71  virtual Transform3D getCalibration_sMt() const;
72  virtual void setCalibration_sMt(Transform3D sMt);
73 
74  //virtual void set_prMt(const Transform3D& prMt, double timestamp);
75  virtual void setVisible(bool vis);
76 
77  bool doIdCorrespondToTool(QString openIGTLinkId);
78  bool isReference();
79  bool applyReference();
80 protected:
81  virtual ToolFileParser::ToolInternalStructurePtr getToolFileToolStructure() const;
82 private slots:
83  void toolTransformAndTimestampSlot(Transform3D prMs, double timestampMS);
84  void calculateTpsSlot();
85  void toolVisibleSlot(bool);
86 
87 private:
88  ProbePtr mProbe;
89  QTimer mTpsTimer;
90  double mTimestamp;
91  bool mVisible;
92  qint64 mLastReceivedPositionTime;
93  bool mPrintedWarningAboutTimeStampMismatch;
94 
95  //Store these structures directly for now
96  ConfigurationFileParser::ToolStructure mConfigFileToolStructure;
97  ToolFileParser::ToolInternalStructurePtr mToolFileToolStructure;
98 
99  void calculateVisible();
100  void checkTimestampMismatch();
101  void printWarningAboutTimestampMismatch(double diff);
102 };
103 typedef boost::shared_ptr<OpenIGTLinkTool> OpenIGTLinkToolPtr;
104 
108 } //namespace cx
109 #endif /* CXOPENIGTLINKTOOL_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
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
Namespace for all CustusX production code.