Learn R Programming

RNiftyReg (version 2.3.0)

xform: Obtain or replace the ``xform'' transforms for an image

Description

These functions convert the ``qform'' or ``sform'' information in a NIfTI header to or from a corresponding affine matrix. These two ``xform'' mechanisms are defined by the NIfTI standard, and may both be in use in a particular image header.

Usage

xform(image, useQuaternionFirst = TRUE)
qform(x) <- value
sform(x) <- value

Arguments

image, x
An image, in any acceptable form (see isImage).
useQuaternionFirst
A single logical value. If TRUE, the ``qform'' matrix will be used first, if it is defined; otherwise the ``sform'' matrix will take priority.
value
A new 4x4 qform or sform matrix. If the matrix has a "code" attribute, the appropriate qform or sform code is also set.

Value

A affine matrix corresponding to the ``qform'' or ``sform'' information in the image header. This is a plain matrix, which does not have the "affine" class or source and target attributes.

References

The NIfTI-1 standard (http://nifti.nimh.nih.gov/nifti-1) is the definitive reference on ``xform'' conventions.