RNifti
Fast R and C++ Access to NIfTI Images
|
Inner class representing an xform matrix, which indicates the orientation and other spatial properties of an image. More...
#include <NiftiImage.h>
Public Member Functions | |
Xform () | |
Default constructor. | |
Xform (const Matrix &source) | |
Initialise from a 4x4 SquareMatrix. | |
Xform (const Matrix::NativeType &source) | |
Initialise from a constant NIfTI mat44 or dmat44 . | |
Xform (Matrix::NativeType &source) | |
Initialise from a NIfTI mat44 or dmat44 . More... | |
Xform (Matrix::NativeType &source, Matrix::NativeType &inverse, Element *qparams=NULL) | |
Initialise from forward and backward matrices, and optionally quaternion parameters. More... | |
Xform (SEXP source) | |
Initialise from an R numeric matrix object. | |
operator const Matrix::NativeType () const | |
Allows an Xform to be treated as a constant NIfTI matrix implicitly, making it directly compatible with API functions. | |
operator Matrix::NativeType () | |
Allows an Xform to be treated as a NIfTI matrix implicitly, making it directly compatible with API functions. | |
Xform & | operator= (const Xform &source) |
Copy assignment operator, taking an Xform and replacing linked data. | |
Xform & | operator= (const Matrix &source) |
Copy assignment operator, taking a SquareMatrix and replacing linked data. | |
const Matrix & | matrix () const |
Access the xform matrix as an immutable SquareMatrix object. | |
Submatrix | submatrix () const |
Obtain the upper left 3x3 submatrix from the xform matrix. | |
Submatrix | rotation () const |
Obtain the 3x3 rotation matrix from the xform matrix, with scale and skew components removed. | |
Element | handedness () const |
Returns the qfac value, which should be 1 where the xform matrix represents a right-handed coordinate system (like RAS , the NIfTI default) and -1 for a left-handed system (like LAS , the ANALYZE default). More... | |
Vector4 | quaternion () const |
Obtain the quaternion representation of the xform's rotation component. | |
Vector3 | offset () const |
Obtain the translation component of the xform matrix. | |
Vector3 | spacing () const |
Obtain the pixel spacing of the image in each spatial dimension. | |
std::string | orientation () const |
Obtain the approximate orientation of the image's coordinate frame, as a three-character string consisting of some permutation of the letters L or R (for left or right), P or A (for posterior or anterior) and I or S (for inferior or superior). More... | |
Protected Member Functions | |
void | replace (const Matrix &source) |
Replace the current matrix with a new one. More... | |
Protected Attributes | |
Element * | forward |
Element * | inverse |
Element * | qparams |
Pointers to linked C-style arrays. | |
Matrix | mat |
The full xform matrix underpinning this object. | |
Inner class representing an xform matrix, which indicates the orientation and other spatial properties of an image.
Specifically, an xform is an affine transformation in 3D space, representing the conversion from the image's coordinate system to canonical "real-world" space. The header file nifti1.h
contains authoritative documentation.
|
inline |
Initialise from a NIfTI mat44
or dmat44
.
The data in the linked matrix will be replaced if this object is updated.
|
inline |
Initialise from forward and backward matrices, and optionally quaternion parameters.
These will all be linked to the new object and replaced if it is updated.
Element RNifti::NiftiImage::Xform::handedness | ( | ) | const |
Returns the qfac
value, which should be 1 where the xform matrix represents a right-handed coordinate system (like RAS
, the NIfTI default) and -1 for a left-handed system (like LAS
, the ANALYZE default).
Also see the orientation method
std::string RNifti::NiftiImage::Xform::orientation | ( | ) | const |
Obtain the approximate orientation of the image's coordinate frame, as a three-character string consisting of some permutation of the letters L
or R
(for left or right), P
or A
(for posterior or anterior) and I
or S
(for inferior or superior).
These give the canonical axes most closely aligned with each of the three dimensions as stored
|
protected |
Replace the current matrix with a new one.
This function propagates the changes to the linked arrays, if they are not NULL
.