CustusX  16.12
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cxViewWrapper2D.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  * cxViewWrapper2D.h
35  *
36  * \date Mar 24, 2010
37  * \author christiana
38  */
39 #ifndef CXVIEWWRAPPER2D_H_
40 #define CXVIEWWRAPPER2D_H_
41 
42 #include "org_custusx_core_view_Export.h"
43 
44 #include <vector>
45 #include <QPointer>
46 #include "cxForwardDeclarations.h"
47 #include "cxDefinitions.h"
48 #include "cxViewWrapper.h"
49 #include "cxBoundingBox3D.h"
50 #include "cxTransform3D.h"
51 #include "sscConfig.h"
52 
53 class QMouseEvent;
54 class QWheelEvent;
55 
56 namespace cx
57 {
58 typedef boost::shared_ptr<class OrientationAnnotationSmartRep> OrientationAnnotationSmartRepPtr;
59 typedef boost::shared_ptr<class ViewFollower> ViewFollowerPtr;
60 typedef boost::shared_ptr<class Zoom2DHandler> Zoom2DHandlerPtr;
61 typedef boost::shared_ptr<class DataRepContainer> DataRepContainerPtr;
62 }
63 
64 
65 namespace cx
66 {
77 class org_custusx_core_view_EXPORT ViewWrapper2D: public ViewWrapper
78 {
79 Q_OBJECT
80 public:
81  ViewWrapper2D(ViewPtr view, VisServicesPtr backend);
82  virtual ~ViewWrapper2D();
83  virtual void initializePlane(PLANE_TYPE plane);
84  virtual ViewPtr getView();
85  virtual void setSlicePlanesProxy(SlicePlanesProxyPtr proxy);
86  virtual void setViewGroup(ViewGroupDataPtr group);
87 
88  virtual void updateView();
89 
90 
91  ImagePtr getImageToDisplay();
92 
93 signals:
94  void pointSampled(Vector3D p_r);
95 
96 protected:
97  virtual QString getDataDescription();
98  virtual QString getViewDescription();
99 
100 protected slots:
101  virtual void dataViewPropertiesChangedSlot(QString uid);
102  virtual void videoSourcesChangedSlot();
103  virtual void settingsChangedSlot(QString key);
104 
105 private slots:
106  void activeToolChangedSlot();
107  void viewportChanged();
108  void showSlot();
109  void mousePressSlot(int x, int y, Qt::MouseButtons buttons);
110  void mouseMoveSlot(int x, int y, Qt::MouseButtons buttons);
111  void mouseWheelSlot(int x, int y, int delta, int orientation, Qt::MouseButtons buttons);
112  void optionChangedSlot();
113 
114 protected slots:
115  void samplePoint(Vector3D click_vp);
116 private:
117  void moveManualTool(Vector3D vp, Vector3D delta_vp);
118  virtual void appendToContextMenu(QMenu& contextMenu);
119  void addReps();
120  DoubleBoundingBox3D getViewport() const;
121  Vector3D qvp2vp(QPoint pos_qvp);
122  void setAxisPos(Vector3D click_vp);
123  void shiftAxisPos(Vector3D delta_vp);
124 
125  ORIENTATION_TYPE getOrientationType() const;
126 
127  virtual void imageAdded(ImagePtr image);
128  //virtual void imageRemoved(const QString& uid);
129 
130  virtual void dataAdded(DataPtr data);
131  virtual void dataRemoved(const QString& uid);
132 
133  void recreateMultiSlicer();
134  void updateItemsFromViewGroup();
135 
136  void createAndAddSliceRep();
137  void removeAndResetSliceRep();
138 
139  bool useGPU2DRendering();
140  void createAndAddMultiSliceRep();
141  void removeAndResetMultiSliceRep();
142 
143  std::vector<ImagePtr> getImagesToView();
144  bool isAnyplane();
145 
146 #ifndef CX_VTK_OPENGL2
147  Texture3DSlicerRepPtr mMultiSliceRep;
148 #endif
149 
150  DataRepContainerPtr mDataRepContainer;
151 
152  GeometricRep2DPtr mPickerGlyphRep;
153  SliceProxyPtr mSliceProxy;
154  SliceRepSWPtr mSliceRep;
155  ToolRep2DPtr mToolRep2D;
156  OrientationAnnotationSmartRepPtr mOrientationAnnotationRep;
157  SlicePlanes3DMarkerIn2DRepPtr mSlicePlanes3DMarker;
158  ViewPtr mView;
159  ViewFollowerPtr mViewFollower;
160 
161  // synchronized data
162  Zoom2DHandlerPtr mZoom2D;
163 
164  Vector3D mLastClickPos_vp;
165 
166  QActionGroup* mOrientationActionGroup;
167  // void sendROItoFollower();
168  void changeZoom(double delta);
169  void applyViewFollower();
170  DoubleBoundingBox3D getViewport_s() const;
171 };
172 typedef boost::shared_ptr<ViewWrapper2D> ViewWrapper2DPtr;
173 
177 } // namespace cx
178 
179 #endif /* CXVIEWWRAPPER2D_H_ */
boost::shared_ptr< class Texture3DSlicerRep > Texture3DSlicerRepPtr
boost::shared_ptr< class ViewGroupData > ViewGroupDataPtr
Definition: cxViewGroup.h:50
boost::shared_ptr< class SlicePlanesProxy > SlicePlanesProxyPtr
boost::shared_ptr< class ViewFollower > ViewFollowerPtr
boost::shared_ptr< class VisServices > VisServicesPtr
Definition: cxMainWindow.h:62
boost::shared_ptr< class SliceProxy > SliceProxyPtr
boost::shared_ptr< class Image > ImagePtr
Definition: cxDicomWidget.h:48
Superclass for ViewWrappers.
boost::shared_ptr< class DataRepContainer > DataRepContainerPtr
boost::shared_ptr< class View > ViewPtr
boost::shared_ptr< class ToolRep2D > ToolRep2DPtr
boost::shared_ptr< class SliceRepSW > SliceRepSWPtr
boost::shared_ptr< ViewWrapper2D > ViewWrapper2DPtr
boost::shared_ptr< class OrientationAnnotationSmartRep > OrientationAnnotationSmartRepPtr
boost::shared_ptr< class Data > DataPtr
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.
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Definition: cxVector3D.h:63
boost::shared_ptr< class Zoom2DHandler > Zoom2DHandlerPtr
boost::shared_ptr< class SlicePlanes3DMarkerIn2DRep > SlicePlanes3DMarkerIn2DRepPtr
boost::shared_ptr< class GeometricRep2D > GeometricRep2DPtr