Learn R Programming

RNiftyReg (version 1.1.5)

transformWithControlPoints: Transform points using a control point image

Description

This function is used to transform points from source to target space using a control point image, possibly obtained from niftyreg.nonlinear. A subvoxel location is target space is returned unless the nearest voxel is requested.

Usage

transformWithControlPoints(points, controlPointImage, source, target,
    nearest = FALSE)

Arguments

points
A vector giving the coordinates of a point, or a matrix with one point per row. These must be given as voxel-based locations: see transformWorldToVoxel for a function to convert from ``real wo
controlPointImage
An object of class "nifti" containing the control points parameterising the transformation.
source
A "nifti" object representing the source image for the transformation.
target
A "nifti" object representing the target image for the transformation.
nearest
A logical value: if TRUE, the return value contains just the location of the nearest voxel to each requested location. This is computationally more efficient than simply rounding the result.

Value

  • A vector or matrix of transformed points.

Details

The transformation performed by this function is not exact, and its accuracy will depend to some extent on the density of the control point grid and the geometry of the deformation in the vicinity of the points of interest. Nevertheless, it should be quite sufficient for most purposes.

The method is to first convert the control points to a deformation field (cf. getDeformationField), which encodes the location of each target space voxel in the source space. The target voxel closest to the requested location is found by searching through this deformation field, and returned if nearest is TRUE or it coincides exactly with the requested location. Otherwise, a block of four voxels in each dimension around the point of interest is extracted from the deformation field, and the final location is estimated by cubic spline regression.

See Also

niftyreg.nonlinear, getDeformationField