47 s <<
"center : " << val.
c << std::endl;
48 s <<
"i_vector : " << val.
i << std::endl;
49 s <<
"j_vector : " << val.
j << std::endl;
69 mGravityDirection(
Vector3D(0,0,-1)) ,
70 mUseViewOffset(false),
85 mClinicalApplication = application;
110 mClinicalApplication = application;
161 mFixedCenter = center;
179 mGravityDirection = dir;
195 mUseViewOffset = use;
196 mViewportHeight = viewportHeight;
197 mViewOffset = viewOffset;
204 mViewportHeight = viewportHeight;
211 std::pair<Vector3D,Vector3D> basis = generateBasisVectors();
213 plane.
i = basis.first;
214 plane.
j = basis.second;
218 plane.
c = m_rMt.coord(plane.
c);
222 plane.
i = m_rMt.vector(plane.
i);
223 plane.
j = m_rMt.vector(plane.
j);
228 plane = this->orientToGravityAroundToolZAxisAndAlongTheOperatingTable(plane);
232 plane = orientToGravity(plane);
237 plane.
c = generateFixedIJCenter(mFixedCenter, plane.
c, plane.
i, plane.
j);
240 plane = applyViewOffset(plane);
261 double centerOffset = this->getViewOffsetAbsoluteFromCenter();
267 Vector3D newCenter = toolOffsetCenter + centerOffset * base.
j;
268 double toolOffsetDistance =
dot(newCenter - base.
c, base.
j);
272 newCenter = toolCenter - centerOffset * base.
j;
273 double toolDistance =
dot(newCenter - base.
c, base.
j);
276 double usedDistance = std::min(toolOffsetDistance, toolDistance);
277 retval.
c = base.
c + usedDistance * base.
j;
282 double SliceComputer::getViewOffsetAbsoluteFromCenter()
const 287 return mViewportHeight*(0.5-mViewOffset);
296 std::pair<Vector3D,Vector3D> SliceComputer::generateBasisVectors()
const 298 switch (mClinicalApplication)
301 return this->generateBasisVectorsRadiology();
304 return this->generateBasisVectorsNeurology();
311 std::pair<Vector3D,Vector3D> SliceComputer::generateBasisVectorsNeurology()
const 326 throw std::exception();
333 std::pair<Vector3D,Vector3D> SliceComputer::generateBasisVectorsRadiology()
const 348 throw std::exception();
366 Vector3D center_s = M_sr.coord(center_r);
367 Vector3D cross_s = M_sr.coord(cross_r);
369 Vector3D q_s(center_s[0], center_s[1], cross_s[2]);
397 up = -mGravityDirection;
400 double w_n =
dot(up, k);
412 retval.
i = i_g*(1.0-w_n) + i_n*w_n;
413 retval.
i = retval.
i.normal();
442 SlicePlane SliceComputer::orientToGravityAroundToolZAxisAndAlongTheOperatingTable(
const SlicePlane &base)
const 456 double w_n = this->getWeightForAngularDifference(up, toolVector);
458 i_perpendicular = i_perpendicular*(1.0-w_n) + k_neg*w_n;
474 double SliceComputer::getWeightForAngularDifference(
Vector3D a,
Vector3D b)
const 476 double w_n =
dot(a, b);
481 double cutoff = sqrt(3.0)/2.0;
485 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.