comparison scale_image.xml @ 4:3179853faae9 draft

planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/scale_image/ commit c045f067a57e8308308cf6329060c7ccd3fc372f
author imgteam
date Thu, 04 Apr 2024 15:26:23 +0000
parents d09507d3fb0e
children 85666e555698
comparison
equal deleted inserted replaced
3:d09507d3fb0e 4:3179853faae9
1 <tool id="ip_scale_image" name="Scale image" version="0.4-2"> 1 <tool id="ip_scale_image" name="Scale image" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="20.05">
2 <description>with scikit-image</description> 2 <description>with scikit-image</description>
3 <macros>
4 <import>creators.xml</import>
5 <import>tests.xml</import>
6 <token name="@TOOL_VERSION@">0.18.3</token>
7 <token name="@VERSION_SUFFIX@">0</token>
8 </macros>
9 <creator>
10 <expand macro="creators/bmcv" />
11 </creator>
3 <edam_operations> 12 <edam_operations>
4 <edam_operation>operation_3443</edam_operation> 13 <edam_operation>operation_3443</edam_operation>
5 </edam_operations> 14 </edam_operations>
6 <xrefs> 15 <xrefs>
7 <xref type="bio.tools">scikit-image</xref> 16 <xref type="bio.tools">scikit-image</xref>
8 <xref type="biii">scikit-image</xref> 17 <xref type="biii">scikit-image</xref>
9 </xrefs> 18 </xrefs>
10 <requirements> 19 <requirements>
11 <requirement type="package" version="6.1.0">pillow</requirement> 20 <requirement type="package" version="@TOOL_VERSION@">scikit-image</requirement>
12 <requirement type="package" version="0.14.2">scikit-image</requirement> 21 <requirement type="package" version="10.0.1">pillow</requirement>
13 <requirement type="package" version="1.15.4">numpy</requirement> 22 <requirement type="package" version="1.24.4">numpy</requirement>
14 <requirement type="package" version="1.1.0">scipy</requirement> 23 <requirement type="package" version="2021.7.2">tifffile</requirement>
15 <requirement type="package" version="0.15.1">tifffile</requirement>
16 </requirements> 24 </requirements>
17 <command detect_errors="aggressive"> 25 <command detect_errors="aggressive"><![CDATA[
18 <![CDATA[
19 python '$__tool_directory__/scale_image.py' '$input' ./out.png
20 #if $use_scale_option.use_scale == 'true'
21 $use_scale_option.scale
22 #else if $use_scale_option.use_scale == 'false'
23 '[$use_scale_option.scale_x, $use_scale_option.scale_y]'
24 #end if
25 $order
26 26
27 ]]> 27 python '$__tool_directory__/scale_image.py' '$input'
28 </command> 28
29 ./output.${input.ext}
30
31 --scale '$scale'
32 --order $order
33 $antialias
34
35 && mv ./output.${input.ext} ./output
36
37 ]]></command>
29 <inputs> 38 <inputs>
30 <param name="input" type="data" format="png" label="Image file"/> 39 <param name="input" type="data" format="png" label="Image file"/>
31 <conditional name="use_scale_option"><!--a third option (using one integer as percentage scaling) could still be implemented--> 40 <param argument="--scale" type="text" value="1" label="Scaling factor" help="Use either a single scaling factor (uniform scaling), or a comma-separated list of scaling factors (anistropic scaling). For a 2-D single-channel or RGB image, the first scaling factor corresponds to the image width and the second corresponds to the image height. For images with 3 or more axes, the last axis is assumed to correspond to the image channels if uniform scaling is used (a single value)."/>
32 <param label="Lock scaling between image dimensions" name="use_scale" type="select"> 41 <param argument="--order" type="select" label="Interpolation method">
33 <option selected="true" value="true">Lock</option>
34 <option value="false">Individual scales</option>
35 </param>
36 <when value="true">
37 <param name="scale" type="float" value="1.0" label="Scaling factor" />
38 </when>
39 <when value="false">
40 <param name="scale_x" type="integer" value="100" label="New height of the image in pixels" />
41 <param name="scale_y" type="integer" value="100" label="New width of the image in pixels" />
42 </when>
43 </conditional>
44 <param name="order" type="select" label="Interpolation method">
45 <option value="0">Nearest-neighbor</option> 42 <option value="0">Nearest-neighbor</option>
46 <option value="1" selected="true">Bi-linear</option> 43 <option value="1" selected="true">Bi-linear</option>
47 <option value="2">Bi-cubic</option> 44 <option value="2">Bi-cubic</option>
48 </param> 45 </param>
46 <param name="antialias" type="boolean" truevalue="--antialias" falsevalue="" checked="true" label="Enable anti-aliasing" help="This should only be used for down-scaling."/>
49 </inputs> 47 </inputs>
50 <outputs> 48 <outputs>
51 <data format="png" name="output" from_work_dir="out.png"/> 49 <data name="output" from_work_dir="output" format_source="input" metadata_source="input"/>
52 </outputs> 50 </outputs>
53 <tests> 51 <tests>
52 <!-- Test PNG, without antialias -->
54 <test> 53 <test>
55 <param name="input" value="sample1.png"/> <!--continue here--> 54 <param name="input" value="input1_binary_rgb.png"/>
56 <conditional name="use_scale_option"> 55 <param name="scale" value="0.5"/>
57 <param name="use_scale" value="false"/> 56 <param name="antialias" value="false"/>
58 <param name="scale_x" value="200"/>
59 <param name="scale_y" value="150"/>
60 </conditional>
61 <param name="order" value="0"/> 57 <param name="order" value="0"/>
62 <output name="output" value="out2.png" ftype="png" compare="sim_size"/> 58 <expand macro="tests/binary_image_diff" name="output" value="uniform_binary.png" ftype="png"/>
59 </test>
60 <!-- Test PNG, uniform scaling -->
61 <test>
62 <param name="input" value="input1_binary_rgb.png"/>
63 <param name="scale" value="0.5"/>
64 <expand macro="tests/intensity_image_diff" name="output" value="uniform.png" ftype="png"/>
65 </test>
66 <!-- Test PNG, anistropic scaling -->
67 <test>
68 <param name="input" value="input1_binary_rgb.png"/>
69 <param name="scale" value="0.5, 0.8"/>
70 <expand macro="tests/intensity_image_diff" name="output" value="anisotropic.png" ftype="png"/>
71 </test>
72 <test>
73 <param name="input" value="input1_binary_rgb.png"/>
74 <param name="scale" value="0.5, 0.8, 1"/>
75 <expand macro="tests/intensity_image_diff" name="output" value="anisotropic.png" ftype="png"/>
76 </test>
77 <!-- Test TIFF, normalized -->
78 <test>
79 <param name="input" value="input2_normalized.tiff"/>
80 <param name="scale" value="0.5"/>
81 <expand macro="tests/intensity_image_diff" name="output" value="normalized.tiff" ftype="tiff"/>
82 </test>
83 <!-- Test TIFF, not normalized -->
84 <test>
85 <param name="input" value="input3_not_normalized.tiff"/>
86 <param name="scale" value="0.5"/>
87 <expand macro="tests/intensity_image_diff" name="output" value="not_normalized.tiff" ftype="tiff"/>
63 </test> 88 </test>
64 </tests> 89 </tests>
65 <help> 90 <help>
66 **What it does**
67 91
68 This tool scales an image using the scaling factor. 92 **Scales an image using one or more scaling factors.**
93
94 The image is rescaled uniformly along all axes, or anistropically if multiple scale factors are given.
95
96 This operation preserves both the brightness of the image, and the range of values.
97
69 </help> 98 </help>
70 <citations> 99 <citations>
71 <citation type="doi">10.1016/j.jbiotec.2017.07.019</citation> 100 <citation type="doi">10.1016/j.jbiotec.2017.07.019</citation>
72 </citations> 101 </citations>
73 </tool> 102 </tool>