Learn R Programming

RNiftyReg (version 2.8.4)

isAffine: Create, test for and print affine matrices

Description

isAffine returns a logical value indicating whether its argument is, or resembles, a 4x4 affine matrix. asAffine converts other objects to the affine class, attaching or updating the source and target image attributes. Affine transformations are a class of linear transformations which preserve points, straight lines and planes, and may consist of a combination of rotation, translation, scale and skew operations.

Usage

isAffine(object, strict = FALSE)

asAffine(object, source = NULL, target = NULL, ...)

# S3 method for niftyreg asAffine(object, source = NULL, target = NULL, i = 1L, ...)

# S3 method for niftyregRDS asAffine(object, source = NULL, target = NULL, ...)

# S3 method for affine asAffine(object, source = NULL, target = NULL, ...)

# S3 method for niftiImage asAffine(object, source = attr(object, "source"), target = attr(object, "target"), ...)

# S3 method for default asAffine(object, source = NULL, target = NULL, ...)

# S3 method for affine print(x, ...)

Value

For isAffine, a logical value, which is TRUE if

object appears to be an affine matrix. For asAffine, a classed affine object with source and target attributes set appropriately.

Arguments

object

An R object.

strict

If TRUE, this function just tests whether the object is of class "affine". Otherwise it also tests for an affine-like 4x4 matrix.

source, target

New source and target images for the transformation.

...

Additional parameters to methods.

i

The transformation number, for niftyreg objects containing more than one.

x

An "affine" object.

Author

Jon Clayden <code@clayden.org>

Details

NiftyReg's convention is for affine matrices to transform world coordinates (in the sense of voxelToWorld) from TARGET to SOURCE space, although transforms are logically applied the other way.