bm_experiments.bm_DROP2 module

Benchmark for DROP.

DROP is a approach for image registration and motion estimation based on Markov Random Fields.

Related Publication:

  1. Deformable Medical Image Registration: Setting the State of the Art with Discrete Methods

    Authors: Ben Glocker, Aristeidis Sotiras, Nikos Komodakis, Nikos Paragios Published in: Annual Review of Biomedical Engineering, Vol. 12, 2011, pp. 219-244

Installation for Linux

  1. Download source code: https://github.com/biomedia-mira/drop2

  2. Install all required libraries such as ITK, and build following the instructions

    OR run building script build.sh included in the repository

  3. Test calling the executable ./build/drop/apps/dropreg/dropreg which should return something like:

    Usage: dropreg --help
    

Usage

Sample run of DROP2:

./dropreg --mode2d
    -s S1.jpg -t HE.jpg -o S1_to_HE.png
    -l --ltype 0 --lsim 1 --llevels 32 32 32 16 16 16 --lsampling 0.2
    -n --nffd 1000 --nsim 1 --nlevels 16 16 16 8 8 8 --nlambda 0.5 --npin

Sample run:

mkdir ./results
python bm_experiments/bm_DROP2.py         -t ./data-images/pairs-imgs-lnds_histol.csv         -d ./data-images         -o ./results         -DROP $HOME/Applications/DROP2/dropreg         --path_config ./configs/DROP2.txt         --visual --unique

Note

experiments was tested on Ubuntu (Linux) based OS system

Copyright (C) 2017-2019 Jiri Borovec <jiri.borovec@fel.cvut.cz>

class bm_experiments.bm_DROP2.BmDROP2(params)[source]

Bases: bm_experiments.bm_DROP.BmDROP

Benchmark for DROP2 no run test while this method requires manual installation of DROP2

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')
>>> 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,
...           'visual': True,
...           'exec_DROP': 'dropreg',
...           'path_config': os.path.join(update_path('configs'), 'DROP2.txt')}
>>> benchmark = BmDROP2(params)
>>> benchmark.run()  
>>> import shutil
>>> shutil.rmtree(path_out, ignore_errors=True)

initialise benchmark

Parameters

params (dict) – parameters

_clear_after_registration(item, patterns=('output*', '*.nii.gz'))[source]

clean unnecessarily files after the registration

Parameters
  • item (dict) – dictionary with registration information

  • patterns (list(str)) – string patterns of file names

Return dict

the same or updated registration info

_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

Parameters

item (dict) – dictionary with registration params

Return str|list(str)

the execution commands

_prepare_img_registration(item)[source]

converting the input images to gra-scale and MHD format

Parameters

item (dict) – dictionary with registration params

Return dict

the same or updated registration info

static extract_landmarks_shift_from_nifty(path_deform_x, path_deform_y, lnds)[source]

given pair of deformation fields and landmark positions get shift

Parameters
  • path_deform_x (str) – path to deformation field in X axis

  • path_deform_y (str) – path to deformation field in Y axis

  • lnds (ndarray) – landmarks

Return ndarray

shift for each landmarks

COMMAND_REGISTER = '%(dropRegistration)s         --mode2d         --source %(source)s         --target %(target)s         --output %(output)s.jpeg         %(config)s'[source]

command for executing the image registration