Repository revision
3:711adedc5bb8

Repository 'imagej2_bunwarpj_align'
hg clone https://toolshed.g2.bx.psu.edu/repos/imgteam/imagej2_bunwarpj_align

Align two images tool metadata
Miscellaneous
with ImageJ2
imagej2_bunwarpj_align
toolshed.g2.bx.psu.edu/repos/imgteam/imagej2_bunwarpj_align/imagej2_bunwarpj_align/20240614+galaxy0
20240614+galaxy0
None
True
Version lineage of this tool (guids ordered most recent to oldest)
toolshed.g2.bx.psu.edu/repos/imgteam/imagej2_bunwarpj_align/imagej2_bunwarpj_align/20240614+galaxy0 (this tool)
toolshed.g2.bx.psu.edu/repos/imgteam/imagej2_bunwarpj_align/imagej2_bunwarpj_align/3.0.1
toolshed.g2.bx.psu.edu/repos/imgteam/imagej2_bunwarpj_align/imagej2_bunwarpj_align/3.0.0
imagej2_bunwarpj_align
Requirements (dependencies defined in the <requirements> tag set)
name version type
fiji 20240614 package
grep 3.11 package
Additional information about this tool
#import os
#set error_log = 'output_log.txt'
touch '$error_log';

## ImageJ2 requires file extensions to be valid image data types.
#set source_out_suffix = '.' + str($source_out_datatype)
#set target_out_suffix = '.' + str($target_out_datatype)
#set source_image_sans_ext = $os.path.splitext($os.path.basename($source_image.file_name))[0]
#set source_image_with_ext = './' + '.'.join([$source_image_sans_ext, $source_image.ext])
ln -s '$source_image.file_name' '$source_image_with_ext';
#set target_image_sans_ext = $os.path.splitext($os.path.basename($target_image.file_name))[0]
#set target_image_with_ext = './' + '.'.join([$target_image_sans_ext, $target_image.ext])
ln -s '$target_image.file_name' '$target_image_with_ext';

#set save_transformation = str($advanced_options_cond.advanced_options) == 'save_transformation'
#set mono = str($advanced_options_cond.advanced_options) == 'mono'
#set landmarks = str($advanced_options_cond.advanced_options) == 'landmarks'
#set affine = str($advanced_options_cond.advanced_options) == 'affine'

#if str($align_with_mask_cond.align_with_mask) == 'yes':
    #set source_mask_sans_ext = $os.path.splitext($os.path.basename($align_with_mask_cond.source_mask.file_name))[0]
    #set source_mask_with_ext =  './' + '.'.join([$source_mask_sans_ext, $source_mask.ext])
    #set source_mask = $source_mask_with_ext
    ln -s '$align_with_mask_cond.source_mask.file_name' '$source_mask_with_ext';
    #set target_mask_sans_ext = $os.path.splitext($os.path.basename($align_with_mask_cond.target_mask.file_name))[0]
    #set target_mask_with_ext =  './' + '.'.join([$target_mask_sans_ext, $target_mask.ext])
    #set target_mask = $target_mask_with_ext
    ln -s '$align_with_mask_cond.target_mask.file_name' '$target_mask_with_ext';
#else:
    #set source_mask = 'NULL'
    #set target_mask = 'NULL'
#end if

#if not $mono:
    #set tmp_target_out = 'tmp_target_out' + $target_out_suffix
    touch '$tmp_target_out';

    ## bUnwarpJ automatically names the transformation files based
    ## on the names of the source and target image file names.
    #set tmp_target_out_transf_name_sans_ext = $os.path.splitext($target_out.file_name)[0]
    #set tmp_target_out_transf_name = $tmp_target_out_transf_name_sans_ext + '_transf.txt'
    touch '$tmp_target_out_transf_name';
#end if
#set tmp_source_out = 'tmp_source_out' + $source_out_suffix
touch '$tmp_source_out';

## bUnwarpJ automatically names the transformation files based
## on the names of the source and target image file names.
#set tmp_source_out_transf_name_sans_ext = $os.path.splitext($source_out.file_name)[0]
#set tmp_source_out_transf_name = $tmp_source_out_transf_name_sans_ext + '_transf.txt'
touch '$tmp_source_out_transf_name';

## Align the two images using bUnwarpJ.
## The option -XX:ActiveProcessorCount="1" was set in version 20231211 to ensure reproducibility
bunwarpj -XX:ActiveProcessorCount="1" -align
'$target_image_with_ext'
'$target_mask'
'$source_image_with_ext'
'$source_mask'
$min_scale_def
$max_scale_def
$max_subsamp_fact
$divergence_weight
$curl_weight
$image_weight
$consistency_weight
'$source_out'
#if not $mono:
    '$target_out'
#end if
#if $landmarks:
    '-landmarks'
    $advanced_options_cond.landmarks_weight
    '$landmarks_file'
#end if
#if $affine:
    '-affine'
    '$advanced_options_cond.target_affine_file'
    '$advanced_options_cond.source_affine_file'
#end if
#if $mono:
    '-mono'
#end if
#if $save_transformation:
    '-save_transformation'
#end if
#if $save_transformation:
    && mv '$tmp_source_out_transf_name' '$source_trans_out'
    && mv '$tmp_target_out_transf_name' '$target_trans_out';
#end if
None
False
Functional tests
name inputs outputs required files
Test-1 target_image: dotblot.jpg
source_image: blobs.gif
max_subsamp_fact: 1
name: value
name: value
dotblot.jpg
blobs.gif
value
Test-2 target_image: dotblot.jpg
source_image: blobs.gif
max_subsamp_fact: 1
advanced_options_cond|advanced_options: save_transformation
name: value
name: value
name: value
name: value
dotblot.jpg
blobs.gif
value
Test-3 target_image: dotblot.jpg
source_image: blobs.gif
align_with_mask_cond|target_mask: mask_white.png
align_with_mask_cond|source_mask: mask_ramp.gif
align_with_mask_cond|align_with_mask: yes
max_subsamp_fact: 1
name: value
name: value
dotblot.jpg
blobs.gif
mask_white.png
mask_ramp.gif
value