NorMIT-nav  22.09
An IGT application
cxSliceComputer.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 #ifndef CXSLICECOMPUTER_H_
13 #define CXSLICECOMPUTER_H_
14 
15 #include "cxResourceExport.h"
16 
17 #include "cxTransform3D.h"
18 #include "cxDefinitions.h"
19 
20 namespace cx
21 {
22 
28 class cxResource_EXPORT SlicePlane
29 {
30 public:
32  SlicePlane(const Vector3D& c, const Vector3D& i, const Vector3D& j);
36 };
37 
38 cxResource_EXPORT std::ostream& operator<<(std::ostream& s, const SlicePlane& val);
39 cxResource_EXPORT bool similar(const SlicePlane& a, const SlicePlane& b);
40 
41 
53 class cxResource_EXPORT SliceComputer
54 {
55 public:
56  SliceComputer();
57  ~SliceComputer();
58  void setToolPosition(const Transform3D& rMt);
59  void setOrientationType(ORIENTATION_TYPE val);
60  void setPlaneType(PLANE_TYPE val);
61  void setFixedCenter(const Vector3D& center);
62  void setFollowType(FOLLOW_TYPE val);
63  void setGravity(bool use, const Vector3D& dir);
64  void setToolOffset(double val);
65  void setToolViewOffset(bool use, double viewportHeight, double viewOffset);
66  void setToolViewportHeight(double viewportHeight);
67  void setClinicalApplication(CLINICAL_VIEW application);
68  SlicePlane getPlane() const;
69 
70  void initializeFromPlane(PLANE_TYPE plane, bool useGravity, const Vector3D& gravityDir, bool useViewOffset, double viewportHeight, double toolViewOffset, CLINICAL_VIEW application);
71  ORIENTATION_TYPE getOrientationType() const;
72  PLANE_TYPE getPlaneType() const;
73  FOLLOW_TYPE getFollowType() const;
74  Transform3D getToolPosition() const;
75 
76 private:
77  std::pair<Vector3D,Vector3D> generateBasisVectors() const;
78  Vector3D generateFixedIJCenter(const Vector3D& center_r, const Vector3D& cross_r, const Vector3D& i, const Vector3D& j) const;
79  SlicePlane orientToGravity(const SlicePlane& base) const;
80  SlicePlane orientToGravityAroundToolZAxisAndAlongTheOperatingTable(const SlicePlane& base) const;
81  SlicePlane applyViewOffset(const SlicePlane& base) const;
82  double getViewOffsetAbsoluteFromCenter() const;
83 
84  std::pair<Vector3D,Vector3D> generateBasisVectorsNeurology() const;
85  std::pair<Vector3D,Vector3D> generateBasisVectorsRadiology() const;
86 
87 private:
88  CLINICAL_VIEW mClinicalApplication;
89  ORIENTATION_TYPE mOrientType;
90  PLANE_TYPE mPlaneType;
91  FOLLOW_TYPE mFollowType;
92  Vector3D mFixedCenter;
93 
94  Transform3D m_rMt;
95  double mToolOffset;
96 
97  bool mUseGravity;
98  Vector3D mGravityDirection;
99 
100  bool mUseViewOffset;
101  double mViewportHeight;
102  double mViewOffset;
103  double getWeightForAngularDifference(Vector3D a, Vector3D b) const;
104 };
105 
106 } // namespace cx
107 
108 #endif /*CXSLICECOMPUTER_H_*/
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cxDefinitions.h
cx::SlicePlane::SlicePlane
SlicePlane()
Definition: cxSliceComputer.h:31
cx::Transform3D
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
Definition: cxLandmarkPatientRegistrationWidget.h:33
cx::SlicePlane::i
Vector3D i
defines the first axis of the plane. unit vector
Definition: cxSliceComputer.h:34
cx::operator<<
std::ostream & operator<<(std::ostream &s, const IntBoundingBox3D &data)
Definition: cxBoundingBox3D.cpp:125
cx::SlicePlane::j
Vector3D j
defines the second axis of the plane. unit vector
Definition: cxSliceComputer.h:35
cxTransform3D.h
cx::similar
bool similar(const CameraInfo &lhs, const CameraInfo &rhs, double tol)
Definition: cxCameraStyleForView.cpp:506
cx::Vector3D
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Definition: cxVector3D.h:42
cx::SlicePlane
A 2D slice plane in 3D. i,j are perpendicular unit vectors.
Definition: cxSliceComputer.h:28
cx::SlicePlane::c
Vector3D c
defines the center of the plane
Definition: cxSliceComputer.h:33
cx::SliceComputer
Calculates a slice plane given a definition.
Definition: cxSliceComputer.h:53