CustusX  22.04-rc5
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 
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_*/
boost::shared_ptr< class GraphicalPoint3D > GraphicalPoint3DPtr
boost::shared_ptr< class SlicePlanesProxy > SlicePlanesProxyPtr
boost::shared_ptr< class Axes3D > Axes3DPtr
boost::shared_ptr< class ViewportListener > ViewportListenerPtr
PLANE_TYPE mClipPlane
what plane to use for 3D clipping
boost::shared_ptr< class SliceProxy > SliceProxyPtr
std::map< PLANE_TYPE, DataType > DataMap
Vector3D mPointPos_normvp
position of symbol in normalized space <0..1, 0..1>
int mLineWidth
draw wireframe lines. 0 means no line
Display a set of planes in 3D.
boost::shared_ptr< class View > ViewPtr
SlicePlanesProxyPtr getProxy()
Display annotations for the SlicePlanesProxy planes in 2D.
vtkSmartPointer< class vtkTextActor3D > vtkTextActor3DPtr
std::map< PLANE_TYPE, QString > mSymbol
normalized RGB
std::map< PLANE_TYPE, QColor > mColor
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
boost::shared_ptr< class TextDisplay > TextDisplayPtr
Default implementation of Rep.
Definition: cxRepImpl.h:42
Representation of a floating-point bounding box in 3D. The data are stored as {xmin,xmax,ymin,ymax,zmin,zmax}, in order to simplify communication with vtk.
Helper class for managing a set of slice planes.
boost::shared_ptr< class SlicePlanes3DRep > SlicePlanes3DRepPtr
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Definition: cxVector3D.h:42
virtual QString getType() const
PropertiesType & getProperties()
virtual QString getType() const
boost::shared_ptr< class Rect3D > Rect3DPtr
boost::shared_ptr< class SlicePlanes3DMarkerIn2DRep > SlicePlanes3DMarkerIn2DRepPtr
Namespace for all CustusX production code.