NorMIT-nav  2023.01.05-dev+develop.0da12
An IGT application
cxSlicePlanes3DRep.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 #ifndef CXSLICEPLANES3DREP_H_
14 #define CXSLICEPLANES3DREP_H_
15 
16 #include "cxResourceVisualizationExport.h"
17 
18 #include <map>
19 #include "cxRepImpl.h"
20 #include "cxBoundingBox3D.h"
21 #include "cxTransform3D.h"
22 #include "cxDefinitions.h"
23 #include "cxForwardDeclarations.h"
24 #include "vtkForwardDeclarations.h"
25 #include "cxViewportListener.h"
26 #include <QColor>
27 
28 namespace cx
29 {
30 
42 class cxResourceVisualization_EXPORT SlicePlanesProxy : public QObject
43 {
44  Q_OBJECT
45 public:
47 
52  {
53  std::map<PLANE_TYPE, QColor> mColor;
54  std::map<PLANE_TYPE, QString> mSymbol;
58  PLANE_TYPE mClipPlane;
59  int mLineWidth;
60  };
61 
62  struct DataType
63  {
66  QString mSymbol;
67  QColor mColor;
69  };
70  typedef std::map<PLANE_TYPE, DataType> DataMap;
71 
72  void clearViewports();
73  void setViewportData(PLANE_TYPE type, SliceProxyPtr slice, const DoubleBoundingBox3D& vp_s);
74  void addSimpleSlicePlane(PLANE_TYPE type, PatientModelServicePtr dataManager);
75  DataMap getData();
76 
77  void setVisible(bool visible);
78  bool getVisible() const;
79  void setDrawPlanes(bool on);
80  bool getDrawPlanes() const;
81  PropertiesType& getProperties() { return mProperties; } // use this to set properties BEFORE attaching reps/calling setviewportdata()
82 
83  void connectTo3D(bool on);
84 
85 signals:
86  void changed();
87 private:
88  PropertiesType mProperties;
89  bool mVisible;
90  bool mDrawPlane;
91  DataMap mData;
92  bool mConnectedTo3D;
93 };
94 typedef boost::shared_ptr<class SlicePlanesProxy> SlicePlanesProxyPtr;
95 
96 
97 typedef boost::shared_ptr<class SlicePlanes3DRep> SlicePlanes3DRepPtr;
98 
111 class cxResourceVisualization_EXPORT SlicePlanes3DRep : public RepImpl
112 {
113  Q_OBJECT
114 public:
115  static SlicePlanes3DRepPtr New(const QString& uid="");
116  virtual ~SlicePlanes3DRep();
117  virtual QString getType() const { return "SlicePlanes3DRep"; }
118  void setProxy(SlicePlanesProxyPtr proxy);
119  SlicePlanesProxyPtr getProxy() { return mProxy; }
120  void setDynamicLabelSize(bool on);
121 
122 protected:
123  virtual void addRepActorsToViewRenderer(ViewPtr view);
124  virtual void removeRepActorsFromViewRenderer(ViewPtr view);
125 
126 private slots:
127  void changedSlot();
128 
129 private:
130  struct DataType
131  {
132  vtkTextActor3DPtr mText;
133  GraphicalPoint3DPtr mPoint;
134  Rect3DPtr mRect;
135  Axes3DPtr mAxes;
136  };
137  typedef std::map<PLANE_TYPE, DataType> DataMap;
138  DataMap mData;
139 
140  SlicePlanes3DRep();
141  void clearActors();
142  SlicePlanesProxyPtr mProxy;
143  ViewportListenerPtr mViewportListener;
144  void rescale();
145 };
146 
147 typedef boost::shared_ptr<class SlicePlanes3DMarkerIn2DRep> SlicePlanes3DMarkerIn2DRepPtr;
148 
161 class cxResourceVisualization_EXPORT SlicePlanes3DMarkerIn2DRep : public RepImpl
162 {
163  Q_OBJECT
164 public:
165  static SlicePlanes3DMarkerIn2DRepPtr New(const QString& uid="");
166  virtual ~SlicePlanes3DMarkerIn2DRep();
167  virtual QString getType() const { return "SlicePlanes3DMarkerIn2DRep"; }
168  void setProxy(PLANE_TYPE type, SlicePlanesProxyPtr proxy);
169  SlicePlanesProxyPtr getProxy() { return mProxy; }
170 
171 protected:
172  virtual void addRepActorsToViewRenderer(ViewPtr view);
173  virtual void removeRepActorsFromViewRenderer(ViewPtr view);
174 private slots:
175  void changedSlot();
176 private:
178  SlicePlanesProxyPtr mProxy;
179  TextDisplayPtr mText;
180  PLANE_TYPE mType;
181 };
182 
183 }
184 
185 #endif /*CXSLICEPLANES3DREP_H_*/
cx::SlicePlanesProxy
Helper class for managing a set of slice planes.
Definition: cxSlicePlanes3DRep.h:42
cx::SlicePlanesProxy::DataType::mSymbol
QString mSymbol
Definition: cxSlicePlanes3DRep.h:66
cx::GraphicalPoint3DPtr
boost::shared_ptr< class GraphicalPoint3D > GraphicalPoint3DPtr
Definition: cxForwardDeclarations.h:74
cx::SlicePlanesProxy::DataType::vp_s
DoubleBoundingBox3D vp_s
Definition: cxSlicePlanes3DRep.h:64
cx::SlicePlanes3DMarkerIn2DRepPtr
boost::shared_ptr< class SlicePlanes3DMarkerIn2DRep > SlicePlanes3DMarkerIn2DRepPtr
Definition: cxForwardDeclarations.h:93
cx::DoubleBoundingBox3D
Representation of a floating-point bounding box in 3D. The data are stored as {xmin,...
Definition: cxBoundingBox3D.h:63
cx::SlicePlanes3DRepPtr
boost::shared_ptr< class SlicePlanes3DRep > SlicePlanes3DRepPtr
Definition: cxForwardDeclarations.h:94
cxRepImpl.h
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cxForwardDeclarations.h
cx::SlicePlanesProxy::PropertiesType::m3DFontSize
int m3DFontSize
Definition: cxSlicePlanes3DRep.h:56
cxDefinitions.h
cx::Axes3DPtr
boost::shared_ptr< class Axes3D > Axes3DPtr
Definition: cxForwardDeclarations.h:62
cx::SlicePlanes3DRep::getProxy
SlicePlanesProxyPtr getProxy()
Definition: cxSlicePlanes3DRep.h:119
cx::SlicePlanes3DMarkerIn2DRep::getType
virtual QString getType() const
Definition: cxSlicePlanes3DRep.h:167
cxBoundingBox3D.h
cx::SliceProxyPtr
boost::shared_ptr< class SliceProxy > SliceProxyPtr
Definition: cxForwardDeclarations.h:96
vtkTextActor3DPtr
vtkSmartPointer< class vtkTextActor3D > vtkTextActor3DPtr
Definition: vtkForwardDeclarations.h:134
cx::ViewportListenerPtr
boost::shared_ptr< class ViewportListener > ViewportListenerPtr
Definition: cxForwardDeclarations.h:172
cx::SlicePlanesProxyPtr
boost::shared_ptr< class SlicePlanesProxy > SlicePlanesProxyPtr
Definition: cxForwardDeclarations.h:95
cx::SlicePlanesProxy::DataType::mPointPos_normvp
Vector3D mPointPos_normvp
Definition: cxSlicePlanes3DRep.h:68
cx::TextDisplayPtr
boost::shared_ptr< class TextDisplay > TextDisplayPtr
Definition: cxForwardDeclarations.h:102
cx::Rect3DPtr
boost::shared_ptr< class Rect3D > Rect3DPtr
Definition: cxForwardDeclarations.h:87
cx::SlicePlanesProxy::PropertiesType::mPointPos_normvp
Vector3D mPointPos_normvp
position of symbol in normalized space <0..1, 0..1>
Definition: cxSlicePlanes3DRep.h:57
cx::SlicePlanesProxy::DataType::mColor
QColor mColor
Definition: cxSlicePlanes3DRep.h:67
cx::SlicePlanesProxy::DataType::mSliceProxy
SliceProxyPtr mSliceProxy
Definition: cxSlicePlanes3DRep.h:65
cx::PatientModelServicePtr
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
Definition: cxLogicManager.h:25
cxViewportListener.h
vtkForwardDeclarations.h
cx::SlicePlanesProxy::PropertiesType
Definition: cxSlicePlanes3DRep.h:51
cx::SlicePlanes3DMarkerIn2DRep::getProxy
SlicePlanesProxyPtr getProxy()
Definition: cxSlicePlanes3DRep.h:169
cx::ViewPtr
boost::shared_ptr< class View > ViewPtr
Definition: cxForwardDeclarations.h:110
cx::RepImpl
Default implementation of Rep.
Definition: cxRepImpl.h:42
cx::SlicePlanesProxy::getProperties
PropertiesType & getProperties()
Definition: cxSlicePlanes3DRep.h:81
cx::SlicePlanesProxy::PropertiesType::mSymbol
std::map< PLANE_TYPE, QString > mSymbol
normalized RGB
Definition: cxSlicePlanes3DRep.h:54
cx::SlicePlanesProxy::PropertiesType::mColor
std::map< PLANE_TYPE, QColor > mColor
Definition: cxSlicePlanes3DRep.h:53
cx::SlicePlanesProxy::PropertiesType::mClipPlane
PLANE_TYPE mClipPlane
what plane to use for 3D clipping
Definition: cxSlicePlanes3DRep.h:58
cx::SlicePlanesProxy::PropertiesType::m2DFontSize
int m2DFontSize
Definition: cxSlicePlanes3DRep.h:55
cx::SlicePlanesProxy::PropertiesType::mLineWidth
int mLineWidth
draw wireframe lines. 0 means no line
Definition: cxSlicePlanes3DRep.h:59
cx::SlicePlanes3DRep
Display a set of planes in 3D.
Definition: cxSlicePlanes3DRep.h:111
cxTransform3D.h
cx::SlicePlanesProxy::DataMap
std::map< PLANE_TYPE, DataType > DataMap
Definition: cxSlicePlanes3DRep.h:70
cx::Vector3D
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Definition: cxVector3D.h:42
cx::SlicePlanes3DMarkerIn2DRep
Display annotations for the SlicePlanesProxy planes in 2D.
Definition: cxSlicePlanes3DRep.h:161
cx::SlicePlanes3DRep::getType
virtual QString getType() const
Definition: cxSlicePlanes3DRep.h:117
cx::SlicePlanesProxy::DataType
Definition: cxSlicePlanes3DRep.h:62