NorMIT-nav  2023.01.05-dev+develop.0da12
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_ */
cx::OrientationAnnotationSmartRepPtr
boost::shared_ptr< class OrientationAnnotationSmartRep > OrientationAnnotationSmartRepPtr
Definition: cxViewWrapper2D.h:37
cx::SlicePlanes3DMarkerIn2DRepPtr
boost::shared_ptr< class SlicePlanes3DMarkerIn2DRep > SlicePlanes3DMarkerIn2DRepPtr
Definition: cxForwardDeclarations.h:93
cx::Texture3DSlicerRepPtr
boost::shared_ptr< class Texture3DSlicerRep > Texture3DSlicerRepPtr
Definition: cxForwardDeclarations.h:103
cx::DoubleBoundingBox3D
Representation of a floating-point bounding box in 3D. The data are stored as {xmin,...
Definition: cxBoundingBox3D.h:63
cx::ViewGroupDataPtr
boost::shared_ptr< class ViewGroupData > ViewGroupDataPtr
Definition: cxViewGroup.h:29
cx::ViewFollowerPtr
boost::shared_ptr< class ViewFollower > ViewFollowerPtr
Definition: cxViewWrapper2D.h:38
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::ViewWrapper2DPtr
boost::shared_ptr< ViewWrapper2D > ViewWrapper2DPtr
Definition: cxViewWrapper2D.h:152
cxForwardDeclarations.h
cxDefinitions.h
cx::VisServicesPtr
boost::shared_ptr< class VisServices > VisServicesPtr
Definition: cxMainWindow.h:40
cxBoundingBox3D.h
cx::SliceProxyPtr
boost::shared_ptr< class SliceProxy > SliceProxyPtr
Definition: cxForwardDeclarations.h:96
cxViewWrapper.h
cx::SlicePlanesProxyPtr
boost::shared_ptr< class SlicePlanesProxy > SlicePlanesProxyPtr
Definition: cxForwardDeclarations.h:95
cx::DataRepContainerPtr
boost::shared_ptr< class DataRepContainer > DataRepContainerPtr
Definition: cxDataRepContainer.h:31
cx::DataPtr
boost::shared_ptr< class Data > DataPtr
Definition: cxRegistrationApplicator.h:22
cx::ImagePtr
boost::shared_ptr< class Image > ImagePtr
Definition: cxDicomWidget.h:27
cx::ToolRep2DPtr
boost::shared_ptr< class ToolRep2D > ToolRep2DPtr
Definition: cxForwardDeclarations.h:104
cx::ViewPtr
boost::shared_ptr< class View > ViewPtr
Definition: cxForwardDeclarations.h:110
cx::Zoom2DHandlerPtr
boost::shared_ptr< class Zoom2DHandler > Zoom2DHandlerPtr
Definition: cx2DZoomHandler.h:22
cx::ViewWrapper2D
Definition: cxViewWrapper2D.h:56
cx::GeometricRep2DPtr
boost::shared_ptr< class GeometricRep2D > GeometricRep2DPtr
Definition: cxForwardDeclarations.h:69
cxTransform3D.h
cx::Vector3D
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Definition: cxVector3D.h:42
cx::ViewWrapper
Superclass for ViewWrappers.
Definition: cxViewWrapper.h:89