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)"nifti" or
"internalImage", or a plain array, or a NIfTI-1 filename. Must have
2, 3 or 4 dimensions."nifti" or
"internalImage", or a plain array, or a NIfTI-1 filename. Must have
2 or 3 dimensions.NULL, for no initialisation, or an affine matrix or control point
image (nonlinear only). For multiple registration, where the source image
has one more dimension than the target, symmetric is FALSE.finalSpacing is specified: either "voxel" for pixels/voxels,
or "world" for real-world units (see pixunits).TRUE, the code will give
some feedback on its progress; otherwise, nothing will be output while the
algorithm runs. Run time can be seconds or more, depending on the size and
dimensionality of the images.TRUE, transformations will be
estimated, but images will not be resampled.TRUE and source has higher
dimensionality than target, transformations which are not
explicitly initialised will begin from the result of the previous
registration.niftyreg.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.
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.