Fraxinus  16.5.0-fx-rc1
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Math

The CustusX Math library, based on Eigen. More...

Classes

class  cx::IntBoundingBox3D
 Representation of an integer bounding box in 3D. The data are stored as {xmin,xmax,ymin,ymax,zmin,zmax}, in order to simplify communication with vtk. More...
 
class  cx::DoubleBoundingBox3D
 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. More...
 
class  cx::DecomposedTransform3D
 Helper class for visualizing rotational angles to a human user. More...
 
class  cx::Frame3D
 Defines an axis-angle representation of a position+orientation in 3D space. More...
 

Macros

#define EIGEN_DEFAULT_IO_FORMAT   Eigen::IOFormat(6, 0, " ", " ", "","","","")
 
#define EIGEN_PLAINOBJECTBASE_PLUGIN   "cxPlainObjectEigenAddons.h"
 
#define EIGEN_MATRIXBASE_PLUGIN   "cxMatrixBaseEigenAddons.h"
 
#define EIGEN_TRANSFORM_PLUGIN   "cxTransformEigenAddons.h"
 
#define EIGEN_DONT_ALIGN
 

Typedefs

typedef Transform3D cx::Transform3D
 Transform3D is a representation of an affine 3D transform. More...
 
typedef boost::shared_ptr
< Transform3D > 
cx::Transform3DPtr
 
typedef Eigen::Vector3d cx::Vector3D
 Vector3D is a representation of a point or vector in 3D. More...
 
typedef boost::shared_ptr
< Vector3D > 
cx::Vector3DPtr
 

Functions

std::ostream & cx::operator<< (std::ostream &s, const IntBoundingBox3D &data)
 
bool cx::similar (const DoubleBoundingBox3D &a, const DoubleBoundingBox3D &b, double tol)
 
std::ostream & cx::operator<< (std::ostream &s, const DoubleBoundingBox3D &data)
 
std::ostream & cx::operator<< (std::ostream &s, const Frame3D &t)
 
bool cx::similar (const Transform3D &a, const Transform3D &b, double tol)
 
DoubleBoundingBox3D cx::transform (const Transform3D &m, const DoubleBoundingBox3D &bb)
 
Transform3D cx::createTransformNormalize (const DoubleBoundingBox3D &in, const DoubleBoundingBox3D &out)
 
Transform3D cx::createTransformScale (const Vector3D &scale_)
 
Transform3D cx::createTransformTranslate (const Vector3D &translation)
 
Transform3D cx::createTransformRotateX (const double angle)
 
Transform3D cx::createTransformRotateY (const double angle)
 
Transform3D cx::createTransformRotateZ (const double angle)
 
Transform3D cx::createTransformIJC (const Vector3D &ivec, const Vector3D &jvec, const Vector3D &center)
 
cxResource_EXPORT Transform3D cx::createTransformRotationBetweenVectors (Vector3D from, Vector3D to)
 
cxResource_EXPORT Transform3D cx::createTransformLPS2RAS ()
 
cxResource_EXPORT Transform3D cx::createTransformFromReferenceToExternal (PATIENT_COORDINATE_SYSTEM external)
 
bool cx::similar (double a, double b, double tol=1.0E-6)
 check for equality with a tolerance: |b-a|<tol More...
 
Vector3D cx::multiply_elems (const Vector3D &a, const Vector3D &b)
 perform element-wise multiplication of a and b. More...
 
Vector3D cx::divide_elems (const Vector3D &a, const Vector3D &b)
 perform element-wise division of a and b. More...
 
Vector3D cx::cross (const Vector3D &a, const Vector3D &b)
 compute cross product of a and b. More...
 
double cx::dot (const Vector3D &a, const Vector3D &b)
 compute inner product (or dot product) of a and b. More...
 
bool cx::similar (const Vector3D &a, const Vector3D &b, double tol=1.0E-6)
 check for equality with a tolerance: |b-a|<tol More...
 
Vector3D cx::unitVector (double thetaXY, double thetaZ=0.0)
 compute a unit vector given angles xy in the xy plane and z meaning the elevation from the xy plane. More...
 
double cx::getThetaXY (Vector3D v)
 get thetaXY, meaning the angle of v projected onto the xy plane More...
 
double cx::getThetaZ (Vector3D v)
 get thetaZ, z meaning the elevation from the xy plane More...
 
Vector3D cx::round (const Vector3D &a)
 
Vector3D cx::ceil (const Vector3D &a)
 
