Fraxinus  16.5.0-fx-rc9
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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) 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 CXSLICEPLANES3DREP_H_
35 #define CXSLICEPLANES3DREP_H_
36 
37 #include "cxResourceVisualizationExport.h"
38 
39 #include <map>
40 #include "cxRepImpl.h"
41 #include "cxBoundingBox3D.h"
42 #include "cxTransform3D.h"
43 #include "cxDefinitions.h"
44 #include "cxForwardDeclarations.h"
45 #include "vtkForwardDeclarations.h"
46 #include "cxViewportListener.h"
47 #include <QColor>
48 
49 namespace cx
50 {
51 
63 class cxResourceVisualization_EXPORT SlicePlanesProxy : public QObject
64 {
65  Q_OBJECT
66 public:
68 
73  {
74  std::map<PLANE_TYPE, QColor> mColor;
75  std::map<PLANE_TYPE, QString> mSymbol;
79  PLANE_TYPE mClipPlane;
80  int mLineWidth;
81  };
82 
83  struct DataType
84  {
87  QString mSymbol;
88  QColor mColor;
90  };
91  typedef std::map<PLANE_TYPE, DataType> DataMap;
92 
93  void clearViewports();
94  void setViewportData(PLANE_TYPE type, SliceProxyPtr slice, const DoubleBoundingBox3D& vp_s);
95  void addSimpleSlicePlane(PLANE_TYPE type, PatientModelServicePtr dataManager);
96  DataMap getData();
97 
98  void setVisible(bool visible);
99  bool getVisible() const;
100  void setDrawPlanes(bool on);
101  bool getDrawPlanes() const;
102  PropertiesType& getProperties() { return mProperties; } // use this to set properties BEFORE attaching reps/calling setviewportdata()
103 
104  void connectTo3D(bool on);
105 
106 signals:
107  void changed();
108 private:
109  PropertiesType mProperties;
110  bool mVisible;
111  bool mDrawPlane;
112  DataMap mData;
113  bool mConnectedTo3D;
114 };
115 typedef boost::shared_ptr<class SlicePlanesProxy> SlicePlanesProxyPtr;
116 
117 
118 typedef boost::shared_ptr<class SlicePlanes3DRep> SlicePlanes3DRepPtr;
119 
132 class cxResourceVisualization_EXPORT SlicePlanes3DRep : public RepImpl
133 {
134  Q_OBJECT
135 public:
136  static SlicePlanes3DRepPtr New(const QString& uid="");
137  virtual ~SlicePlanes3DRep();
138  virtual QString getType() const { return "SlicePlanes3DRep"; }
139  void setProxy(SlicePlanesProxyPtr proxy);
140  SlicePlanesProxyPtr getProxy() { return mProxy; }
141  void setDynamicLabelSize(bool on);
142 
143 protected:
144  virtual void addRepActorsToViewRenderer(ViewPtr view);
145  virtual void removeRepActorsFromViewRenderer(ViewPtr view);
146 
147 private slots:
148  void changedSlot();
149 
150 private:
151  struct DataType
152  {
153  vtkTextActor3DPtr mText;
154  GraphicalPoint3DPtr mPoint;
155  Rect3DPtr mRect;
156  Axes3DPtr mAxes;
157  };
158  typedef std::map<PLANE_TYPE, DataType> DataMap;
159  DataMap mData;
160 
161  SlicePlanes3DRep();
162  void clearActors();
163  SlicePlanesProxyPtr mProxy;
164  ViewportListenerPtr mViewportListener;
165  void rescale();
166 };
167 
168 typedef boost::shared_ptr<class SlicePlanes3DMarkerIn2DRep> SlicePlanes3DMarkerIn2DRepPtr;
169 
182 class cxResourceVisualization_EXPORT SlicePlanes3DMarkerIn2DRep : public RepImpl
183 {
184  Q_OBJECT
185 public:
186  static SlicePlanes3DMarkerIn2DRepPtr New(const QString& uid="");
187  virtual ~SlicePlanes3DMarkerIn2DRep();
188  virtual QString getType() const { return "SlicePlanes3DMarkerIn2DRep"; }
189  void setProxy(PLANE_TYPE type, SlicePlanesProxyPtr proxy);
190  SlicePlanesProxyPtr getProxy() { return mProxy; }
191 
192 protected:
193  virtual void addRepActorsToViewRenderer(ViewPtr view);
194  virtual void removeRepActorsFromViewRenderer(ViewPtr view);
195 private slots:
196  void changedSlot();
197 private:
199  SlicePlanesProxyPtr mProxy;
200  TextDisplayPtr mText;
201  PLANE_TYPE mType;
202 };
203 
204 }
205 
206 #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:63
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:63
virtual QString getType() const
PropertiesType & getProperties()
virtual QString getType() const
boost::shared_ptr< class Rect3D > Rect3DPtr
boost::shared_ptr< class SlicePlanes3DMarkerIn2DRep > SlicePlanes3DMarkerIn2DRepPtr