Child pages
  • Atlas to Atlas Registration with ANTS (intra or inter modality)
Skip to end of metadata
Go to start of metadata
March 7, 2019: mincANTS is now simply referred to as ANTS.


This page provides parameters for ANTS that could give a reasonable transformation between two atlases.

Mutual Information (MI) is generally used for inter-modality registrations and cross correlation (CC) is used for intra modality registrations. If you have two MRI atlases that have different contrast in just one or two structures, it is faster to segment those structures and then run the registration with CC.

Ex-vivo atlas to in-vivo atlas (both MRI)

Here the assumption is that you want to register an ex-vivo atlas to an in-vivo atlas in order to obtain labels for the in-vivo atlas. In this example:

  • invivo-atlas.mnc (minc file for the in-vivo atlas)
  • exvivo-atlas.mnc (minc file for the ex-vivo atlas)
  • 125 micron (resolution of the in-vivo data)

Manual lsq6

Start with a manual lsq6 alignment using register. The first argument to register is the target, the second the source. Your command would look like this:

> register invivo-atlas.mnc exvivo-atlas.mnc

Place anywhere between 4 to about 8 tag points, and save the transform. Apply to the exvivo-atlas.mnc file

> mincresample -like invivo-atlas.mnc -transformation lsq6_trans_from_register.xfm exvivo-atlas.mnc exvivo-atlas_lsq6.mnc

Non-linear ANTS call

Create the gradient magnitude files necessary for ANTS

> mincblur -fwhm 0.125 -gradient exvivo-atlas_lsq6.mnc exvivo-atlas_lsq6_fwhm_0.125
> mincblur -fwhm 0.125 -gradient invivo-atlas.mnc invivo-atlas_fwhm_0.125

Then run the ANTS call

If you have a mask, you can add the following flag to the ANTS call to include the mask:

-x mask.mnc

And keep in mind that this example deals with 125 micron files. Change the gradient blurring kernel with respect to the resolution of your input files!

> ANTS 3 \
-m CC[exvivo-atlas_lsq6.mnc,invivo-atlas.mnc,1,4] \
-m CC[exvivo-atlas_lsq6_fwhm_0.125_dxyz.mnc,invivo-atlas_fwhm_0.125_dxyz.mnc,1,4] \
-o ANTS_trans_from_exvivo_to_invivo_SyN_0.4_Gauss_4_1_radius_4.xfm \
-i 100x100x100x100 \
-t SyN[0.4] \
-r Gauss[4,1] \
--number-of-affine-iterations 0

Alternatively you can run the command with slightly different settings for the SyN and Gauss parameters (this allows for less deformation):

> ANTS 3 \
-m CC[exvivo-atlas_lsq6.mnc,invivo-atlas.mnc,1,3] \
-m CC[exvivo-atlas_lsq6_fwhm_0.125_dxyz.mnc,invivo-atlas_fwhm_0.125_dxyz.mnc,1,3] \
-o ANTS_trans_from_exvivo_to_invivo_SyN_0.1_Gauss_2_1.xfm \
-i 100x100x100x100 \
-t SyN[0.1] \
-r Gauss[2,1] \
--number-of-affine-iterations 0

Or try it with Mutual Information:

> ANTS 3 \
-m MI[exvivo-atlas_lsq6.mnc,invivo-atlas.mnc,1,32] \
-m CC[exvivo-atlas_lsq6_fwhm_0.125_dxyz.mnc,invivo-atlas_fwhm_0.125_dxyz.mnc,1,3] \
-o ANTS_trans_from_exvivo_to_invivo_MI_SyN_0.1_Gauss_3_1.xfm \
-i 100x100x100x100 \
-t SyN[0.1] \
-r Gauss[3,1] \ 
--number-of-affine-iterations 0

Example script for ANTS registration

Here is a simple bash script that parses command line arguments to register two minc files and outputs an XFM.

#!/bin/bash

# usage
# save this file: example 'reg_scr.sh'
# mark it as executable: 
#  > chmod +x reg_scr.sh
# To register a file (source.mnc) to another file (target.mnc) and save the transform (source_to_target.xfm)
#  > ./reg_scr.sh source.mnc target.mnc source_to_target.xfm

parse_arr=( "$@" )

srcfl=${parse_arr[0]}
tgtfl=${parse_arr[1]}
xfmfl=${parse_arr[2]}

srcblur='source_blur.mnc'
srcdxyz='source_dxyz.mnc'

tgtblur='target_blur.mnc'
tgtdxyz='target_dxyz.mnc'

mincblur -fwhm 0.09 -gradient ${srcfl} 'source'
mincblur -fwhm 0.09 -gradient ${tgtfl} 'target'

ANTS 3 \
    -m CC[${srcfl},${tgtfl},1,4] \
    -m CC[${srcdxyz},${tgtdxyz},1,4] \
    -o ${xfmfl} \
    -i 100x100x100x100 \
    -t SyN[0.4] \
    -r Gauss[4,1] \
    --number-of-affine-iterations 0

rm ${srcblur} ${srcdxyz} ${tgtblur} ${tgtdxyz}

To see if it worked successfully

Use mincresample -like target.mnc -transform source_to_target.xfm source.mnc source_transformed.mnc

Compare source_transformed.mnc and target.mnc and see if they overlap.