You should almost always call xform rather calling thanxformpoints directly.

xformpoints(reg, points, ...)

# S3 method for character
xformpoints(reg, points, ...)

# S3 method for cmtkreg
xformpoints(
reg,
points,
transformtype = c("warp", "affine"),
direction = NULL,
FallBackToAffine = FALSE,
...
)

# S3 method for reglist
xformpoints(reg, points, ...)

# S3 method for default
xformpoints(reg, points, ...)

Arguments

reg A registration defined by a matrix, a function, a cmtkreg object, a reglist object containing a sequence of arbitrary registrations, or a character vector specifying path(s) to registrations on disk (see details). Nx3 matrix of points Additional arguments passed to methods Which transformation to use when the CMTK file contains both warp (default) and affine Whether to transform points from sample space to reference space (called inverse by CMTK) or from reference to sample space (called forward by CMTK). Default (when NULL is inverse). Whether to use the affine transformation for points that fail to transform under a warping transformation.

Details

If a list of transformations is passed in, these transformations are performed in sequence order, such that xformpoints(c(a,b,c), x) == xformpoints(c, (xformpoints(b, xformpoints(a, x))))

Note that the direction of CMTK registrations can be the source of much confusion. This is because CMTK defines the forward direction as the transform required to reformat an image in sample (floating) space to an image in template space. Since this operation involves filling a regular grid in template space by looking up the corresponding positions in sample space, the transformation that is required is (somewhat counterintuitively) the one that maps template to sample. However in neuroanatomical work, one often has points in sample space that one would like to transform into template space. Here one needs the inverse transformation.