The niftyreg.nonlinear
function performs 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. The warping
is based on free-form deformations, parameterised using an image of control
points.
niftyreg.nonlinear(source, target, init = NULL, sourceMask = NULL,
targetMask = NULL, symmetric = TRUE, nLevels = 3L,
maxIterations = 150L, nBins = 64L, bendingEnergyWeight = 0.001,
linearEnergyWeight = 0.01, jacobianWeight = 0, finalSpacing = c(5, 5,
5), spacingUnit = c("voxel", "world"), interpolation = 3L,
verbose = FALSE, estimateOnly = FALSE, sequentialInit = FALSE,
internal = NA, precision = c("double", "single"),
threads = getOption("RNiftyReg.threads"))
source | The source image, an object of class |
---|---|
target | The target image, an object of class |
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? |
nLevels | A single integer specifying the number of levels of the algorithm that should be applied. If zero, no optimisation will be performed, and the final control-point image will be the same as its initialisation value. |
maxIterations | A single integer specifying the maximum number of iterations to be used within each level. Fewer iterations may be used if a convergence test deems the process to have completed. |
nBins | A single integer giving the number of bins to use for the joint histogram created by the algorithm. |
bendingEnergyWeight | A numeric value giving the weight of the bending energy term in the cost function. |
linearEnergyWeight | A numeric value giving the weight of the linear energy term in the cost function. |
jacobianWeight | A numeric value giving the weight of the Jacobian determinant term in the cost function. |
finalSpacing | A numeric vector giving the spacing of control points in the final grid, along the X, Y and Z directions respectively. This is set from the initial control point image, if one is supplied. |
spacingUnit | A character string giving the units in which the
|
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. |
verbose | A single logical value: if |
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. |
See niftyreg
.
This function performs the dual operations of finding a transformation to
optimise image alignment, and resampling the source image into the space of
the target image (and vice-versa, if symmetric
is TRUE
).
Unlike niftyreg.linear
, this transformation is nonlinear, and
the degree of deformation may vary across the image.
The nonlinear warping is based on free-form deformations. A lattice of equally-spaced control points is defined over the target image, each of which can be moved to locally modify the mapping to the source image. In order to assess the quality of the warping between the two images, an objective function based on the normalised mutual information is used, with penalty terms based on the bending energy or the squared log of the Jacobian determinant. The objective function value is optimised using a conjugate gradient scheme.
The source image may have 2, 3 or 4 dimensions, and the target 2 or 3. The dimensionality of the target image determines whether 2D or 3D registration is applied, and source images with one more dimension than the target (i.e. 4D to 3D, or 3D to 2D) will be registered volumewise or slicewise, as appropriate. In the latter case the last dimension of the resulting image is taken from the source image, while all other dimensions come from the target. One image of control points is returned for each registration performed.
Performing a linear registration first, and then initialising the
nonlinear transformation with the result (via the init
parameter),
is highly recommended in most circumstances.
The algorithm used by this function is described in the following publication.
M. Modat, G.R. Ridgway, Z.A. Taylor, M. Lehmann, J. Barnes, D.J. Hawkes, N.C. Fox & S. Ourselin (2010). Fast free-form deformation using graphics processing units. Computer Methods and Programs in Biomedicine 98(3):278-284.
niftyreg
, which can be used as an interface to this
function, and niftyreg.linear
for linear registration. Also,
forward
and reverse
to extract
transformations, and applyTransform
to apply them to new
images or points.
Jon Clayden <code@clayden.org>