NorMIT-nav  16.5
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 slots:
97  virtual void dataViewPropertiesChangedSlot(QString uid);
98  virtual void videoSourcesChangedSlot();
99 
100 private slots:
101  void activeToolChangedSlot();
102  void viewportChanged();
103  void showSlot();
104  void mousePressSlot(int x, int y, Qt::MouseButtons buttons);
105  void mouseMoveSlot(int x, int y, Qt::MouseButtons buttons);
106  void mouseWheelSlot(int x, int y, int delta, int orientation, Qt::MouseButtons buttons);
107  void settingsChangedSlot(QString key);
108  void optionChangedSlot();
109 
110 protected slots:
111  void samplePoint(Vector3D click_vp);
112 private:
113  void moveManualTool(Vector3D vp, Vector3D delta_vp);
114  virtual void appendToContextMenu(QMenu& contextMenu);
115  void addReps();
116  DoubleBoundingBox3D getViewport() const;
117  Vector3D qvp2vp(QPoint pos_qvp);
118  void setAxisPos(Vector3D click_vp);
119  void shiftAxisPos(Vector3D delta_vp);
120 
121  ORIENTATION_TYPE getOrientationType() const;
122 
123  virtual void imageAdded(ImagePtr image);
124  //virtual void imageRemoved(const QString& uid);
125 
126  virtual void dataAdded(DataPtr data);
127  virtual void dataRemoved(const QString& uid);
128 
129  void recreateMultiSlicer();
130  void updateItemsFromViewGroup(QString &text);
131 
132  void setDataNameText(QString &text);
133  void updateDataNameText(QString &text);
134 
135  void createAndAddSliceRep();
136  void removeAndResetSliceRep();
137 
138  bool useGPU2DRendering();
139  void createAndAddMultiSliceRep();
140  void removeAndResetMultiSliceRep();
141 
142  std::vector<ImagePtr> getImagesToView();
143  bool isAnyplane();
144 
145 #ifndef CX_VTK_OPENGL2
146  Texture3DSlicerRepPtr mMultiSliceRep;
147 #endif
148 
149  DataRepContainerPtr mDataRepContainer;
150 
151  GeometricRep2DPtr mPickerGlyphRep;
152  SliceProxyPtr mSliceProxy;
153  SliceRepSWPtr mSliceRep;
154  ToolRep2DPtr mToolRep2D;
155  OrientationAnnotationSmartRepPtr mOrientationAnnotationRep;
156  DisplayTextRepPtr mPlaneTypeText;
157  DisplayTextRepPtr mDataNameText;
158  SlicePlanes3DMarkerIn2DRepPtr mSlicePlanes3DMarker;
159  ViewPtr mView;
160  ViewFollowerPtr mViewFollower;
161 
162 
163  // synchronized data
164  Zoom2DHandlerPtr mZoom2D;
165 
166  Vector3D mLastClickPos_vp;
167 
168  QActionGroup* mOrientationActionGroup;
169 };
170 typedef boost::shared_ptr<ViewWrapper2D> ViewWrapper2DPtr;
171 
175 } // namespace cx
176 
177 #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.
Definition: cxViewWrapper.h:93
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 DisplayTextRep > DisplayTextRepPtr
boost::shared_ptr< class Zoom2DHandler > Zoom2DHandlerPtr
boost::shared_ptr< class SlicePlanes3DMarkerIn2DRep > SlicePlanes3DMarkerIn2DRepPtr
boost::shared_ptr< class GeometricRep2D > GeometricRep2DPtr