Learn R Programming

ANTsR (version 1.0)

antsRegistration: A simplified (or full) interface to antsRegistration.

Description

Register a pair of images either through the full or simplified interface. Uses file I/O to manage images / transformations.

Usage

antsRegistration( fixed , moving , typeofTransform = c("Rigid","Affine","SyN"),  outprefix="./antsRegOut")

Arguments

fixed

fixed image to which we register the moving image.

movingImage

moving image to be mapped to fixed space.

typeofTransform

Either a one stage rigid/affine mapping or a 2-stage affine+syn mapping. Mutual information metric by default.

outprefix

output will be named with this prefix.

Value

outputs a list containing warped images and transforms. 1 -- Failure

Details

typeofTransform can be one of:

  • "Rigid": Rigid transformation: Only rotation and translation.

  • "Affine": Affine transformation: Rigid + scaling.

  • "AffineFast": Fast version of Affine.

  • "SyN": Symmetric normalization: Affine + deformable transformation, with mutual information as optimization metric.

  • "SyNCC": SyN, but with cross-correlation as the metric.

  • "SynBOLD": SyN, but optimized for registrations between BOLD and T1 images.

  • "SyNAggro": SyN, but with more aggressive registration (fine-scale matching and more deformation). Takes more time than SyN.

Examples

Run this code
# NOT RUN {
# will give the full form of help
antsRegistration( "-h")
# example 1 - simplified, uses antsImages for I/O
antsRegOut<-antsRegistration(fixed=img1,moving=img2,typeofTransform="Affine",outprefix="./test")
# example 2
  fi<-antsImageRead( getANTsRData('r16') ,2)
  mi<-antsImageRead( getANTsRData('r64') ,2)
  mytx<-antsRegistration(fixed=fi , moving=mi , typeofTransform = c("SyN"), outprefix=paste(tempdir(),"/Z",sep=''))
  mywarpedimage<-antsApplyTransforms(fixed=fi,moving=mi,transformlist=mytx$fwdtransforms)
  par(mfrow=c(1,2))
  plotANTsImage(fi) 
  plotANTsImage(mywarpedimage) 
# example 3 - full access, only uses file-based I/O 
  antsRegistration( list( d=2,m="mi[r16slice.nii.gz,r64slice.nii.gz,1,20,Regular,0.05]", t="affine[1.0]", c="2100x1200x1200x0",  s="3x2x1x0", f="4x3x2x1", u="1", o="[xtest,xtest.nii.gz,xtest_inv.nii.gz]" ) )
# }

Run the code above in your browser using DataLab