Fraxinus  18.10
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 protected:
80  virtual ToolFileParser::ToolInternalStructurePtr getToolFileToolStructure() const;
81 private slots:
82  void toolTransformAndTimestampSlot(Transform3D prMs, double timestamp);
83  void calculateTpsSlot();
84  void toolVisibleSlot(bool);
85 
86 private:
87  ProbePtr mProbe;
88  QTimer mTpsTimer;
89  double mTimestamp;
90  bool mVisible;
91  qint64 mLastReceivedPositionTime;
92  bool mPrintedWarningAboutTimeStampMismatch;
93 
94  //Store these structures directly for now
95  ConfigurationFileParser::ToolStructure mConfigFileToolStructure;
96  ToolFileParser::ToolInternalStructurePtr mToolFileToolStructure;
97 
98  void calculateVisible();
99  void checkTimestampMismatch();
100  void printWarningAboutTimestampMismatch(double diff);
101 };
102 typedef boost::shared_ptr<OpenIGTLinkTool> OpenIGTLinkToolPtr;
103 
107 } //namespace cx
108 #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.