Learn R Programming

RNiftyReg (version 1.1.5)

niftyreg: Two and three dimensional image registration

Description

The niftyreg function performs linear or nonlinear registration for two and three dimensional images. 4D images may also be registered volumewise to a 3D image, or 3D images slicewise to a 2D image. This function is a common wrapper for niftyreg.linear and niftyreg.nonlinear.

Usage

niftyreg(source, target, targetMask = NULL, initAffine = NULL,
    scope = c("affine","rigid","nonlinear"), estimateOnly = FALSE, ...)

Arguments

source
The source image, an object of class "nifti" with 2, 3 or 4 dimensions. Package oro.nifti defines this class and provides functions for reading and writing NIfTI files.
target
The target image, an object of class "nifti" with 2 or 3 dimensions.
targetMask
An optional mask image (again a "nifti" object), whose nonzero region will be taken as the region of interest for the registration. Must have the same voxel and image dimensions as the target image.
initAffine
An optional affine matrix, or list of matrices, to initialise the algorithm.
scope
A string describing the scope, or number of degrees of freedom (DOF), of the registration. The currently-supported values are "affine" (12 DOF), "rigid" (6 DOF) or "nonlinear" (high DOF, with the exact number dependi
estimateOnly
A single logical value: if TRUE, transformations will be estimated but images will not be resampled.
...
Further arguments to niftyreg.linear or niftyreg.nonlinear.

Value

  • A list of class "niftyreg" with components
  • imageAn image object of class "nifti" representing the registered and resampled source image in the space of the target image. This element is NULL if the estimateOnly parameter is TRUE.
  • affineA list of 4x4 matrices containing the optimised affine transformations for each slice or volume of the source image. If the target is a 2D image, elements involving the Z dimension will have no effect. This element is NULL if nonlinear registration is performed.
  • controlA list of objects of class "nifti", representing the control point images for each warping. This element is NULL if linear (rigid or affine) registration is performed.
  • reverseImageAn image object of class "nifti" representing the reverse-registered target image in the space of the source image. This element is NULL unless symmetric nonlinear registration is performed and the estimateOnly parameter is FALSE.
  • reverseControlA list of objects of class "nifti", representing the control points for each reverse warping. This element is NULL unless symmetric nonlinear registration is performed.
  • iterationsA list of integer vectors giving the number of iterations actually run within each level, for each slice or volume of the source image. Note that for the first level of the linear algorithm specifically, twice the specified number of iterations is allowed.
  • scopeCopied from the function argument of the same name.

References

Please see niftyreg.linear or niftyreg.nonlinear for references relating to each type of registration.

See Also

niftyreg.linear and niftyreg.nonlinear, which do most of the work. See nifti (no relation!), in the oro.nifti package, for creating the image objects passed to this function. Useful related functions are as.nifti, readNIfTI and writeNIfTI.

Examples

Run this code
source <- oro.nifti::readNIfTI(system.file("extdata","source.nii.gz",
  package="RNiftyReg"))
target <- oro.nifti::readNIfTI(system.file("extdata","target.nii.gz",
  package="RNiftyReg"))

result <- niftyreg(source, target, scope="affine")

Run the code above in your browser using DataLab