nighres.registration.embedded_antsreg_2d(source_image, target_image, run_rigid=False, rigid_iterations=1000, run_affine=False, affine_iterations=1000, run_syn=True, coarse_iterations=40, medium_iterations=50, fine_iterations=40, scaling_factor=32, cost_function='MutualInformation', interpolation='NearestNeighbor', regularization='High', convergence=1e-06, mask_zero=False, ignore_affine=False, ignore_header=False, save_data=False, overwrite=False, output_dir=None, file_name=None)[source]

Embedded ANTS Registration 2D

Runs the rigid and/or Symmetric Normalization (SyN) algorithm of ANTs and formats the output deformations into voxel coordinate mappings as used in CBSTools registration and transformation routines.

  • source_image (niimg) – Image to register
  • target_image (niimg) – Reference image to match
  • run_rigid (bool) – Whether or not to run a rigid registration first (default is False)
  • rigid_iterations (float) – Number of iterations in the rigid step (default is 1000)
  • run_affine (bool) – Whether or not to run a affine registration first (default is False)
  • affine_iterations (float) – Number of iterations in the affine step (default is 1000)
  • run_syn (bool) – Whether or not to run a SyN registration (default is True)
  • coarse_iterations (float) – Number of iterations at the coarse level (default is 40)
  • medium_iterations (float) – Number of iterations at the medium level (default is 50)
  • fine_iterations (float) – Number of iterations at the fine level (default is 40)
  • cost_function ({'CrossCorrelation', 'MutualInformation'}) – Cost function for the registration (default is ‘MutualInformation’)
  • interpolation ({'NearestNeighbor', 'Linear'}) – Interpolation for the registration result (default is ‘NearestNeighbor’)
  • convergence (flaot) – Threshold for convergence, can make the algorithm very slow (default is convergence)
  • ignore_affine (bool) – Ignore the affine matrix information extracted from the image header (default is False)
  • ignore_header (bool) – Ignore the orientation information and affine matrix information extracted from the image header (default is False)
  • save_data (bool) – Save output data to file (default is False)
  • overwrite (bool) – Overwrite existing results (default is False)
  • output_dir (str, optional) – Path to desired output directory, will be created if it doesn’t exist
  • file_name (str, optional) – Desired base name for output files with file extension (suffixes will be added)

Dictionary collecting outputs under the following keys (suffix of output files in brackets)

  • transformed_source (niimg): Deformed source image (_ants-def)
  • mapping (niimg): Coordinate mapping from source to target (_ants-map)
  • inverse (niimg): Inverse coordinate mapping from target to source (_ants-invmap)

Return type:



Port of the CBSTools Java module by Pierre-Louis Bazin. The main algorithm is part of the ANTs software by Brian Avants and colleagues [1]. Parameters have been set to values commonly found in neuroimaging scripts online, but not necessarily optimal.


[1]Avants et al (2008), Symmetric diffeomorphic image registration with cross-correlation: evaluating automated labeling of elderly and neurodegenerative brain, Med Image Anal. 12(1):26-41