21 if (this->isAutoZoom())
22 return this->calculateZoomCenter_SmallestFitROI();
25 return this->calculateCenter_FitToolIntoViewport();
30 if (this->isAutoZoom())
31 return this->calculateZoom_FitROIKeepCenter();
37 bool SliceAutoViewportCalculator::isAutoZoom()
const 42 Vector3D SliceAutoViewportCalculator::findCenterShift_s()
46 Vector3D pt_s = this->findVirtualTooltip_s();
48 shift = this->findShiftFromBoxToTool_s(BB_s, pt_s);
64 Vector3D SliceAutoViewportCalculator::findVirtualTooltip_s()
74 followTooltipBoundary =
constrainValue(followTooltipBoundary, 0.0, 0.5);
88 for (
unsigned i=0; i<2; ++i)
90 if (pt_s[i] < BB_s[2*i])
91 shift[i] += pt_s[i] - BB_s[2*i];
92 if (pt_s[i] > BB_s[2*i+1])
93 shift[i] += pt_s[i] - BB_s[2*i+1];
106 for (
unsigned i=0; i<2; ++i)
108 if (roi[2*i ] < bb[2*i ])
109 shift[i] += roi[2*i ] - bb[2*i ];
110 if (roi[2*i+1] > bb[2*i+1])
111 shift[i] += roi[2*i+1] - bb[2*i+1];
139 double zoom = this->findZoomRequiredToIncludeRoi(
mBB_s, roi_sc);
146 Vector3D shift = this->findShiftFromBoxToROI(bb_zoomed, roi_s);
150 retval.
zoom = 1.0/zoom;
174 double zoom = this->findZoomRequiredToIncludeRoi(
mBB_s, roi_s);
176 retval.
zoom = 1.0/zoom;
257 for (
int i=0; i<2; ++i)
259 double base_max = fabs(std::max(base[2*i], base[2*i+1]));
260 double roi_max = fabs(std::max(roi[2*i], roi[2*i+1]));
261 scale = std::max(scale, roi_max/base_max);
DoubleBoundingBox3D transform(const Transform3D &m, const DoubleBoundingBox3D &bb)
double mFollowTooltipBoundary
ftFIXED_CENTER
center is set.
Transform3D createTransformScale(const Vector3D &scale_)
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
DoubleBoundingBox3D mBB_s
DoubleBoundingBox3D mROI_s
double constrainValue(double val, double min, double max)
static DoubleBoundingBox3D zero()
Transform3D createTransformTranslate(const Vector3D &translation)
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.
bool similar(const CameraInfo &lhs, const CameraInfo &rhs, double tol)
SliceAutoViewportCalculator::ReturnType calculate()
Namespace for all CustusX production code.