bm_experiments.bm_ANTsPy module

Benchmark for ANTs

See references:

Installation

  1. Install it as python package:

    pip install git+https://github.com/ANTsX/ANTsPy.git
    

Usage

Run the basic ANTs registration with original parameters:

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

Note

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 <jiri.borovec@fel.cvut.cz>

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.

Example

>>> 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)
>>> benchmark.run()  
>>> shutil.rmtree(path_out, ignore_errors=True)

initialise benchmark

Parameters

params (dict) – parameters

_extract_execution_time(item)[source]

if needed update the execution time

Parameters

item (dict) – dictionary with registration params

Return float|None

time in minutes

_extract_warped_image_landmarks(item)[source]

get registration results - warped registered images and landmarks

Parameters

item (dict) – dictionary with registration params

Return dict

paths to warped images/landmarks

_generate_regist_command(item)[source]

generate the registration command(s)

Parameters

item (dict) – dictionary with registration params

Return str|list(str)

the execution commands

_prepare()[source]

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