bool cx::similar (const Eigen::Array3i &a, const Eigen::Array3i &b)
 identical to the equality operator, exists for symmetry with Vector3D. More...
 
QString cx::prettyFormat (Vector3D val, int decimals, int fieldWidth)
 
Eigen::Vector2d cx::fromString (const QString &text)
 

Detailed Description

The CustusX Math library, based on Eigen.

The math in CustusX should preferrably be done in terms of Eigen, http://eigen.tuxfamily.org/dox/

The core classes Vector3D and Transform3D have been reduced to typedefs of Eigen structures.

Macro Definition Documentation

#define EIGEN_DEFAULT_IO_FORMAT   Eigen::IOFormat(6, 0, " ", " ", "","","","")

Definition at line 79 of file cxMathBase.h.

#define EIGEN_DONT_ALIGN

Definition at line 84 of file cxMathBase.h.

#define EIGEN_MATRIXBASE_PLUGIN   "cxMatrixBaseEigenAddons.h"

Definition at line 82 of file cxMathBase.h.

#define EIGEN_PLAINOBJECTBASE_PLUGIN   "cxPlainObjectEigenAddons.h"

Definition at line 81 of file cxMathBase.h.

#define EIGEN_TRANSFORM_PLUGIN   "cxTransformEigenAddons.h"

Definition at line 83 of file cxMathBase.h.

Typedef Documentation

typedef Eigen::Affine3d cx::Transform3D

Transform3D is a representation of an affine 3D transform.

Transform3D is implemented using the Eigen library type Eigen::Affine3d, and extended with convenience methods using the Eigen plugin system.

Some of the extension exist for backward compatibility with the old inhouse Transform3D.

Definition at line 54 of file cxLandmarkPatientRegistrationWidget.h.

typedef boost::shared_ptr<Transform3D> cx::Transform3DPtr

Definition at line 246 of file cxTransform3D.h.

typedef Eigen::Vector3d cx::Vector3D

Vector3D is a representation of a point or vector in 3D.

Vector3D is implemented using the Eigen library type Eigen::Vector3d, and extended with convenience methods using the Eigen plugin system.

Some of the extension exist for backward compatibility with the old inhouse Vector3D.

Definition at line 63 of file cxVector3D.h.

typedef boost::shared_ptr<Vector3D> cx::Vector3DPtr

Definition at line 64 of file cxVector3D.h.

Function Documentation

cxResource_EXPORT Vector3D cx::ceil ( const Vector3D &  a)

Definition at line 105 of file cxVector3D.cpp.

cxResource_EXPORT Transform3D cx::createTransformFromReferenceToExternal ( PATIENT_COORDINATE_SYSTEM  external)

Create a transform from the internal (LPS) space to a given external (LPS or RAS) space. The return value is on the form sMr, where s=external space, r=internal ref space.

Definition at line 251 of file cxTransform3D.cpp.

cxResource_EXPORT Transform3D cx::createTransformIJC ( const Vector3D &  ivec,
const Vector3D &  jvec,
const Vector3D &  center 
)

Create a transform to a space defined by an origin and two perpendicular unit vectors that for the x-y plane. The original space is A and the space defined by ijc are B The returned transform M_AB converts a point in B to A: p_A = M_AB * p_B

Definition at line 235 of file cxTransform3D.cpp.

cxResource_EXPORT Transform3D cx::createTransformLPS2RAS ( )

Convert from left-posterior-superior (LPS) or right-anterior-superior (RAS). LPS is used by DICOM and CustusX, RAS is used by Slicer, ITK-Snap, NifTI,

Definition at line 246 of file cxTransform3D.cpp.

cxResource_EXPORT Transform3D cx::createTransformNormalize ( const DoubleBoundingBox3D &  in,
const DoubleBoundingBox3D &  out 
)

Normalize volume defined by in to volume defined by out.

This is intended for creating transforms from one viewport to another, i.e. the two boxes should be aligned and differ only in translation + scaling.

Definition at line 213 of file cxTransform3D.cpp.

cxResource_EXPORT Transform3D cx::createTransformRotateX ( const double  angle)

Create a transform representing a rotation about the X-axis with an input angle.

Definition at line 192 of file cxTransform3D.cpp.

cxResource_EXPORT Transform3D cx::createTransformRotateY ( const double  angle)

Create a transform representing a rotation about the Y-axis with an input angle.

Definition at line 199 of file cxTransform3D.cpp.

cxResource_EXPORT Transform3D cx::createTransformRotateZ ( const double  angle)

