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
.niftyreg(source, target, targetMask = NULL, initAffine = NULL,
scope = c("affine","rigid","nonlinear"), estimateOnly = FALSE, ...)
"nifti"
with 2, 3 or 4 dimensions. Package oro.nifti
defines this class and provides functions for reading and writing NIfTI files."nifti"
with 2 or 3 dimensions."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."affine"
(12 DOF), "rigid"
(6 DOF) or "nonlinear"
(high DOF, with the exact number dependiTRUE
, transformations will be estimated but images will not be resampled.niftyreg.linear
or niftyreg.nonlinear
."niftyreg"
with components"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
.NULL
if nonlinear registration is performed."nifti"
, representing the control point images for each warping. This element is NULL
if linear (rigid or affine) registration is performed."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
."nifti"
, representing the control points for each reverse warping. This element is NULL
unless symmetric nonlinear registration is performed.niftyreg.linear
or niftyreg.nonlinear
for references relating to each type of registration.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
.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