Fraxinus  17.12-rc4
An IGT application
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  ImagePtr getImageToDisplay();
91 
92 signals:
93  void pointSampled(Vector3D p_r);
94 
95 protected:
96  virtual QString getDataDescription();
97  virtual QString getViewDescription();
98 
99 protected slots:
100  virtual void dataViewPropertiesChangedSlot(QString uid);
101  virtual void videoSourcesChangedSlot();
102  virtual void settingsChangedSlot(QString key);
103 
104 private slots:
105  void activeToolChangedSlot();
106  void viewportChanged();
107  void showSlot();
108  void mousePressSlot(int x, int y, Qt::MouseButtons buttons);
109  void mouseMoveSlot(int x, int y, Qt::MouseButtons buttons);
110  void mouseWheelSlot(int x, int y, int delta, int orientation, Qt::MouseButtons buttons);
111  void optionChangedSlot();
112  void showManualToolSlot(bool visible);
113  void toggleShowManualTool();
114 
115 protected slots:
116  void samplePoint(Vector3D click_vp);
117 private:
118  void moveManualTool(Vector3D vp, Vector3D delta_vp);
119  virtual void appendToContextMenu(QMenu& contextMenu);
120  void addReps();
121  DoubleBoundingBox3D getViewport() const;
122  Vector3D qvp2vp(QPoint pos_qvp);
123  void setAxisPos(Vector3D click_vp);
124  void shiftAxisPos(Vector3D delta_vp);
125 
126  ORIENTATION_TYPE getOrientationType() const;
127 
128  virtual void imageAdded(ImagePtr image);
129  //virtual void imageRemoved(const QString& uid);
130 
131  virtual void dataAdded(DataPtr data);
132  virtual void dataRemoved(const QString& uid);
133 
134  void recreateMultiSlicer();
135  void updateItemsFromViewGroup();
136 
137  void createAndAddSliceRep();
138  void removeAndResetSliceRep();
139 
140  bool useGPU2DRendering();
141  bool createAndAddMultiSliceRep();
142  void removeAndResetMultiSliceRep();
143 
144  std::vector<ImagePtr> getImagesToView();
145  bool isAnyplane();
146 
147  Texture3DSlicerRepPtr mMultiSliceRep;
148 
149  DataRepContainerPtr mDataRepContainer;
150 
151  GeometricRep2DPtr mPickerGlyphRep;
152  SliceProxyPtr mSliceProxy;
153  SliceRepSWPtr mSliceRep;
154  ToolRep2DPtr mToolRep2D;
155  OrientationAnnotationSmartRepPtr mOrientationAnnotationRep;
156  SlicePlanes3DMarkerIn2DRepPtr mSlicePlanes3DMarker;
157  ViewPtr mView;
158  ViewFollowerPtr mViewFollower;
159 
160  // synchronized data
161  Zoom2DHandlerPtr mZoom2D;
162 
163  Vector3D mLastClickPos_vp;
164 
165  QActionGroup* mOrientationActionGroup;
166  // void sendROItoFollower();
167  void changeZoom(double delta);
168  void applyViewFollower();
169  DoubleBoundingBox3D getViewport_s() const;
170 };
171 typedef boost::shared_ptr<ViewWrapper2D> ViewWrapper2DPtr;
172 
176 } // namespace cx
177 
178 #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:61
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
Namespace for all CustusX production code.