26 s <<
"center : " << val.
c << std::endl;
27 s <<
"i_vector : " << val.
i << std::endl;
28 s <<
"j_vector : " << val.
j << std::endl;
48 mGravityDirection(
Vector3D(0,0,-1)) ,
49 mUseViewOffset(false),
64 mClinicalApplication = application;
89 mClinicalApplication = application;
140 mFixedCenter = center;
158 mGravityDirection = dir;
174 mUseViewOffset = use;
175 mViewportHeight = viewportHeight;
176 mViewOffset = viewOffset;
183 mViewportHeight = viewportHeight;
190 std::pair<Vector3D,Vector3D> basis = generateBasisVectors();
192 plane.
i = basis.first;
193 plane.
j = basis.second;
197 plane.
c = m_rMt.coord(plane.
c);
201 plane.
i = m_rMt.vector(plane.
i);
202 plane.
j = m_rMt.vector(plane.
j);
207 plane = this->orientToGravityAroundToolZAxisAndAlongTheOperatingTable(plane);
211 plane = orientToGravity(plane);
216 plane.
c = generateFixedIJCenter(mFixedCenter, plane.
c, plane.
i, plane.
j);
219 plane = applyViewOffset(plane);
240 double centerOffset = this->getViewOffsetAbsoluteFromCenter();
246 Vector3D newCenter = toolOffsetCenter + centerOffset * base.
j;
247 double toolOffsetDistance =
dot(newCenter - base.
c, base.
j);
251 newCenter = toolCenter - centerOffset * base.
j;
252 double toolDistance =
dot(newCenter - base.
c, base.
j);
255 double usedDistance = std::min(toolOffsetDistance, toolDistance);
256 retval.
c = base.
c + usedDistance * base.
j;
261 double SliceComputer::getViewOffsetAbsoluteFromCenter()
const 266 return mViewportHeight*(0.5-mViewOffset);
275 std::pair<Vector3D,Vector3D> SliceComputer::generateBasisVectors()
const 277 switch (mClinicalApplication)
280 return this->generateBasisVectorsRadiology();
283 return this->generateBasisVectorsNeurology();
290 std::pair<Vector3D,Vector3D> SliceComputer::generateBasisVectorsNeurology()
const 305 throw std::exception();
312 std::pair<Vector3D,Vector3D> SliceComputer::generateBasisVectorsRadiology()
const 327 throw std::exception();
345 Vector3D center_s = M_sr.coord(center_r);
346 Vector3D cross_s = M_sr.coord(cross_r);
348 Vector3D q_s(center_s[0], center_s[1], cross_s[2]);
376 up = -mGravityDirection;
379 double w_n =
dot(up, k);
391 retval.
i = i_g*(1.0-w_n) + i_n*w_n;
392 retval.
i = retval.
i.normal();
421 SlicePlane SliceComputer::orientToGravityAroundToolZAxisAndAlongTheOperatingTable(
const SlicePlane &base)
const 435 double w_n = this->getWeightForAngularDifference(up, toolVector);
437 i_perpendicular = i_perpendicular*(1.0-w_n) + k_neg*w_n;
453 double SliceComputer::getWeightForAngularDifference(
Vector3D a,
Vector3D b)
const 455 double w_n =
dot(a, b);
460 double cutoff = sqrt(3.0)/2.0;
464 w_n = (w_n-cutoff)/(1.0-cutoff);
Vector3D j
defines the second axis of the plane. unit vector
void setToolViewportHeight(double viewportHeight)
ptCORONAL
a slice seen from the front of the patient
void setToolViewOffset(bool use, double viewportHeight, double viewOffset)
A 2D slice plane in 3D. i,j are perpendicular unit vectors.
ftFOLLOW_TOOL
center follows tool
otOBLIQUE
orient planes relative to the tool space
ftFIXED_CENTER
center is set.
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
void setClinicalApplication(CLINICAL_VIEW application)
ptAXIAL
a slice seen from the top of the patient
PLANE_TYPE getPlaneType() const
void setOrientationType(ORIENTATION_TYPE val)
Vector3D cross(const Vector3D &a, const Vector3D &b)
compute cross product of a and b.
void setToolOffset(double val)
FOLLOW_TYPE getFollowType() const
ptSAGITTAL
a slice seen from the side of the patient
Transform3D createTransformIJC(const Vector3D &ivec, const Vector3D &jvec, const Vector3D ¢er)
Vector3D c
defines the center of the plane
void setPlaneType(PLANE_TYPE val)
otORTHOGONAL
orient planes relative to the image/reference space.
void setFixedCenter(const Vector3D ¢er)
ptTOOLSIDEPLANE
z-rotated 90* relative to anyplane like side plane, but always kept oriented like the plane defined b...
void setToolPosition(const Transform3D &rMt)
double dot(const Vector3D &a, const Vector3D &b)
compute inner product (or dot product) of a and b.
std::ostream & operator<<(std::ostream &s, const IntBoundingBox3D &data)
void initializeFromPlane(PLANE_TYPE plane, bool useGravity, const Vector3D &gravityDir, bool useViewOffset, double viewportHeight, double toolViewOffset, CLINICAL_VIEW application)
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
ptRADIALPLANE
y-rotated 90* relative to anyplane (bird's view)
Vector3D i
defines the first axis of the plane. unit vector
bool similar(const CameraInfo &lhs, const CameraInfo &rhs, double tol)
Transform3D getToolPosition() const
ptANYPLANE
a plane aligned with the tool base plane
void setFollowType(FOLLOW_TYPE val)
void setGravity(bool use, const Vector3D &dir)
ORIENTATION_TYPE getOrientationType() const
SlicePlane getPlane() const
ptSIDEPLANE
z-rotated 90* relative to anyplane (dual anyplane)
Namespace for all CustusX production code.