CustusX  15.8
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cxTool.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 
34 #ifndef CXTOOL_H_
35 #define CXTOOL_H_
36 
37 #include "cxResourceExport.h"
38 
39 #include <string>
40 #include <map>
41 #include <set>
42 #include <boost/shared_ptr.hpp>
43 #include <QObject>
44 #include "vtkForwardDeclarations.h"
45 #include "cxTransform3D.h"
46 #include "cxIndent.h"
48 #include "cxProbe.h"
49 #include "cxForwardDeclarations.h"
50 
51 namespace cx
52 {
53 typedef std::map<double, Transform3D> TimedTransformMap;
54 typedef boost::shared_ptr<TimedTransformMap> TimedTransformMapPtr;
55 typedef boost::shared_ptr<class TrackingPositionFilter> TrackingPositionFilterPtr;
56 
69 class cxResource_EXPORT Tool: public QObject
70 {
71  Q_OBJECT
72 public:
73  Tool(const QString& uid="", const QString& name = "");
74  virtual ~Tool() {}
75 
78  enum State
79  {
80  tsNONE=0,
84  };
87  enum Type
88  {
94  TOOL_MICROSCOPE
95  };
96  virtual std::set<Type> getTypes() const = 0;
100  virtual bool hasType(Type type) const
101  {
102  return this->getTypes().count(type);
103  }
104  virtual vtkPolyDataPtr getGraphicsPolyData() const = 0;
105  virtual TimedTransformMapPtr getPositionHistory() = 0;
106 
107  virtual bool getVisible() const = 0;
108  virtual bool isInitialized() const { return true; }
109 
110  virtual QString getUid() const = 0;
111  virtual QString getName() const = 0;
112 
113  virtual bool isCalibrated() const = 0;
114  virtual Transform3D getCalibration_sMt() const = 0;
115  virtual void setCalibration_sMt(Transform3D calibration) { Q_UNUSED(calibration); }
116 
117  virtual ProbePtr getProbe() const { return ProbePtr(); }
118  virtual double getTimestamp() const = 0;
119  virtual void printSelf(std::ostream &os, Indent indent) { Q_UNUSED(os); Q_UNUSED(indent); }
120 
121  virtual double getTooltipOffset() const { return 0; }
122  virtual void setTooltipOffset(double val) { Q_UNUSED(val); }
123  virtual std::map<int, Vector3D> getReferencePoints() const { return std::map<int, Vector3D>(); }
124  virtual bool hasReferencePointWithId(int id) { Q_UNUSED(id); return false; }
125 
126  virtual TimedTransformMap getSessionHistory(double startTime, double stopTime) = 0;
127  virtual Transform3D get_prMt() const = 0;
128 
129  virtual void resetTrackingPositionFilter(TrackingPositionFilterPtr filter) = 0;
130 
131  virtual void set_prMt(const Transform3D& prMt, double timestamp=-1) = 0;
132  virtual void setVisible(bool vis) = 0;
133 
134  virtual bool isNull() = 0;
135  static ToolPtr getNullObject();
136 
137 #ifdef WIN32
138  typedef Transform3D Transform3D;
139 #endif
140 
141 signals:
142  void toolTransformAndTimestamp(Transform3D matrix, double timestamp);
143  void toolVisible(bool visible);
144  void tooltipOffset(double offset);
145  void toolProbeSector();
146  void tps(int);
147 
148 protected:
149  QString mUid;
150  QString mName;
151 };
152 typedef boost::shared_ptr<Tool> ToolPtr;
153 } // namespace cx
154 
155 #endif /*CXTOOL_H_*/
tsNONE
Not specified.
Interface to a tool, i.e. a pointer, US probe or similar.
Definition: cxTool.h:69
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
vtkSmartPointer< class vtkPolyData > vtkPolyDataPtr
Definition: cxProbeSector.h:47
configured with basic info
Definition: cxTool.h:81
virtual void setCalibration_sMt(Transform3D calibration)
requests to use the calibration and replaces the tools calibration file
Definition: cxTool.h:115
Reference tool.
Definition: cxTool.h:90
virtual ~Tool()
Definition: cxTool.h:74
QString mUid
Definition: cxTool.h:149
boost::shared_ptr< Probe > ProbePtr
Definition: cxProbe.h:93
virtual double getTooltipOffset() const
get a virtual offset extending from the tool tip.
Definition: cxTool.h:121
QString mName
Definition: cxTool.h:150
boost::shared_ptr< TimedTransformMap > TimedTransformMapPtr
Definition: cxTool.h:54
Formatting class for debug printing of the ssc library.
Definition: cxIndent.h:49
virtual bool hasType(Type type) const
Definition: cxTool.h:100
virtual void setTooltipOffset(double val)
set a virtual offset extending from the tool tip.
Definition: cxTool.h:122
Representation of a mouse/keyboard-controlled virtual tool.
Definition: cxTool.h:91
connected to hardware, if any, ready to use
Definition: cxTool.h:82
virtual std::map< int, Vector3D > getReferencePoints() const
Get the optional reference points from this tool.
Definition: cxTool.h:123
virtual ProbePtr getProbe() const
additional information if the tool represents an US Probe. Extends getProbeSector() ...
Definition: cxTool.h:117
virtual bool isInitialized() const
Definition: cxTool.h:108
virtual void printSelf(std::ostream &os, Indent indent)
dump internal debug data
Definition: cxTool.h:119
emitting tracking data
Definition: cxTool.h:83
boost::shared_ptr< class TrackingPositionFilter > TrackingPositionFilterPtr
Definition: cxTool.h:55
virtual bool hasReferencePointWithId(int id)
Definition: cxTool.h:124
Ultrasond probe. The tool has a Probe subinterface with a sector and a video stream.
Definition: cxTool.h:93
Navigation pointer. Pointing functionality such as tool offset.
Definition: cxTool.h:92
std::map< double, Transform3D > TimedTransformMap
boost::shared_ptr< class Tool > ToolPtr