CustusX  2021.09.21-dev+develop.e3cd0
An IGT application
cxInteractiveCropper.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  * cxInteractiveCropper.h
14  *
15  * \date Aug 24, 2010
16  * \author christiana
17  */
18 
19 #ifndef CXINTERACTIVECROPPER_H_
20 #define CXINTERACTIVECROPPER_H_
21 
22 #include "cxResourceVisualizationExport.h"
23 
24 #include <QObject>
25 #include <QPointer>
26 #include <vtkSmartPointer.h>
27 #include "cxBoundingBox3D.h"
28 #include "cxForwardDeclarations.h"
29 #include "vtkForwardDeclarations.h"
30 
31 
32 namespace cx
33 {
34 typedef vtkSmartPointer<class CropBoxCallback> CropBoxCallbackPtr;
35 typedef vtkSmartPointer<class CropBoxEnableCallback> CropBoxEnableCallbackPtr;
36 typedef boost::shared_ptr<class ActiveImageProxy> ActiveImageProxyPtr;
37 
49 class cxResourceVisualization_EXPORT InteractiveCropper: public QObject
50 {
51 Q_OBJECT
52 public:
53  explicit InteractiveCropper(ActiveDataPtr activeData);
54  void setView(ViewPtr view);
55  DoubleBoundingBox3D getBoundingBox();
56  void setBoundingBox(const DoubleBoundingBox3D& bb_d);
57  void resetBoundingBox();
58  DoubleBoundingBox3D getMaxBoundingBox();
59  bool getUseCropping();
60  bool getShowBoxWidget() const;
61  std::vector<int> getDimensions();
62 signals:
63  void changed();
64 public slots:
65  void showBoxWidget(bool on);
66  void useCropping(bool on);
67 private slots:
68  void imageCropChangedSlot();
69  void imageChangedSlot();
70 
71 private:
72  void boxWasShown(bool val);
73  friend class CropBoxCallback;
74  friend class CropBoxEnableCallback;
75  void setBoxWidgetSize(const DoubleBoundingBox3D& bb_d);
76  DoubleBoundingBox3D getBoxWidgetSize();
77  void setCroppingRegion(DoubleBoundingBox3D bb_d);
78  void updateBoxWidgetInteractor();
79  void initialize();
80 
81  ImagePtr mImage;
82  ViewPtr mView;
83  vtkBoxWidgetPtr mBoxWidget;
84  CropBoxCallbackPtr mCropBoxCallback;
85  CropBoxEnableCallbackPtr mCropBoxEnableCallback;
86  CropBoxEnableCallbackPtr mCropBoxDisableCallback;
87  bool mShowBoxWidget;
88  ActiveImageProxyPtr mActiveImageProxy;
89  ActiveDataPtr mActiveData;
90 };
91 
95 } // namespace cx
96 
97 #endif /* CXINTERACTIVECROPPER_H_ */
boost::shared_ptr< class Image > ImagePtr
Definition: cxDicomWidget.h:27
boost::shared_ptr< class ActiveImageProxy > ActiveImageProxyPtr
boost::shared_ptr< class ActiveData > ActiveDataPtr
Definition: cxColorWidget.h:21
boost::shared_ptr< class View > ViewPtr
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 CropBoxCallback > CropBoxCallbackPtr
vtkSmartPointer< class CropBoxEnableCallback > CropBoxEnableCallbackPtr
Namespace for all CustusX production code.