Create a transform representing a rotation about the Z-axis with an input angle.

Definition at line 206 of file cxTransform3D.cpp.

cxResource_EXPORT Transform3D cx::createTransformRotationBetweenVectors ( Vector3D  from,
Vector3D  to 
)
cxResource_EXPORT Transform3D cx::createTransformScale ( const Vector3D &  scale)

Create a transform representing a scale in x,y,z

Definition at line 178 of file cxTransform3D.cpp.

cxResource_EXPORT Transform3D cx::createTransformTranslate ( const Vector3D &  translation)

Create a transform representing a translation

Definition at line 185 of file cxTransform3D.cpp.

cxResource_EXPORT Vector3D cx::cross ( const Vector3D &  a,
const Vector3D &  b 
)

compute cross product of a and b.

Definition at line 62 of file cxVector3D.cpp.

cxResource_EXPORT Vector3D cx::divide_elems ( const Vector3D &  a,
const Vector3D &  b 
)

perform element-wise division of a and b.

Definition at line 57 of file cxVector3D.cpp.

cxResource_EXPORT double cx::dot ( const Vector3D &  a,
const Vector3D &  b 
)

compute inner product (or dot product) of a and b.

Definition at line 67 of file cxVector3D.cpp.

cxResource_EXPORT Eigen::Vector2d cx::fromString ( const QString &  text)

Definition at line 127 of file cxVector3D.cpp.

cxResource_EXPORT double cx::getThetaXY ( Vector3D  k)

get thetaXY, meaning the angle of v projected onto the xy plane

Definition at line 86 of file cxVector3D.cpp.

cxResource_EXPORT double cx::getThetaZ ( Vector3D  k)

get thetaZ, z meaning the elevation from the xy plane

Definition at line 91 of file cxVector3D.cpp.

cxResource_EXPORT Vector3D cx::multiply_elems ( const Vector3D &  a,
const Vector3D &  b 
)

perform element-wise multiplication of a and b.

Definition at line 52 of file cxVector3D.cpp.

cxResource_EXPORT std::ostream & cx::operator<< ( std::ostream &  s,
const IntBoundingBox3D &  data 
)

Definition at line 146 of file cxBoundingBox3D.cpp.

cxResource_EXPORT std::ostream & cx::operator<< ( std::ostream &  s,
const Frame3D &  t 
)

Definition at line 177 of file cxFrame3D.cpp.

cxResource_EXPORT std::ostream & cx::operator<< ( std::ostream &  s,
const DoubleBoundingBox3D &  data 
)

Definition at line 254 of file cxBoundingBox3D.cpp.

cxResource_EXPORT QString cx::prettyFormat ( Vector3D  val,
int  decimals,
int  fieldWidth 
)

Definition at line 119 of file cxVector3D.cpp.

cxResource_EXPORT Vector3D cx::round ( const Vector3D &  a)

Definition at line 96 of file cxVector3D.cpp.

cxResource_EXPORT bool cx::similar ( double  a,
double  b,
double  tol 
)

check for equality with a tolerance: |b-a|<tol

Definition at line 47 of file cxVector3D.cpp.

cxResource_EXPORT bool cx::similar ( const Vector3D &  a,
const Vector3D &  b,
double  tol 
)

check for equality with a tolerance: |b-a|<tol

Definition at line 72 of file cxVector3D.cpp.

cxResource_EXPORT bool cx::similar ( const Eigen::Array3i &  a,
const Eigen::Array3i &  b 
)

identical to the equality operator, exists for symmetry with Vector3D.

Definition at line 114 of file cxVector3D.cpp.

cxResource_EXPORT bool cx::similar ( const Transform3D &  a,
const Transform3D &  b,
double  tol 
)

Definition at line 156 of file cxTransform3D.cpp.

cxResource_EXPORT bool cx::similar ( const DoubleBoundingBox3D &  a,
const DoubleBoundingBox3D &  b,
double  tol 
)

Definition at line 249 of file cxBoundingBox3D.cpp.

cxResource_EXPORT DoubleBoundingBox3D cx::transform ( const Transform3D &  m,
const DoubleBoundingBox3D &  bb 
)

Transform bb using the transform m. Only the two defining corners are actually transformed.

Definition at line 171 of file cxTransform3D.cpp.

cxResource_EXPORT Vector3D cx::unitVector ( double  thetaXY,
double  thetaZ 
)

compute a unit vector given angles xy in the xy plane and z meaning the elevation from the xy plane.

Definition at line 77 of file cxVector3D.cpp.