bm_experiments.bm_rNiftyReg module¶
Benchmark for R package - RNiftyReg LINKS: * http://cran.r-project.org/web/packages/RNiftyReg/RNiftyReg.pdf * https://github.com/jonclayden/RNiftyReg
Installation¶
Install the R environment (https://stackoverflow.com/questions/31114991):
apt install r-base-core r-base-dev sudo apt-get -y install libcurl4-gnutls-dev libxml2-dev libssl-dev
Run R and install required R packages:
install.packages(c("png", "jpeg", "OpenImageR", "devtools")) devtools::install_github("jonclayden/RNiftyReg")
Usage¶
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/bm_rNiftyReg.py -t ./data-images/pairs-imgs-lnds_histol.csv -d ./data-images -o ./results -R Rscript -script ./scripts/Rscript/RNiftyReg_linear.r
Note
tested for RNiftyReg > 2.x
Copyright (C) 2017-2019 Jiri Borovec <jiri.borovec@fel.cvut.cz>
- 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.
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('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) >>> 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 :param dict item: 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