CustusX  2021.04.21-dev+develop.337f9
An IGT application
cxGraphicalBox.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 #ifndef CXGRAPHICALBOX_H
13 #define CXGRAPHICALBOX_H
14 
15 #include "cxResourceVisualizationExport.h"
16 
17 #include <QObject>
18 #include <QPointer>
19 #include <vtkSmartPointer.h>
20 #include "cxBoundingBox3D.h"
21 #include "cxForwardDeclarations.h"
22 #include "vtkForwardDeclarations.h"
23 #include "cxTransform3D.h"
24 
25 
26 namespace cx
27 {
28 typedef vtkSmartPointer<class GraphicalBoxCallback> GraphicalBoxCallbackPtr;
29 typedef vtkSmartPointer<class GraphicalBoxEnableCallback> GraphicalBoxEnableCallbackPtr;
30 typedef boost::shared_ptr<class ActiveImageProxy> ActiveImageProxyPtr;
31 
43 class cxResourceVisualization_EXPORT GraphicalBox: public QObject
44 {
45 Q_OBJECT
46 public:
47  explicit GraphicalBox();
48  virtual ~GraphicalBox();
49  void setRenderWindow(vtkRenderWindowPtr renderWindow);
50 
51  DoubleBoundingBox3D getBoundingBox();
52  void setBoundingBox(const DoubleBoundingBox3D& bb_d);
53  void setMaxBoundingBox(const DoubleBoundingBox3D& bb_d);
54  void setPosition(const Transform3D& rMd);
55 // void resetBoundingBox(); ///< set bounding box back to initial size (entire volume)
56  DoubleBoundingBox3D getMaxBoundingBox();
57 
58  bool getInteractive() const; // interactive on/off
59  void setInteractive(bool on);
60  bool getVisible() const; // display on/off
61  void setVisible(bool on);
62 // std::vector<int> getDimensions();
63 signals:
64  void changed(); // any internal state is changed.
65 public slots:
66 // void showBoxWidget(bool on);
67 // void useCropping(bool on);
68 private slots:
69  void updateBoxFromWidget();
70  void updateWidgetFromBox();
71 
72 // void imageCropChangedSlot();
73 // void imageChangedSlot();
74 
75 private:
76 // void boxWasShown(bool val);
77  friend class GraphicalBoxCallback;
79 
80  DoubleBoundingBox3D getCurrentBoxWidgetSize();
81  void setBoxWidgetSize(const DoubleBoundingBox3D &bb_d, Transform3D rMd);
82  void updateBoxWidgetInteractor();
83  void initialize();
84 
85  Transform3D getBoxTransform();
86  void setBoxTransform(const Transform3D& M);
87 
88  vtkRenderWindowPtr mRenderWindow;
89  vtkBoxWidgetPtr mBoxWidget;
90  GraphicalBoxCallbackPtr mGraphicalBoxCallback;
91  GraphicalBoxEnableCallbackPtr mGraphicalBoxEnableCallback;
92  GraphicalBoxEnableCallbackPtr mGraphicalBoxDisableCallback;
93 
94 // bool mShowBoxWidget;
96  DoubleBoundingBox3D mMaxBox;
97  Transform3D m_rMd; // position of box in r/world space
98  bool mInteractive;
99  bool mVisible;
100 };
101 
102 typedef boost::shared_ptr<GraphicalBox> GraphicalBoxPtr;
103 
107 } // namespace cx
108 
109 
110 #endif // CXGRAPHICALBOX_H
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
boost::shared_ptr< class ActiveImageProxy > ActiveImageProxyPtr
vtkSmartPointer< class vtkRenderWindow > vtkRenderWindowPtr
boost::shared_ptr< GraphicalBox > GraphicalBoxPtr
vtkSmartPointer< class GraphicalBoxEnableCallback > GraphicalBoxEnableCallbackPtr
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.
vtkSmartPointer< class vtkBoxWidget > vtkBoxWidgetPtr
vtkSmartPointer< class GraphicalBoxCallback > GraphicalBoxCallbackPtr
Namespace for all CustusX production code.