comparison auto_threshold.xml @ 9:50fa6150e340 draft

planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/2d_auto_threshold/ commit 01343602708de3cc7fa4986af9000adc36dd0651
author imgteam
date Sat, 07 Jun 2025 18:38:31 +0000
parents 699a5e9146b3
children 2ee04d2ebdcf
comparison
equal deleted inserted replaced
8:699a5e9146b3 9:50fa6150e340
1 <tool id="ip_threshold" name="Threshold image" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="20.05"> 1 <tool id="ip_threshold" name="Threshold image" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="20.05">
2 <description>with scikit-image</description> 2 <description>with scikit-image</description>
3 <macros> 3 <macros>
4 <import>creators.xml</import> 4 <import>creators.xml</import>
5 <import>tests.xml</import> 5 <import>tests.xml</import>
6 <token name="@TOOL_VERSION@">0.18.1</token> 6 <token name="@TOOL_VERSION@">0.25.0</token>
7 <token name="@VERSION_SUFFIX@">3</token> 7 <token name="@VERSION_SUFFIX@">0</token>
8 <xml name="inputs/offset"> 8 <xml name="inputs/offset">
9 <param name="offset" type="float" value="0" label="Offset" help="Offset to be added to the automatically determined threshold value. Positive values will increase the threshold (and thus reduce the amount of values above the threshold)." /> 9 <param name="offset" type="float" value="0" label="Offset" help="Offset to be added to the automatically determined threshold value. Positive values will increase the threshold (and thus reduce the amount of values above the threshold)." />
10 </xml> 10 </xml>
11 </macros> 11 </macros>
12 <creator> 12 <creator>
17 </edam_operations> 17 </edam_operations>
18 <xrefs> 18 <xrefs>
19 <xref type="bio.tools">scikit-image</xref> 19 <xref type="bio.tools">scikit-image</xref>
20 <xref type="biii">scikit-image</xref> 20 <xref type="biii">scikit-image</xref>
21 </xrefs> 21 </xrefs>
22 <requirements> 22 <requirements>
23 <requirement type="package" version="@TOOL_VERSION@">scikit-image</requirement> 23 <requirement type="package" version="@TOOL_VERSION@">scikit-image</requirement>
24 <requirement type="package" version="2020.10.1">tifffile</requirement> 24 <requirement type="package" version="0.4.1">giatools</requirement>
25 <requirement type="package" version="0.1">giatools</requirement>
26 </requirements> 25 </requirements>
27 <command detect_errors="aggressive"> 26 <command detect_errors="aggressive">
28 <![CDATA[ 27 <![CDATA[
29 python '$__tool_directory__/auto_threshold.py' 28
30 '$input' 29 python '$__tool_directory__/auto_threshold.py'
31 ./out.tif 30
32 '$th_method.method_id' 31 '$input'
33 '$th_method.block_size' 32 ./out.tiff
34 '$th_method.offset' 33
35 '$th_method.threshold' 34 '$th_method.method_id'
36 $invert_output 35 '$th_method.block_size'
36 '$th_method.offset'
37 '$th_method.threshold1'
38 $invert_output
39
40 #if str($th_method.threshold2) != '':
41 --threshold2 '$th_method.threshold2'
42 #end if
43
37 ]]> 44 ]]>
38 </command> 45 </command>
39 <inputs> 46 <inputs>
40 <param name="input" type="data" format="tiff,png" label="Input image" /> 47 <param name="input" type="data" format="tiff,png" label="Input image" />
41 <conditional name="th_method"> 48 <conditional name="th_method">
48 <option value="loc_gaussian">Locally adaptive / Gaussian</option> 55 <option value="loc_gaussian">Locally adaptive / Gaussian</option>
49 <option value="loc_median">Locally adaptive / Median</option> 56 <option value="loc_median">Locally adaptive / Median</option>
50 <option value="loc_mean">Locally adaptive / Mean</option> 57 <option value="loc_mean">Locally adaptive / Mean</option>
51 </param> 58 </param>
52 <when value="manual"> 59 <when value="manual">
53 <param name="threshold" type="float" value="0" label="Threshold value" /> 60 <param name="threshold1" type="float" value="0" label="Threshold value" />
61 <param name="threshold2" type="float" value="" optional="true" label="Second threshold value for hysteresis thresholding" />
54 <param name="block_size" type="hidden" value="0" /> 62 <param name="block_size" type="hidden" value="0" />
55 <param name="offset" type="hidden" value="0" /> 63 <param name="offset" type="hidden" value="0" />
56 </when> 64 </when>
57 <when value="otsu"> 65 <when value="otsu">
58 <param name="threshold" type="hidden" value="0" /> 66 <param name="threshold1" type="hidden" value="0" />
67 <param name="threshold2" type="hidden" value="" />
59 <param name="block_size" type="hidden" value="0" /> 68 <param name="block_size" type="hidden" value="0" />
60 <expand macro="inputs/offset" /> 69 <expand macro="inputs/offset" />
61 </when> 70 </when>
62 <when value="li"> 71 <when value="li">
63 <param name="threshold" type="hidden" value="0" /> 72 <param name="threshold1" type="hidden" value="0" />
73 <param name="threshold2" type="hidden" value="" />
64 <param name="block_size" type="hidden" value="0" /> 74 <param name="block_size" type="hidden" value="0" />
65 <expand macro="inputs/offset" /> 75 <expand macro="inputs/offset" />
66 </when> 76 </when>
67 <when value="isodata"> 77 <when value="isodata">
68 <param name="threshold" type="hidden" value="0" /> 78 <param name="threshold1" type="hidden" value="0" />
79 <param name="threshold2" type="hidden" value="" />
69 <param name="block_size" type="hidden" value="0" /> 80 <param name="block_size" type="hidden" value="0" />
70 <expand macro="inputs/offset" /> 81 <expand macro="inputs/offset" />
71 </when> 82 </when>
72 <when value="yen"> 83 <when value="yen">
73 <param name="threshold" type="hidden" value="0" /> 84 <param name="threshold1" type="hidden" value="0" />
85 <param name="threshold2" type="hidden" value="" />
74 <param name="block_size" type="hidden" value="0" /> 86 <param name="block_size" type="hidden" value="0" />
75 <expand macro="inputs/offset" /> 87 <expand macro="inputs/offset" />
76 </when> 88 </when>
77 <when value="loc_gaussian"> 89 <when value="loc_gaussian">
78 <param name="threshold" type="hidden" value="0" /> 90 <param name="threshold1" type="hidden" value="0" />
91 <param name="threshold2" type="hidden" value="" />
79 <param name="block_size" type="integer" value="5" label="Odd size of pixel neighborhood for determining the threshold" /> 92 <param name="block_size" type="integer" value="5" label="Odd size of pixel neighborhood for determining the threshold" />
80 <expand macro="inputs/offset" /> 93 <expand macro="inputs/offset" />
81 </when> 94 </when>
82 <when value="loc_median"> 95 <when value="loc_median">
83 <param name="threshold" type="hidden" value="0" /> 96 <param name="threshold1" type="hidden" value="0" />
97 <param name="threshold2" type="hidden" value="" />
84 <param name="block_size" type="integer" value="5" label="Odd size of pixel neighborhood for determining the threshold" /> 98 <param name="block_size" type="integer" value="5" label="Odd size of pixel neighborhood for determining the threshold" />
85 <expand macro="inputs/offset" /> 99 <expand macro="inputs/offset" />
86 </when> 100 </when>
87 <when value="loc_mean"> 101 <when value="loc_mean">
88 <param name="threshold" type="hidden" value="0" /> 102 <param name="threshold1" type="hidden" value="0" />
103 <param name="threshold2" type="hidden" value="" />
89 <param name="block_size" type="integer" value="5" label="Odd size of pixel neighborhood for determining the threshold" /> 104 <param name="block_size" type="integer" value="5" label="Odd size of pixel neighborhood for determining the threshold" />
90 <expand macro="inputs/offset" /> 105 <expand macro="inputs/offset" />
91 </when> 106 </when>
92 </conditional> 107 </conditional>
93 <param name="invert_output" type="boolean" checked="false" truevalue="--invert_output" falsevalue="" label="Invert output labels" help="Pixels are usually assigned the label 0 if the pixel value is below (or equal to) the threshold, and 255 if it is above the threshold. If this option is activated, pixels are assigned the label 255 if the pixel value is below (or equal to) the threshold, and 0 if it is above the threshold." /> 108 <param name="invert_output" type="boolean" checked="false" truevalue="--invert_output" falsevalue="" label="Invert output labels" help="Pixels are usually assigned the label 0 if the pixel value is below (or equal to) the threshold, and 255 if it is above the threshold. If this option is activated, pixels are assigned the label 255 if the pixel value is below (or equal to) the threshold, and 0 if it is above the threshold." />
94 </inputs> 109 </inputs>
95 <outputs> 110 <outputs>
96 <data format="tiff" name="output" from_work_dir="out.tif" /> 111 <data format="tiff" name="output" from_work_dir="out.tiff" />
97 </outputs> 112 </outputs>
98 <tests> 113 <tests>
99 <!-- Tests for single-channel images --> 114 <!-- Tests for single-channel images (TIFF) -->
100 <test> 115 <test>
101 <param name="input" value="sample.tif"/> 116 <param name="input" value="sample.tiff"/>
102 <param name="method_id" value="loc_gaussian"/> 117 <conditional name="th_method">
103 <param name="block_size" value="51"/> 118 <param name="method_id" value="loc_gaussian"/>
104 <param name="invert_output" value="False"/> 119 <param name="block_size" value="51"/>
105 <expand macro="tests/binary_image_diff" name="output" value="out1.tif" ftype="tiff"/> 120 </conditional>
121 <expand macro="tests/binary_image_diff" name="output" value="out1.tiff" ftype="tiff"/>
106 </test> 122 </test>
107 <test> 123 <test>
108 <param name="input" value="sample.tif"/> 124 <param name="input" value="sample.tiff"/>
109 <param name="method_id" value="loc_gaussian"/> 125 <conditional name="th_method">
110 <param name="block_size" value="51"/> 126 <param name="method_id" value="loc_gaussian"/>
111 <param name="offset" value="1"/> 127 <param name="block_size" value="51"/>
112 <param name="invert_output" value="False"/> 128 <param name="offset" value="1"/>
113 <expand macro="tests/binary_image_diff" name="output" value="out2.tif" ftype="tiff"/> 129 </conditional>
130 <expand macro="tests/binary_image_diff" name="output" value="out2.tiff" ftype="tiff"/>
114 </test> 131 </test>
115 <test> 132 <test>
116 <param name="input" value="sample.tif"/> 133 <param name="input" value="sample.tiff"/>
117 <param name="method_id" value="otsu"/> 134 <conditional name="th_method">
118 <param name="invert_output" value="False"/> 135 <param name="method_id" value="otsu"/>
119 <expand macro="tests/binary_image_diff" name="output" value="out3.tif" ftype="tiff"/> 136 </conditional>
137 <expand macro="tests/binary_image_diff" name="output" value="out3.tiff" ftype="tiff"/>
120 </test> 138 </test>
121 <test> 139 <test>
122 <param name="input" value="sample.tif"/> 140 <param name="input" value="sample.tiff"/>
123 <param name="method_id" value="manual"/>
124 <param name="threshold" value="64"/>
125 <param name="invert_output" value="True"/> 141 <param name="invert_output" value="True"/>
126 <expand macro="tests/binary_image_diff" name="output" value="out4.tif" ftype="tiff"/> 142 <conditional name="th_method">
143 <param name="method_id" value="manual"/>
144 <param name="threshold1" value="64"/>
145 </conditional>
146 <expand macro="tests/binary_image_diff" name="output" value="out4.tiff" ftype="tiff"/>
147 </test>
148 <test>
149 <param name="input" value="sample.tiff"/>
150 <conditional name="th_method">
151 <param name="method_id" value="manual"/>
152 <param name="threshold1" value="180"/>
153 <param name="threshold2" value="240"/>
154 </conditional>
155 <expand macro="tests/binary_image_diff" name="output" value="sample_manual_180_240.tiff" ftype="tiff"/>
156 </test>
157 <!-- Tests for multi-channel images (PNG) -->
158 <test>
159 <param name="input" value="rgb.png"/>
160 <conditional name="th_method">
161 <param name="method_id" value="otsu"/>
162 </conditional>
163 <expand macro="tests/binary_image_diff" name="output" value="rgb_otsu.tiff" ftype="tiff"/>
127 </test> 164 </test>
128 <!-- Tests for irregular files --> 165 <!-- Tests for irregular files -->
129 <test> 166 <test>
130 <param name="input" value="sample2.tif"/> 167 <param name="input" value="sample2.tiff"/>
131 <param name="method_id" value="otsu"/> 168 <conditional name="th_method">
132 <param name="invert_output" value="False"/> 169 <param name="method_id" value="otsu"/>
133 <expand macro="tests/binary_image_diff" name="output" value="out5.tif" ftype="tiff"/> 170 </conditional>
134 </test> 171 <expand macro="tests/binary_image_diff" name="output" value="out5.tiff" ftype="tiff"/>
135 <!-- Tests for multi-channel images -->
136 <test expect_failure="true">
137 <param name="input" value="rgb.png"/>
138 </test> 172 </test>
139 </tests> 173 </tests>
140 <help> 174 <help>
141 175
142 **Applies a standard thresholding algorithm to a 2-D single-channel image. Yields a binary image.** 176 **Applies a standard thresholding algorithm to a 2-D single-channel image. Yields a binary image.**