Fraxinus  22.09
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) 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  * cxViewWrapper2D.h
14  *
15  * \date Mar 24, 2010
16  * \author christiana
17  */
18 #ifndef CXVIEWWRAPPER2D_H_
19 #define CXVIEWWRAPPER2D_H_
20 
21 #include "org_custusx_core_view_Export.h"
22 
23 #include <vector>
24 #include <QPointer>
25 #include "cxForwardDeclarations.h"
26 #include "cxDefinitions.h"
27 #include "cxViewWrapper.h"
28 #include "cxBoundingBox3D.h"
29 #include "cxTransform3D.h"
30 #include "sscConfig.h"
31 
32 class QMouseEvent;
33 class QWheelEvent;
34 
35 namespace cx
36 {
37 typedef boost::shared_ptr<class OrientationAnnotationSmartRep> OrientationAnnotationSmartRepPtr;
38 typedef boost::shared_ptr<class ViewFollower> ViewFollowerPtr;
39 typedef boost::shared_ptr<class Zoom2DHandler> Zoom2DHandlerPtr;
40 typedef boost::shared_ptr<class DataRepContainer> DataRepContainerPtr;
41 }
42 
43 
44 namespace cx
45 {
56 class org_custusx_core_view_EXPORT ViewWrapper2D: public ViewWrapper
57 {
58 Q_OBJECT
59 public:
60  ViewWrapper2D(ViewPtr view, VisServicesPtr backend);
61  virtual ~ViewWrapper2D();
62  virtual void initializePlane(PLANE_TYPE plane);
63  virtual ViewPtr getView();
64  virtual void setSlicePlanesProxy(SlicePlanesProxyPtr proxy);
65  virtual void setViewGroup(ViewGroupDataPtr group);
66 
67  virtual void updateView();
68 
69  ImagePtr getImageToDisplay();
70 
71 signals:
72  void pointSampled(Vector3D p_r);
73 
74 protected:
75  virtual QString getDataDescription();
76  virtual QString getViewDescription();
77 
78 protected slots:
79  virtual void dataViewPropertiesChangedSlot(QString uid);
80  virtual void videoSourcesChangedSlot();
81  virtual void settingsChangedSlot(QString key);
82 
83 private slots:
84  void activeToolChangedSlot();
85  void viewportChanged();
86  void showSlot();
87  void mousePressSlot(int x, int y, Qt::MouseButtons buttons);
88  void mouseMoveSlot(int x, int y, Qt::MouseButtons buttons);
89  void mouseWheelSlot(int x, int y, int delta, int orientation, Qt::MouseButtons buttons);
90  void optionChangedSlot();
91  void showManualToolSlot(bool visible);
92  void toggleShowManualTool();
93 
94 protected slots:
95  void samplePoint(Vector3D click_vp);
96 private:
97  void moveManualTool(Vector3D vp, Vector3D delta_vp);
98  virtual void appendToContextMenu(QMenu& contextMenu);
99  void addReps();
100  DoubleBoundingBox3D getViewport() const;
101  Vector3D qvp2vp(QPoint pos_qvp);
102  void setAxisPos(Vector3D click_vp);
103  void shiftAxisPos(Vector3D delta_vp);
104 
105  ORIENTATION_TYPE getOrientationType() const;
106 
107  virtual void imageAdded(ImagePtr image);
108  //virtual void imageRemoved(const QString& uid);
109 
110  virtual void dataAdded(DataPtr data);
111  virtual void dataRemoved(const QString& uid);
112 
113  void recreateMultiSlicer();
114  void updateItemsFromViewGroup();
115 
116  void createAndAddSliceReps(int numberOfSlices);
117  void removeAndResetSliceRep();
118 
119  bool useGPU2DRendering();
120  bool createAndAddMultiSliceRep();
121  void removeAndResetMultiSliceRep();
122 
123  std::vector<ImagePtr> getImagesToView();
124  bool isAnyplane();
125 
126  void setImagesSWRendering();
127 
128  Texture3DSlicerRepPtr mMultiSliceRep;
129 
130  DataRepContainerPtr mDataRepContainer;
131 
132  GeometricRep2DPtr mPickerGlyphRep;
133  SliceProxyPtr mSliceProxy;
134  std::vector<SliceRepSWPtr> mSliceReps;
135  ToolRep2DPtr mToolRep2D;
136  OrientationAnnotationSmartRepPtr mOrientationAnnotationRep;
137  SlicePlanes3DMarkerIn2DRepPtr mSlicePlanes3DMarker;
138  ViewPtr mView;
139  ViewFollowerPtr mViewFollower;
140 
141  // synchronized data
142  Zoom2DHandlerPtr mZoom2D;
143 
144  Vector3D mLastClickPos_vp;
145 
146  QActionGroup* mOrientationActionGroup;
147  // void sendROItoFollower();
148  void changeZoom(double delta);
149  void applyViewFollower();
150  DoubleBoundingBox3D getViewport_s() const;
151 };
152 typedef boost::shared_ptr<ViewWrapper2D> ViewWrapper2DPtr;
153 
157 } // namespace cx
158 
159 #endif /* CXVIEWWRAPPER2D_H_ */
boost::shared_ptr< class Texture3DSlicerRep > Texture3DSlicerRepPtr
boost::shared_ptr< class ViewGroupData > ViewGroupDataPtr
Definition: cxViewGroup.h:29
boost::shared_ptr< class SlicePlanesProxy > SlicePlanesProxyPtr
boost::shared_ptr< class ViewFollower > ViewFollowerPtr
boost::shared_ptr< class VisServices > VisServicesPtr
Definition: cxMainWindow.h:40
boost::shared_ptr< class SliceProxy > SliceProxyPtr
boost::shared_ptr< class Image > ImagePtr
Definition: cxDicomWidget.h:27
Superclass for ViewWrappers.
Definition: cxViewWrapper.h:89
boost::shared_ptr< class DataRepContainer > DataRepContainerPtr
boost::shared_ptr< class View > ViewPtr
boost::shared_ptr< class ToolRep2D > ToolRep2DPtr
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:42
boost::shared_ptr< class Zoom2DHandler > Zoom2DHandlerPtr
boost::shared_ptr< class SlicePlanes3DMarkerIn2DRep > SlicePlanes3DMarkerIn2DRepPtr
boost::shared_ptr< class GeometricRep2D > GeometricRep2DPtr
Namespace for all CustusX production code.