bm_experiments.bm_rNiftyReg module

Benchmark for R package - RNiftyReg LINKS: * *


  1. Install the R environment (

    apt install r-base-core r-base-dev
    sudo apt-get -y install libcurl4-gnutls-dev libxml2-dev libssl-dev
  2. Run R and install required R packages:

    install.packages(c("png", "jpeg", "OpenImageR", "devtools"))


Run the basic R script:

Rscript scripts/Rscript/RNiftyReg_linear.r         data-images/rat-kidney_/scale-5pc/Rat-Kidney_HE.jpg         data-images/rat-kidney_/scale-5pc/Rat-Kidney_PanCytokeratin.jpg         data-images/rat-kidney_/scale-5pc/Rat-Kidney_HE.csv         output/

Run the RNiftyReg benchmark:

python bm_experiments/         -t ./data-images/pairs-imgs-lnds_histol.csv         -d ./data-images         -o ./results         -R Rscript         -script ./scripts/Rscript/RNiftyReg_linear.r


tested for RNiftyReg > 2.x

Copyright (C) 2017-2019 Jiri Borovec <>

class bm_experiments.bm_rNiftyReg.BmRNiftyReg(params)[source]

Bases: birl.benchmark.ImRegBenchmark

Benchmark for R package - RNiftyReg no run test while this method requires manual installation of RNiftyReg

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('scripts'), 'Rscript', n)
>>> path_csv = os.path.join(update_path('data-images'), 'pairs-imgs-lnds_mix.csv')
>>> params = {'path_out': path_out,
...           'path_table': path_csv,
...           'nb_workers': 2,
...           'unique': False,
...           'exec_R': 'Rscript',
...           'path_R_script': fn_path_conf('RNiftyReg_linear.r')}
>>> benchmark = BmRNiftyReg(params)
>>> shutil.rmtree(path_out, ignore_errors=True)

initialise benchmark


params (dict) – parameters


if needed update the execution time :param dict item: 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 the experiment folder.

static extend_parse(arg_parser)[source]

extent the basic arg parses by some extra required parameters

Return object

NAME_FILE_IMAGE = 'warped.jpg'[source]

file with warped image after performed registration

NAME_FILE_LANDMARKS = 'points.pts'[source]

file with warped landmarks after performed registration

NAME_FILE_TIME = 'time.txt'[source]

file with exported image registration time

REQUIRED_PARAMS = ['path_out', 'path_table', 'exec_R', 'path_R_script'][source]

required experiment parameters