comparison imagej2_bunwarpj_align.xml @ 3:711adedc5bb8 draft default tip

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit 8f49f3c66b5a1de99ec15e65c2519a56792f1d56
author imgteam
date Wed, 25 Sep 2024 15:56:56 +0000
parents 0a0d2dfd17e0
children
comparison
equal deleted inserted replaced
2:0a0d2dfd17e0 3:711adedc5bb8
1 <tool id="imagej2_bunwarpj_align" name="Align two images" version="@WRAPPER_VERSION@.1"> 1 <tool id="imagej2_bunwarpj_align" name="Align two images" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="23.0">
2 <description>with ImageJ2</description> 2 <description>with ImageJ2</description>
3 <macros> 3 <macros>
4 <import>imagej2_macros.xml</import> 4 <import>imagej2_macros.xml</import>
5 </macros> 5 </macros>
6 <edam_operations> 6 <edam_operations>
18 18
19 ## ImageJ2 requires file extensions to be valid image data types. 19 ## ImageJ2 requires file extensions to be valid image data types.
20 #set source_out_suffix = '.' + str($source_out_datatype) 20 #set source_out_suffix = '.' + str($source_out_datatype)
21 #set target_out_suffix = '.' + str($target_out_datatype) 21 #set target_out_suffix = '.' + str($target_out_datatype)
22 #set source_image_sans_ext = $os.path.splitext($os.path.basename($source_image.file_name))[0] 22 #set source_image_sans_ext = $os.path.splitext($os.path.basename($source_image.file_name))[0]
23 #set source_image_with_ext = '.'.join([$source_image_sans_ext, $source_image.ext]) 23 #set source_image_with_ext = './' + '.'.join([$source_image_sans_ext, $source_image.ext])
24 ln -s '$source_image.file_name' '$source_image_with_ext'; 24 ln -s '$source_image.file_name' '$source_image_with_ext';
25 #set target_image_sans_ext = $os.path.splitext($os.path.basename($target_image.file_name))[0] 25 #set target_image_sans_ext = $os.path.splitext($os.path.basename($target_image.file_name))[0]
26 #set target_image_with_ext = '.'.join([$target_image_sans_ext, $target_image.ext]) 26 #set target_image_with_ext = './' + '.'.join([$target_image_sans_ext, $target_image.ext])
27 ln -s '$target_image.file_name' '$target_image_with_ext'; 27 ln -s '$target_image.file_name' '$target_image_with_ext';
28 28
29 #set save_transformation = str($advanced_options_cond.advanced_options) == 'save_transformation' 29 #set save_transformation = str($advanced_options_cond.advanced_options) == 'save_transformation'
30 #set mono = str($advanced_options_cond.advanced_options) == 'mono' 30 #set mono = str($advanced_options_cond.advanced_options) == 'mono'
31 #set landmarks = str($advanced_options_cond.advanced_options) == 'landmarks' 31 #set landmarks = str($advanced_options_cond.advanced_options) == 'landmarks'
32 #set affine = str($advanced_options_cond.advanced_options) == 'affine' 32 #set affine = str($advanced_options_cond.advanced_options) == 'affine'
33 33
34 #if str($align_with_mask_cond.align_with_mask) == 'yes': 34 #if str($align_with_mask_cond.align_with_mask) == 'yes':
35 #set source_mask_sans_ext = $os.path.splitext($os.path.basename($align_with_mask_cond.source_mask.file_name))[0] 35 #set source_mask_sans_ext = $os.path.splitext($os.path.basename($align_with_mask_cond.source_mask.file_name))[0]
36 #set source_mask_with_ext = '.'.join([$source_mask_sans_ext, $source_mask.ext]) 36 #set source_mask_with_ext = './' + '.'.join([$source_mask_sans_ext, $source_mask.ext])
37 #set source_mask = $source_mask_with_ext 37 #set source_mask = $source_mask_with_ext
38 ln -s '$align_with_mask_cond.source_mask.file_name' '$source_mask_with_ext'; 38 ln -s '$align_with_mask_cond.source_mask.file_name' '$source_mask_with_ext';
39 #set target_mask_sans_ext = $os.path.splitext($os.path.basename($align_with_mask_cond.target_mask.file_name))[0] 39 #set target_mask_sans_ext = $os.path.splitext($os.path.basename($align_with_mask_cond.target_mask.file_name))[0]
40 #set target_mask_with_ext = '.'.join([$target_mask_sans_ext, $target_mask.ext]) 40 #set target_mask_with_ext = './' + '.'.join([$target_mask_sans_ext, $target_mask.ext])
41 #set target_mask = $target_mask_with_ext 41 #set target_mask = $target_mask_with_ext
42 ln -s '$align_with_mask_cond.target_mask.file_name' '$target_mask_with_ext'; 42 ln -s '$align_with_mask_cond.target_mask.file_name' '$target_mask_with_ext';
43 #else: 43 #else:
44 #set source_mask = 'NULL' 44 #set source_mask = 'NULL'
45 #set target_mask = 'NULL' 45 #set target_mask = 'NULL'
63 #set tmp_source_out_transf_name_sans_ext = $os.path.splitext($source_out.file_name)[0] 63 #set tmp_source_out_transf_name_sans_ext = $os.path.splitext($source_out.file_name)[0]
64 #set tmp_source_out_transf_name = $tmp_source_out_transf_name_sans_ext + '_transf.txt' 64 #set tmp_source_out_transf_name = $tmp_source_out_transf_name_sans_ext + '_transf.txt'
65 touch '$tmp_source_out_transf_name'; 65 touch '$tmp_source_out_transf_name';
66 66
67 ## Align the two images using bUnwarpJ. 67 ## Align the two images using bUnwarpJ.
68 bunwarpj -align 68 ## The option -XX:ActiveProcessorCount="1" was set in version 20231211 to ensure reproducibility
69 bunwarpj -XX:ActiveProcessorCount="1" -align
69 '$target_image_with_ext' 70 '$target_image_with_ext'
70 '$target_mask' 71 '$target_mask'
71 '$source_image_with_ext' 72 '$source_image_with_ext'
72 '$source_mask' 73 '$source_mask'
73 $min_scale_def 74 $min_scale_def
95 '-mono' 96 '-mono'
96 #end if 97 #end if
97 #if $save_transformation: 98 #if $save_transformation:
98 '-save_transformation' 99 '-save_transformation'
99 #end if 100 #end if
100 &>'$error_log';
101 #if $save_transformation: 101 #if $save_transformation:
102 mv '$tmp_source_out_transf_name' '$source_trans_out'; 102 && mv '$tmp_source_out_transf_name' '$source_trans_out'
103 mv '$tmp_target_out_transf_name' '$target_trans_out'; 103 && mv '$tmp_target_out_transf_name' '$target_trans_out';
104 #end if 104 #end if
105 if [[ $? -ne 0 ]]; then
106 cat '$error_log' >&2;
107 fi
108 ]]></command> 105 ]]></command>
109 <inputs> 106 <inputs>
110 <expand macro="param_target_image"/> 107 <expand macro="param_target_image"/>
111 <expand macro="param_source_image"/> 108 <expand macro="param_source_image"/>
112 <conditional name="align_with_mask_cond"> 109 <conditional name="align_with_mask_cond">
205 <data format="txt" name="target_trans_out" label="${tool.name} (target transf matrix) ${on_string}"> 202 <data format="txt" name="target_trans_out" label="${tool.name} (target transf matrix) ${on_string}">
206 <filter>advanced_options_cond['advanced_options'] == "save_transformation"</filter> 203 <filter>advanced_options_cond['advanced_options'] == "save_transformation"</filter>
207 </data> 204 </data>
208 </outputs> 205 </outputs>
209 <tests> 206 <tests>
210 <test> 207 <test expect_num_outputs="2">
211 <!-- Align two images without landmarks or mask and not saving transformation matrices --> 208 <!-- Align two images without landmarks or mask and not saving transformation matrices -->
212 <expand macro="test_target_source_images"/> 209 <expand macro="test_target_source_images"/>
213 <param name="max_subsamp_fact" value="1"/> 210 <param name="max_subsamp_fact" value="1"/>
214 <output name="source_out" file="registered_source1.png" compare="sim_size"/> 211 <output name="source_out" file="registered_source1_forced1cpu.png" compare="image_diff"/>
215 <output name="target_out" file="registered_target1.png" compare="sim_size"/> 212 <output name="target_out" file="registered_target1_forced1cpu.png" compare="image_diff"/>
216 </test> 213 </test>
217 <test> 214 <test expect_num_outputs="4">
218 <!-- Align two images without landmarks or mask, but saving transformation matrices --> 215 <!-- Align two images without landmarks or mask, but saving transformation matrices -->
219 <expand macro="test_target_source_images"/> 216 <expand macro="test_target_source_images"/>
220 <param name="max_subsamp_fact" value="1"/> 217 <param name="max_subsamp_fact" value="1"/>
221 <param name="advanced_options" value="save_transformation"/> 218 <param name="advanced_options" value="save_transformation"/>
222 <output name="source_out" file="registered_source1.png" compare="sim_size"/> 219 <output name="source_out" file="registered_source1_forced1cpu.png" compare="image_diff"/>
223 <output name="target_out" file="registered_target1.png" compare="sim_size"/> 220 <output name="target_out" file="registered_target1_forced1cpu.png" compare="image_diff"/>
224 <output name="source_trans_out" file="source_elastic_transformation_out.txt" compare="contains"/> 221 <output name="source_trans_out" file="source_elastic_transformation_out.txt" compare="contains"/>
225 <output name="target_trans_out" file="target_elastic_transformation_out.txt" compare="contains"/> 222 <output name="target_trans_out" file="target_elastic_transformation_out.txt" compare="contains"/>
226 </test> 223 </test>
227 <test> 224 <test expect_num_outputs="2">
228 <!-- Align two images without landmarks but with mask, not saving transformation matrices --> 225 <!-- Align two images without landmarks but with mask, not saving transformation matrices -->
229 <expand macro="test_target_source_images"/> 226 <expand macro="test_target_source_images"/>
230 <param name="align_with_mask" value="yes"/> 227 <param name="align_with_mask" value="yes"/>
231 <param name="target_mask" value="mask_white.png"/> 228 <param name="target_mask" value="mask_white.png"/>
232 <param name="source_mask" value="mask_ramp.gif"/> 229 <param name="source_mask" value="mask_ramp.gif"/>
233 <param name="max_subsamp_fact" value="1"/> 230 <param name="max_subsamp_fact" value="1"/>
234 <output name="source_out" file="registered_source2.png" compare="sim_size"/> 231 <output name="source_out" file="registered_source2_forced1cpu.png" compare="image_diff"/>
235 <output name="target_out" file="registered_target2.png" compare="sim_size"/> 232 <output name="target_out" file="registered_target2_forced1cpu.png" compare="image_diff"/>
236 </test> 233 </test>
237 </tests> 234 </tests>
238 <help> 235 <help>
239 **What it does** 236 **What it does**
240 237