Fraxinus  2023.01.05-dev+develop.0da12
An IGT application
cxSliceAutoViewportCalculator.h
Go to the documentation of this file.
1 #ifndef CXSLICEAUTOVIEWPORTCALCULATOR_H
2 #define CXSLICEAUTOVIEWPORTCALCULATOR_H
3 
4 #include "cxResourceVisualizationExport.h"
5 #include "cxVector3D.h"
6 #include "cxBoundingBox3D.h"
7 #include "cxTransform3D.h"
8 #include "cxDefinitions.h"
9 
10 namespace cx
11 {
12 
17 class cxResourceVisualization_EXPORT SliceAutoViewportCalculator
18 {
19 public:
20 
21  struct ReturnType
22  {
23  ReturnType(Vector3D center_shift_s_=Vector3D::Zero(), double zoom_=1) :
24  center_shift_s(center_shift_s_),
25  zoom(zoom_)
26  {
27  }
28 
29  double zoom;
31  };
32  // find a (center,zoom) change according the the input config.
34 
35  // MUST set all these parameters before call to calculate() is valid.
36  FOLLOW_TYPE mFollowType;
42 
43 private:
44  Vector3D findCenterShift_s();
45  ReturnType autoZoom();
46  Vector3D findVirtualTooltip_s();
47  DoubleBoundingBox3D findStaticBox();
48  Vector3D findShiftFromBoxToTool_s(DoubleBoundingBox3D BB_s, Vector3D pt_s);
49  Vector3D findShiftFromBoxToROI(DoubleBoundingBox3D bb, DoubleBoundingBox3D roi);
50  double findZoomRequiredToIncludeRoi(DoubleBoundingBox3D base, DoubleBoundingBox3D roi);
51  bool isAutoZoom() const;
52  ReturnType calculateZoomCenter_SmallestFitROI();
53  ReturnType calculateCenter_FitToolIntoViewport();
54  ReturnType calculateZoom_FitROIKeepCenter();
55 };
56 
57 } // namespace cx
58 
59 #endif // CXSLICEAUTOVIEWPORTCALCULATOR_H
ReturnType(Vector3D center_shift_s_=Vector3D::Zero(), double zoom_=1)
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
Namespace for all CustusX production code.