niftyreg {RNiftyReg} | R Documentation |
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, scope = c("affine", "rigid", "nonlinear"),
init = NULL, sourceMask = NULL, targetMask = NULL, symmetric = TRUE,
interpolation = 3L, estimateOnly = FALSE, sequentialInit = FALSE,
internal = NA, precision = c("double", "single"),
threads = getOption("RNiftyReg.threads"), ...)
## S3 method for class 'niftyreg'
asNifti(x, ...)
## S3 method for class 'niftyreg'
as.array(x, ...)
Arguments
source |
The source image, an object of class |
target |
The target image, an object of class |
scope |
A string describing the scope, or number of degrees of freedom
(DOF), of the registration. The currently supported values are
|
init |
Transformation(s) to be used for initialisation, which may be
|
sourceMask |
An optional mask image in source space, whose nonzero
region will be taken as the region of interest for the registration.
Ignored when |
targetMask |
An optional mask image in target space, whose nonzero region will be taken as the region of interest for the registration. |
symmetric |
Logical value. Should forward and reverse transformations be estimated simultaneously? |
interpolation |
A single integer specifying the type of interpolation to be applied to the final resampled image. May be 0 (nearest neighbour), 1 (trilinear) or 3 (cubic spline). No other values are valid. |
estimateOnly |
Logical value: if |
sequentialInit |
If |
internal |
If |
precision |
Working precision for the registration. Using single- precision may be desirable to save memory when coregistering large images. |
threads |
For OpenMP-capable builds of the package, the maximum number of threads to use. |
... |
Further arguments to |
x |
A |
Value
A list of class "niftyreg"
with components:
- image
An array or internal image representing the registered and resampled
source
image in the space of thetarget
image. This element isNULL
if theestimateOnly
parameter isTRUE
.- forwardTransforms
A list of (linear or nonlinear) transformations from source to target space.
- reverseTransforms
A list of (linear or nonlinear) transformations from target to source space.
- iterations
A list of integer vectors, giving the number of iterations completed at each “level” of the algorithm. Note that for the first level of the linear algorithm specifically, twice the specified number of iterations is allowed.
- source
An internal representation of the source image for each registration.
- target
An internal representation of the target image.
The as.array
method for this class returns the image
element.
Note
If substantial parts of the target image are zero-valued, for example
because the target image has been brain-extracted, it can be useful to
pass it as a target mask as well as the target image, viz.
niftyreg(source, target, targetMask=target)
.
Author(s)
Jon Clayden <code@clayden.org>
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. Also, forward
and
reverse
to extract transformations, and
applyTransform
to apply them to new images or points.
Examples
## Not run:
source <- readNifti(system.file("extdata", "epi_t2.nii.gz",
package="RNiftyReg"))
target <- readNifti(system.file("extdata", "flash_t1.nii.gz",
package="RNiftyReg"))
result <- niftyreg(source, target, scope="affine")
## End(Not run)