bm_experiments.bm_ANTsPy module

Benchmark for ANTs

See references:


  1. Install it as python package:

    pip install git+


Run the basic ANTs registration with original parameters:

python bm_experiments/         -t ./data-images/pairs-imgs-lnds_histol.csv         -d ./data-images         -o ./results         -py python3         -script ./scripts/Python/


required to use own compiled last version since some previous releases do not contain ants.apply_transforms_to_points

Copyright (C) 2017-2019 Jiri Borovec <>

class bm_experiments.bm_ANTsPy.BmANTsPy(params)[source]

Bases: birl.benchmark.ImRegBenchmark

Benchmark for ANTs wrapper in Python no run test while this method requires manual installation of ANTsPy package

For the app installation details, see module details.


>>> from birl.utilities.data_io import create_folder, update_path
>>> path_out = create_folder('temp_results')
>>> fn_path_conf = lambda n: os.path.join(update_path('configs'), n)
>>> path_csv = os.path.join(update_path('data-images'), 'pairs-imgs-lnds_mix.csv')
>>> params = {'path_table': path_csv,
...           'path_out': path_out,
...           'nb_workers': 2,
...           'unique': False,
...           'exec_Python': 'python',
...           'path_script': '.'}
>>> benchmark = BmANTsPy(params)
>>> shutil.rmtree(path_out, ignore_errors=True)

initialise benchmark


params (dict) – parameters


if needed update the execution time


item (dict) – dictionary with registration params

Return float|None

time in minutes


get registration results - warped registered images and landmarks


item (dict) – dictionary with registration params

Return dict

paths to warped images/landmarks


generate the registration command(s)


item (dict) – dictionary with registration params

Return str|list(str)

the execution commands


prepare BM - copy configurations

static extend_parse(arg_parser)[source]

extent the basic arg parses by some extra required parameters

Return object

NAME_IMAGE_WARPED = 'warped-image.jpg'[source]

file with exported image registration time

NAME_LNDS_WARPED = 'warped-landmarks.csv'[source]

file with warped landmarks after performed registration

NAME_TIME_EXEC = 'time.txt'[source]

file with warped image after performed registration

REQUIRED_PARAMS = ['path_out', 'path_table', 'exec_Python', 'path_script'][source]

required experiment parameters