CustusX  15.8
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cxToolTracer.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 CXTOOLTRACER_H_
35 #define CXTOOLTRACER_H_
36 
37 #include "cxResourceVisualizationExport.h"
38 
39 #include <QObject>
40 #include <QSize>
41 #include "vtkSmartPointer.h"
42 typedef vtkSmartPointer<class vtkImageData> vtkImageDataPtr;
43 typedef vtkSmartPointer<class vtkPolyData> vtkPolyDataPtr;
44 #include "cxTransform3D.h"
45 
46 #include <boost/shared_ptr.hpp>
47 //#include "cxProbeData.h"
48 #include "vtkForwardDeclarations.h"
49 #include "cxForwardDeclarations.h"
50 #include "cxTool.h"
51 
52 class QColor;
53 
54 namespace cx
55 {
56 
57 typedef boost::shared_ptr<class ToolTracer> ToolTracerPtr;
58 typedef boost::shared_ptr<class SpaceProvider> SpaceProviderPtr;
59 
68 class cxResourceVisualization_EXPORT ToolTracer : QObject
69 {
70  Q_OBJECT
71 public:
73  void setTool(ToolPtr tool);
74  vtkPolyDataPtr getPolyData();
75  vtkActorPtr getActor();
76 
77  void setColor(QColor color);
78 
79  void start(); // start path tracking
80  void stop(); // stop tracking
81  void clear(); // erase stored tracking data.
82  bool isRunning() const; // true if started and not stopped.
83  void setMinDistance(double distance) { mMinDistance = distance; }
84  int getSkippedPoints() { return mSkippedPoints; }
85  void addManyPositions(TimedTransformMap trackerRecordedData_prMt);
86 
87 private slots:
88  void receiveTransforms(Transform3D prMt, double timestamp);
89 private:
90  ToolTracer();
91  void connectTool();
92  void disconnectTool();
93 
94  bool mRunning;
95  vtkPolyDataPtr mPolyData;
96  vtkActorPtr mActor;
97  ToolPtr mTool;
98  vtkPolyDataMapperPtr mPolyDataMapper;
99  vtkPropertyPtr mProperty;
100 
101  vtkPointsPtr mPoints;
102  vtkCellArrayPtr mLines;
103 
104  bool mFirstPoint;
105  int mSkippedPoints;
106  Vector3D mPreviousPoint;
107  double mMinDistance;
108 
109  SpaceProviderPtr mSpaceProvider;
110 };
111 
112 } // namespace cx
113 
114 #endif /*CXTOOLTRACER_H_*/
boost::shared_ptr< class SpaceProvider > SpaceProviderPtr
vtkSmartPointer< class vtkImageData > vtkImageDataPtr
Definition: cxToolTracer.h:42
vtkSmartPointer< class vtkActor > vtkActorPtr
vtkSmartPointer< class vtkPolyDataMapper > vtkPolyDataMapperPtr
vtkSmartPointer< class vtkProperty > vtkPropertyPtr
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
vtkSmartPointer< class vtkCellArray > vtkCellArrayPtr
vtkSmartPointer< class vtkPolyData > vtkPolyDataPtr
Definition: cxToolTracer.h:43
boost::shared_ptr< class ToolTracer > ToolTracerPtr
void setMinDistance(double distance)
Definition: cxToolTracer.h:83
vtkSmartPointer< class vtkPolyData > vtkPolyDataPtr
Definition: cxProbeSector.h:47
3D Graphics class for displaying the trace path traversed by a tool.
Definition: cxToolTracer.h:68
cxLogicManager_EXPORT SpaceProviderPtr spaceProvider()
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Definition: cxVector3D.h:63
int getSkippedPoints()
Definition: cxToolTracer.h:84
std::map< double, Transform3D > TimedTransformMap
vtkSmartPointer< class vtkPoints > vtkPointsPtr
boost::shared_ptr< class Tool > ToolPtr