bm_experiments.bm_DROP 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 executable according your operation system,

  2. Copy/extract executables and libraries to you favourite destination

  3. Install all missing libraries such as QT4 with OpenGL support

  4. Test calling the executable ./dropreg2d which should return something like:

    Usage: dropreg2d <source> <target> <result> <paramfile> [mask]


To see the explanation of particular parameters see the User Manual

Sample run:

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


experiments was tested on Ubuntu (Linux) based OS system


to check whether you have all needed libraries on Linux use ldd dropreg2d, see: AND set path to the as export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib, see: ;


This method is not optimized nor suitable for large images, so all used images are first scaled to be 2000x2000 pixels and then the registration is performed. After registration is resulting image scaled back. The landmarks are scalded accordingly.

Glocker, Ben, et al. “Deformable medical image registration: setting the state of the art

with discrete methods.” Annual review of biomedical engineering 13 (2011): 219-244.

Copyright (C) 2017-2019 Jiri Borovec <>

class bm_experiments.bm_DROP.BmDROP(params)[source]

Bases: birl.benchmark.ImRegBenchmark

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

For the app installation details, see module details.


DROP requires gray scale images in MHD format where pixel values are in range (0, 255) of uint8.


>>> 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': 'dropreg2d',
...           'path_config': os.path.join(update_path('configs'), 'DROP.txt')}
>>> benchmark = BmDROP(params)
>>> import shutil
>>> shutil.rmtree(path_out, ignore_errors=True)

initialise benchmark


params (dict) – parameters

_clear_after_registration(item, patterns=('output*', '*.mhd', '*.raw'))[source]

clean unnecessarily files after the registration

  • item (dict) – dictionary with registration information

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

Return dict

the same or updated registration info


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


item (dict) – dictionary with registration params

Return str|list(str)

the execution commands


Prepare the experiment folder.


converting the input images to gra-scale and MHD format


item (dict) – dictionary with registration params

Return dict

the same or updated registration info

static extend_parse(arg_parser)[source]

extent the basic arg parses by some extra required parameters

Return object

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

given pair of deformation fields and landmark positions get shift

  • 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

COL_TIME_CONVERT = 'conversion time [s]'[source]

time need for image conversion and optional scaling

MAX_IMAGE_DIAGONAL = 2828[source]

maximal image size (diagonal in pixels) recommended for DROP registration

REQUIRED_PARAMS = ['path_out', 'path_table', 'exec_DROP', 'path_config'][source]

required experiment parameters