bm_experiments.bm_bUnwarpJ module

Benchmark for ImageJ plugin - bUnwarpJ

Installation

  1. Enter the application folder in this project:

    cd <BIRL>/applications
    
  2. Download Fiji - https://fiji.sc/

    wget https://downloads.imagej.net/fiji/latest/fiji-linux64.zip
    
  3. Extract the downloaded application:

    unzip fiji-linux64.zip
    
  4. Try to run Fiji:

    Fiji.app/ImageJ-linux64
    

Usage

Run the basic bUnwarpJ registration with original parameters:

python bm_experiments/bm_bUnwarpJ.py         -t ./data-images/pairs-imgs-lnds_histol.csv         -d ./data-images         -o ./results         -Fiji $HOME/Applications/Fiji.app/ImageJ-linux64         -cfg ./configs/ImageJ_bUnwarpJ_histol.yaml         --visual --unique

The bUnwarpJ is supporting SIFT and MOPS feature extraction as landmarks see: http://imagej.net/BUnwarpJ#SIFT_and_MOPS_plugin_support

python bm_experiments/bm_bUnwarpJ.py         -t ./data-images/pairs-imgs-lnds_histol.csv         -d ./data-images         -o ./results         -Fiji $HOME/Applications/Fiji.app/ImageJ-linux64         -cfg ./configs/ImageJ_bUnwarpJ-SIFT_histol.yaml         --visual --unique

Note

tested for version ImageJ 1.52i & 2.35

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

class bm_experiments.bm_bUnwarpJ.BmUnwarpJ(params)[source]

Bases: birl.benchmark.ImRegBenchmark

Benchmark for ImageJ plugin - bUnwarpJ no run test while this method requires manual installation of ImageJ

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('configs'), n)
>>> path_csv = os.path.join(update_path('data-images'), 'pairs-imgs-lnds_mix.csv')
>>> params = {'path_table': path_csv,
...           'path_out': path_out,
...           'exec_Fiji': 'ImageJ-linux64',
...           'nb_workers': 2,
...           'unique': False,
...           'path_config': fn_path_conf('ImageJ_bUnwarpJ_histol.yaml')}
>>> benchmark = BmUnwarpJ(params)
>>> benchmark.run()  
>>> params['path_config'] = fn_path_conf('ImageJ_bUnwarpJ-SIFT_histol.yaml')
>>> benchmark = BmUnwarpJ(params)
>>> benchmark.run()  
>>> shutil.rmtree(path_out, ignore_errors=True)

initialise benchmark

Parameters

params (dict) – parameters

_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

_prepare()[source]

prepare Benchmark - copy configurations

static extend_parse(arg_parser)[source]

extent the basic arg parses by some extra required parameters

Return object

COMMAND_REGISTRATION = '%(exec_Fiji)s --headless %(path_bsh)s %(source)s %(target)s %(params)s %(output)s/transform-direct.txt %(output)s/transform-inverse.txt'[source]

command for executing the image registration

COMMAND_WARP_LANDMARKS = '%(exec_Fiji)s --headless %(path_bsh)s %(source)s %(target)s %(output)s/source_landmarks.pts %(output)s/warped_source_landmarks.pts %(transf-inv)s %(transf-dir)s %(warp)s'[source]

command for executing the warping image and landmarks

DEFAULT_PARAMS = {'SIFT': {'fdBins': 8, 'fdSize': 8, 'initialSigma': 1.6, 'maxEpsilon': 25, 'maxOctaveSize': 1024, 'minInlierRatio': 0.05, 'minOctaveSize': 64, 'modelIndex': 1, 'rod': 0.92, 'steps': 3}, 'bUnwarpJ': {'consistencyWeight': 10.0, 'curlWeight': 0.1, 'divWeight': 0.1, 'imageWeight': 1.0, 'landmarkWeight': 0.0, 'maxScale': 3, 'minScale': 0, 'mode': 1, 'stopThreshold': 0.01, 'subsampleFactor': 0}}[source]

default bUnwarpJ and SIFT parameters

NAME_LANDMARKS = 'source_landmarks.pts'[source]

internal name of converted landmarks for tranf. script

NAME_LANDMARKS_WARPED = 'warped_source_landmarks.pts'[source]

name of warped moving landmarks by tranf. script

NAME_TRANSF_DIRECT = 'transform-direct.txt'[source]

resulting direct transformation

NAME_TRANSF_INVERSE = 'transform-inverse.txt'[source]

resulting inverse transformation

PATH_IJ_SCRIPTS = '/home/docs/checkouts/readthedocs.org/user_builds/birl/checkouts/latest/scripts/ImageJ'[source]

path to IJ scripts

PATH_SCRIPT_REGISTRATION_BASE = '/home/docs/checkouts/readthedocs.org/user_builds/birl/checkouts/latest/scripts/ImageJ/apply-bUnwarpJ-registration.bsh'[source]

path/name of image registration script

PATH_SCRIPT_REGISTRATION_SIFT = '/home/docs/checkouts/readthedocs.org/user_builds/birl/checkouts/latest/scripts/ImageJ/apply-SIFT-bUnwarpJ-registration.bsh'[source]

path/name of image registration script with features

PATH_SCRIPT_WARP_LANDMARKS = '/home/docs/checkouts/readthedocs.org/user_builds/birl/checkouts/latest/scripts/ImageJ/apply-bUnwarpJ-transform.bsh'[source]

path/name of image/landmarks warping script

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

required experiment parameters

REQUIRED_PARAMS_BUNWARPJ = ('mode', 'subsampleFactor', 'minScale', 'maxScale', 'divWeight', 'curlWeight', 'landmarkWeight', 'imageWeight', 'consistencyWeight', 'stopThreshold')[source]

required parameters in the configuration file for bUnwarpJ

REQUIRED_PARAMS_SIFT = ('initialSigma', 'steps', 'minOctaveSize', 'maxOctaveSize', 'fdSize', 'fdBins', 'rod', 'maxEpsilon', 'minInlierRatio', 'modelIndex')[source]

required parameters in the configuration file for SIFT features