Fraxinus  17.12-rc3
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) 2008-2014, SINTEF Department of Medical Technology
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9 
10 1. Redistributions of source code must retain the above copyright notice,
11  this list of conditions and the following disclaimer.
12 
13 2. Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16 
17 3. Neither the name of the copyright holder nor the names of its contributors
18  may be used to endorse or promote products derived from this software
19  without specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 =========================================================================*/
32 
33 #ifndef CXOPENIGTLINKTOOL_H
34 #define CXOPENIGTLINKTOOL_H
35 
36 #include "org_custusx_core_openigtlink_Export.h"
37 
38 #include "cxToolImpl.h"
39 
40 #include <QTimer>
41 #include <boost/shared_ptr.hpp>
42 #include "cxTransform3D.h"
43 
44 class QStringList;
45 
46 namespace cx
47 {
48 typedef std::vector<double> DoubleVector;
49 typedef boost::shared_ptr<DoubleVector> DoubleVectorPtr;
50 typedef std::vector<Transform3DPtr> Transform3DVector;
51 typedef boost::shared_ptr<Transform3DVector> Transform3DVectorPtr;
52 typedef boost::shared_ptr<class IgstkTool> IgstkToolPtr;
53 typedef boost::shared_ptr<class ProbeImpl> ProbeImplPtr;
54 
69 class org_custusx_core_openigtlink_EXPORT OpenIGTLinkTool: public ToolImpl
70 {
72  Q_OBJECT
73 
74 public:
75  OpenIGTLinkTool(QString uid);
76  virtual ~OpenIGTLinkTool();
77 
78  virtual std::set<Type> getTypes() const;
79 
80  virtual vtkPolyDataPtr getGraphicsPolyData() const;
81  virtual bool getVisible() const;
82  virtual bool isInitialized() const;
83  virtual QString getUid() const;
84  virtual QString getName() const;
85  virtual ProbePtr getProbe() const;
86  virtual double getTimestamp() const;
87  virtual double getTooltipOffset() const;
88  virtual void setTooltipOffset(double val);
89 
90  virtual bool isCalibrated() const;
91  virtual Transform3D getCalibration_sMt() const;
92  virtual void setCalibration_sMt(Transform3D sMt);
93 
94  //virtual void set_prMt(const Transform3D& prMt, double timestamp);
95  virtual void setVisible(bool vis);
96 
97 private slots:
98  void toolTransformAndTimestampSlot(Transform3D prMs, double timestamp);
99  void calculateTpsSlot();
100  void toolVisibleSlot(bool);
101 
102 private:
103  std::set<Type> determineTypesBasedOnUid(const QString uid) const;
104  bool isProbe() const;
105  void createPolyData();
106 
107  vtkPolyDataPtr mPolyData;
108  ProbePtr mProbe;
109  QTimer mTpsTimer;
110  double mTimestamp;
111  std::set<Type> mTypes;
112  Transform3D m_sMt_calibration;
113 };
114 typedef boost::shared_ptr<OpenIGTLinkTool> OpenIGTLinkToolPtr;
115 
119 } //namespace cx
120 #endif /* CXOPENIGTLINKTOOL_H */
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:50
boost::shared_ptr< DoubleVector > DoubleVectorPtr
std::vector< Transform3DPtr > Transform3DVector
boost::shared_ptr< Transform3DVector > Transform3DVectorPtr
boost::shared_ptr< Probe > ProbePtr
Definition: cxProbe.h:93
vtkSmartPointer< vtkPolyData > vtkPolyDataPtr
boost::shared_ptr< class ProbeImpl > ProbeImplPtr
Namespace for all CustusX production code.