Learn R Programming

ANTsR (version 0.3.3)

antsRegistration: Perform registration between two images.

Description

Register a pair of images either through the full or simplified interface to the ANTs registration method.

Usage

antsRegistration(fixed = NA, moving = NA, typeofTransform = "SyN", initialTransform = NA, outprefix = "", mask = NA, gradStep = 0.2, flowSigma = 3, totalSigma = 0, affMetric = "mattes", affSampling = 32, synMetric = "mattes", synSampling = 32, regIterations = c(40, 20, 0), verbose = FALSE, ...)

Arguments

fixed
fixed image to which we register the moving image.
moving
moving image to be mapped to fixed space.
typeofTransform
A linear or non-linear registration type. Mutual information metric by default. See Details.
initialTransform
transforms to prepend
outprefix
output will be named with this prefix.
mask
mask the registration.
gradStep
gradient step size (not for all tx)
flowSigma
smoothing for update field
totalSigma
smoothing for total field
affMetric
the metric for the affine part (GC, mattes, meansquares)
affSampling
the nbins or radius parameter for the syn metric
synMetric
the metric for the syn part (CC, mattes, meansquares, demons)
synSampling
the nbins or radius parameter for the syn metric
regIterations
vector of iterations for syn. we will set the smoothing and multi-resolution parameters based on the length of this vector.
verbose
request verbose output (useful for debugging)
...
additional options see antsRegistration in ANTs

Value

outputs a list containing:
  • warpedmovout: Moving image warped to space of fixed image.
  • warpedfixout: Fixed image warped to space of moving image.
  • fwdtransforms: Transforms to move from moving to fixed image.
  • invtransforms: Transforms to move from fixed to moving image.
Ouptut of 1 indicates failure

Details

typeofTransform can be one of:
  • "Translation": Translation transformation.
  • "Rigid": Rigid transformation: Only rotation and translation.
  • "QuickRigid": Rigid transformation: Only rotation and translation. May be useful for quick visualization fixes.'
  • "DenseRigid": Rigid transformation: Only rotation and translation. Employs dense sampling during metric estimation.'
  • "BOLDRigid": Rigid transformation: Parameters typical for BOLD to BOLD intrasubject registration'.'
  • "Affine": Affine transformation: Rigid + scaling.
  • "AffineFast": Fast version of Affine.
  • "BOLDAffine": Affine transformation: Parameters typical for BOLD to BOLD intrasubject registration'.'
  • "TRSAA": translation, rigid, similarity, affine (twice). please set regIterations if using this option. this would be used in cases where you want a really high quality affine mapping (perhaps with mask).
  • "ElasticSyN": Symmetric normalization: Affine + deformable transformation, with mutual information as optimization metric and elastic regularization.
  • "SyN": Symmetric normalization: Affine + deformable transformation, with mutual information as optimization metric.
  • "SyNRA": Symmetric normalization: Rigid + Affine + deformable transformation, with mutual information as optimization metric.
  • "SyNOnly": Symmetric normalization: no initial transformation, with mutual information as optimization metric. Assumes images are aligned by an inital transformation. Can be useful if you want to run an unmasked affine followed by masked deformable registration.
  • "SyNCC": SyN, but with cross-correlation as the metric.
  • "SyNabp": SyN optimized for abpBrainExtraction.
  • "SyNBold": SyN, but optimized for registrations between BOLD and T1 images.
  • "SyNBoldAff": SyN, but optimized for registrations between BOLD and T1 images, with additional affine step.
  • "SyNAggro": SyN, but with more aggressive registration (fine-scale matching and more deformation). Takes more time than SyN.
  • "TVMSQ": time-varying diffeomorphism with mean square metric
  • "TVMSQC": time-varying diffeomorphism with mean square metric for very large deformation

Examples

Run this code

fi <- antsImageRead(getANTsRData("r16") )
mi <- antsImageRead(getANTsRData("r64") )
fi<-resampleImage(fi,c(60,60),1,0)
mi<-resampleImage(mi,c(60,60),1,0) # speed up
mytx <- antsRegistration(fixed=fi, moving=mi, typeofTransform = c('SyN') )
mywarpedimage <- antsApplyTransforms( fixed=fi, moving=mi,
  transformlist=mytx$fwdtransforms )

## Not run:  # quick visualization fix for images with odd orientation
# mni = antsImageRead( getANTsRData( "mni" ) )
# strokt1=antsImageRead('strokt1.nii.gz')
# strokt1reg=antsRegistration(
#   fixed=mni,
#   moving=strokt1,
#   typeofTransform = "QuickRigid",verbose=TRUE )
#  plot(  strokt1reg$warpedmovout, axis=3, nslices=20)
# # now - how to use a mask
# fi <- antsImageRead(getANTsRData("r16") )
# fiseg = kmeansSegmentation( fi, 3 )
# mi <- antsImageRead(getANTsRData("r64") )
# msk = thresholdImage(fiseg$segmentation, 0, 0 )
# mytx <- antsRegistration(fixed=fi, moving=mi, typeofTransform = c('SyNCC'),
#   mask=msk, verbose=F )
# jac = createJacobianDeterminantImage( fi, mytx$fwdtransforms[1] )
# ## End(Not run)

Run the code above in your browser using DataLab