NorMIT-nav  22.09
An IGT application
cxToolRep2D.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 
13 
14 #ifndef CXTOOLREP2D_H_
15 #define CXTOOLREP2D_H_
16 
17 #include "cxResourceVisualizationExport.h"
18 
19 #include "vtkForwardDeclarations.h"
20 #include "cxForwardDeclarations.h"
21 #include "cxVtkHelperClasses.h"
22 #include "cxRepImpl.h"
23 #include "cxTransform3D.h"
24 #include "cxBoundingBox3D.h"
25 
26 namespace cx
27 {
28 typedef boost::shared_ptr<class SpaceProvider> SpaceProviderPtr;
29 
30 
46 class cxResourceVisualization_EXPORT ToolRep2D : public RepImpl
47 {
48  Q_OBJECT
49  public:
50  static ToolRep2DPtr New(SpaceProviderPtr spaceProvider, const QString& uid="");
51  ~ToolRep2D();
52  virtual QString getType() const;
53 
54  void setSliceProxy(SliceProxyPtr slicer);
55  void setViewportData(const Transform3D& vpMs, const DoubleBoundingBox3D& vp);
56 
57  void setUseCrosshair(bool on);
58  void setCrosshairColor(const QColor& color);
59  void setTooltipLineColor(const QColor& color);
60  void setTooltipPointColor(const QColor& color);
61  void setToolOffsetPointColor(const QColor& color);
62  void setToolOffsetLineColor(const QColor& color);
63 
64  private slots:
65  void sliceTransformChangedSlot(Transform3D sMr);
66  void toolTransformAndTimestampSlot(Transform3D prMt, double timestamp);
67  void toolVisibleSlot(bool visible);
68  void update();
69 
70  protected:
71  bool showProbe();
72  bool showOffset();
73 
74  virtual void addRepActorsToViewRenderer(ViewPtr view);
75  virtual void removeRepActorsFromViewRenderer(ViewPtr view);
76  virtual void onModifiedStartRender();
77 
78  private:
79  ToolRep2D(SpaceProviderPtr spaceProvider);
80 
81  double getOffset();
82  void createCrossHair(vtkRendererPtr renderer);
83  void setVisibility();
84  void createToolLine(vtkRendererPtr renderer, const Vector3D& centerPos );
85  void createOffsetText(vtkRendererPtr renderer, const Vector3D& pos );
86 
87  void updateToolLine(const Vector3D& crossPos, const Vector3D& toolTipPos, const Vector3D toolTipBackPos);
88  void updateOffsetText();
89  void crossHairResized();
90 
91  SpaceProviderPtr mSpaceProvider;
92  SliceProxyPtr mSlicer;
93  Transform3D m_vpMs;
94  DoubleBoundingBox3D mBB_vp;
95 
96  bool mUseOffset;
97  bool mUseCrosshair;
98  bool mUseToolLine;
99  bool mUseOffsetText;
100  bool mMergeOffsetAndToolLine;
101 
102  RGBColor mTooltipPointColor;
103  RGBColor mOffsetPointColor;
104  RGBColor mTooltipLineColor;
105  RGBColor mOffsetLineColor;
106  int mStipplePattern;
107 
108  CrossHair2DPtr cursor;
109  LineSegmentPtr center2Tool;
110  LineSegmentPtr tool2Back;
111  OffsetPointPtr centerPoint;
112  OffsetPointPtr toolPoint;
113  TextDisplayPtr distanceText;
114 
115  //US Probe sector
116  ProbeSectorPtr mProbeSector;
117  vtkPolyDataMapperPtr mProbeSectorPolyDataMapper;
118  vtkActorPtr mProbeSectorActor;
119 };
120 
121 
122 } // namespace vm
123 
124 #endif
cx::DoubleBoundingBox3D
Representation of a floating-point bounding box in 3D. The data are stored as {xmin,...
Definition: cxBoundingBox3D.h:63
cx::LineSegmentPtr
boost::shared_ptr< class LineSegment > LineSegmentPtr
Definition: cxForwardDeclarations.h:79
cxRepImpl.h
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cxForwardDeclarations.h
cx::OffsetPointPtr
boost::shared_ptr< class OffsetPoint > OffsetPointPtr
Definition: cxForwardDeclarations.h:80
vtkPolyDataMapperPtr
vtkSmartPointer< class vtkPolyDataMapper > vtkPolyDataMapperPtr
Definition: vtkForwardDeclarations.h:112
cxBoundingBox3D.h
cx::SliceProxyPtr
boost::shared_ptr< class SliceProxy > SliceProxyPtr
Definition: cxForwardDeclarations.h:96
cx::ProbeSectorPtr
boost::shared_ptr< class ProbeSector > ProbeSectorPtr
Definition: cxForwardDeclarations.h:57
cx::TextDisplayPtr
boost::shared_ptr< class TextDisplay > TextDisplayPtr
Definition: cxForwardDeclarations.h:102
cx::Transform3D
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
Definition: cxLandmarkPatientRegistrationWidget.h:33
vtkForwardDeclarations.h
cx::ToolRep2DPtr
boost::shared_ptr< class ToolRep2D > ToolRep2DPtr
Definition: cxForwardDeclarations.h:104
cx::ToolRep2D
Display a Tool in 2D.
Definition: cxToolRep2D.h:46
cx::ViewPtr
boost::shared_ptr< class View > ViewPtr
Definition: cxForwardDeclarations.h:110
cx::RepImpl
Default implementation of Rep.
Definition: cxRepImpl.h:42
vtkActorPtr
vtkSmartPointer< class vtkActor > vtkActorPtr
Definition: vtkForwardDeclarations.h:31
cxVtkHelperClasses.h
cx::RGBColor
RGB color data.
Definition: cxVtkHelperClasses.h:48
cxTransform3D.h
cx::CrossHair2DPtr
boost::shared_ptr< class CrossHair2D > CrossHair2DPtr
Definition: cxForwardDeclarations.h:64
cx::Vector3D
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Definition: cxVector3D.h:42
vtkRendererPtr
vtkSmartPointer< class vtkRenderer > vtkRendererPtr
Definition: vtkForwardDeclarations.h:122
cx::SpaceProviderPtr
boost::shared_ptr< class SpaceProvider > SpaceProviderPtr
Definition: cxLogicManager.h:23