bm_experiments.bm_DROP module¶
Benchmark for DROP.
DROP is a approach for image registration and motion estimation based on Markov Random Fields.
See also
Related Publication:
- 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
- Download executable according your operation system,
Copy/extract executables and libraries to you favourite destination
Install all missing libraries such as QT4 with OpenGL support
Test calling the executable ./dropreg2d which should return something like:
Usage: dropreg2d <source> <target> <result> <paramfile> [mask]
Usage¶
- To see the explanation of particular parameters see the User Manual
http://www.mrf-registration.net/download/drop_user_guide_V1.05.pdf
Sample run:
mkdir ./results
python bm_experiments/bm_DROP.py -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
Note
experiments was tested on Ubuntu (Linux) based OS system
Note
to check whether you have all needed libraries on Linux use ldd dropreg2d, see: https://askubuntu.com/a/709271/863070 AND set path to the libdroplib.so as export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib, see: https://unix.stackexchange.com/a/67783 ; https://stackoverflow.com/a/49660575/4521646
Note
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. https://pdfs.semanticscholar.org/0c5f/277d357e3667b18b5420fd660f221c935fcc.pdf
Copyright (C) 2017-2019 Jiri Borovec <jiri.borovec@fel.cvut.cz>
- 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.
Note
DROP requires gray scale images in MHD format where pixel values are in range (0, 255) of uint8.
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': 'dropreg2d', ... 'path_config': os.path.join(update_path('configs'), 'DROP.txt')} >>> benchmark = BmDROP(params) >>> benchmark.run() >>> import shutil >>> shutil.rmtree(path_out, ignore_errors=True)
initialise benchmark
- Parameters
params (dict) – parameters
- _clear_after_registration(item, patterns=('output*', '*.mhd', '*.raw'))[source]¶
clean unnecessarily files after the registration
- _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 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
- COL_TIME_CONVERT = 'conversion time [s]'[source]¶
time need for image conversion and optional scaling