comparison filter.xml @ 5:1b7e67168732 draft

planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/2d_simple_filter/ commit a6fd77be465068f709a71d377900da99becf94d8
author imgteam
date Fri, 12 Dec 2025 21:18:21 +0000
parents d51310ab328a
children 6fecb8056a80
comparison
equal deleted inserted replaced
4:d51310ab328a 5:1b7e67168732
1 <tool id="ip_filter_standard" name="Filter 2-D image" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="20.05"> 1 <tool id="ip_filter_standard" name="Apply 2-D image filter" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="20.05">
2 <description>with scipy</description> 2 <description>with scipy</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@">1.12.0</token> 6 <token name="@TOOL_VERSION@">1.16.3</token>
7 <token name="@VERSION_SUFFIX@">1</token> 7 <token name="@VERSION_SUFFIX@">0</token>
8 <xml name="select_axis">
9 <param name="axis" type="select" label="Direction">
10 <option value="1" selected="true">Horizontal</option>
11 <option value="0">Vertical</option>
12 </param>
13 </xml>
8 </macros> 14 </macros>
9 <creator> 15 <creator>
10 <expand macro="creators/bmcv" /> 16 <expand macro="creators/bmcv"/>
17 <expand macro="creators/kostrykin"/>
11 </creator> 18 </creator>
12 <edam_operations> 19 <edam_operations>
13 <edam_operation>operation_3443</edam_operation> 20 <edam_operation>operation_3443</edam_operation>
14 </edam_operations> 21 </edam_operations>
15 <xrefs> 22 <xrefs>
23 <xref type="bio.tools">galaxy_image_analysis</xref>
16 <xref type="biii">scipy</xref> 24 <xref type="biii">scipy</xref>
17 </xrefs> 25 </xrefs>
18 <requirements> 26 <requirements>
19 <requirement type="package" version="@TOOL_VERSION@">scipy</requirement> 27 <requirement type="package" version="@TOOL_VERSION@">scipy</requirement>
20 <requirement type="package" version="1.26.4">numpy</requirement> 28 <requirement type="package" version="2.3.5">numpy</requirement>
21 <requirement type="package" version="0.22.0">scikit-image</requirement> 29 <requirement type="package" version="0.25.2">scikit-image</requirement>
22 <requirement type="package" version="2024.2.12">tifffile</requirement> 30 <requirement type="package" version="2025.10.16">tifffile</requirement>
23 <requirement type="package" version="0.1">giatools</requirement> 31 <requirement type="package" version="0.5.2">giatools</requirement>
24 </requirements> 32 </requirements>
25 <command detect_errors="aggressive"><![CDATA[ 33 <command detect_errors="aggressive"><![CDATA[
26 34
27 python '$__tool_directory__/filter_image.py' 35 python '$__tool_directory__/filter.py'
28 36
29 '$input' 37 '$input'
30 '$output' 38 '$output'
31 39 '$params'
32 $filter_type
33 $size
34 40
35 ]]></command> 41 ]]></command>
42 <configfiles>
43 <configfile name="params"><![CDATA[
44 {
45
46 ## =====================================================================
47 #if $filter.filter_type == "gaussian"
48 "sigma": $filter.sigma,
49 "order": $filter.derivative.order,
50
51 #if $filter.derivative.order != "0"
52 "axis": $filter.derivative.axis,
53 #end if
54
55 ## =====================================================================
56 #elif $filter.filter_type == "uniform"
57 "size": $filter.size,
58
59 ## =====================================================================
60 #elif $filter.filter_type == "median"
61 "radius": $filter.radius,
62
63 ## =====================================================================
64 #elif $filter.filter_type == "prewitt" or $filter.filter_type == "sobel"
65 "axis": $filter.axis,
66
67 ## =====================================================================
68 #end if
69
70 "filter_type": "$filter.filter_type"
71
72 }
73 ]]></configfile>
74 </configfiles>
36 <inputs> 75 <inputs>
37 <param name="input" type="data" format="tiff,png" label="Input image" /> 76 <param name="input" type="data" format="tiff,png" label="Input image"/>
38 <conditional name="filter"> 77 <conditional name="filter">
39 <param name="filter_type" type="select" label="Filter type"> 78 <param name="filter_type" type="select" label="Filter type">
40 <option value="gaussian" selected="True">Gaussian</option> 79 <option value="gaussian" selected="True">Gaussian</option>
80 <option value="uniform">Box filter (uniform filter)</option>
41 <option value="median">Median</option> 81 <option value="median">Median</option>
42 <option value="prewitt_h">Prewitt horizontal</option> 82 <option value="prewitt">Prewitt</option>
43 <option value="prewitt_v">Prewitt vertical</option> 83 <option value="sobel">Sobel</option>
44 <option value="sobel_h">Sobel horizontal</option>
45 <option value="sobel_v">Sobel vertical</option>
46 </param> 84 </param>
47 <when value="gaussian"> 85 <when value="gaussian">
48 <param name="size" type="float" value="3" min="0.1" label="Sigma" help="The half width of the Gaussian bell (in pixels)." /> 86 <param name="sigma" type="float" value="3" min="0.1" label="Sigma"
87 help="The half width of the Gaussian bell (in pixels)."/>
88 <conditional name="derivative">
89 <param name="order" type="select" label="Use a derivative?">
90 <option value="0">No derivative (mean filter)</option>
91 <option value="1">1st-order derivative</option>
92 <option value="2">2nd-order derivative</option>
93 </param>
94 <when value="0">
95 </when>
96 <when value="1">
97 <expand macro="select_axis"/>
98 </when>
99 <when value="2">
100 <expand macro="select_axis"/>
101 </when>
102 </conditional>
103 </when>
104 <when value="uniform">
105 <param name="size" type="integer" min="2" value="3" label="Size"
106 help="Edge length of the neighborhood (square, in pixels)."/>
49 </when> 107 </when>
50 <when value="median"> 108 <when value="median">
51 <param name="size" type="integer" value="3" label="Radius" help="Radius of the neighborhood (in pixels)." /> 109 <param name="radius" type="integer" min="2" value="3" label="Radius"
52 </when> 110 help="Radius of the neighborhood (circle, in pixels)." />
53 <when value="prewitt_h"> 111 </when>
54 <param name="size" type="hidden" value="0" /> 112 <when value="prewitt">
55 </when> 113 <expand macro="select_axis"/>
56 <when value="prewitt_v"> 114 </when>
57 <param name="size" type="hidden" value="0" /> 115 <when value="sobel">
58 </when> 116 <expand macro="select_axis"/>
59 <when value="sobel_h">
60 <param name="size" type="hidden" value="0" />
61 </when>
62 <when value="sobel_v">
63 <param name="size" type="hidden" value="0" />
64 </when> 117 </when>
65 </conditional> 118 </conditional>
66 </inputs> 119 </inputs>
67 <outputs> 120 <outputs>
68 <data format="tiff" name="output" /> 121 <data format="tiff" name="output" />
69 </outputs> 122 </outputs>
70 <tests> 123 <tests>
71 <!-- Tests with uint8 TIFF input image --> 124 <!-- Tests with uint8 TIFF input image -->
72 <test> 125 <test>
73 <param name="input" value="input1_uint8.tif" /> 126 <param name="input" value="input1_uint8.tiff"/>
74 <param name="filter_type" value="gaussian" /> 127 <conditional name="filter">
75 <expand macro="tests/intensity_image_diff" name="output" value="input1_gaussian.tif" ftype="tiff"> 128 <param name="filter_type" value="gaussian"/>
129 </conditional>
130 <expand macro="tests/intensity_image_diff" name="output" value="input1_gaussian.tiff" ftype="tiff">
76 <!-- 131 <!--
77 132
78 The input file `input1_uint8.tif` has values ranging between 23 and 254, with a mean value of 63.67. 133 The input file `input1_uint8.tiff` has values ranging between 23 and 254, with a mean value of 63.67.
79 134
80 Below, we use an assertion in addition to the `image_diff` comparison, to ensure that the range of 135 Below, we use an assertion in addition to the `image_diff` comparison, to ensure that the range of
81 values is preserved. The motiviation behind this is that the expectation images are usually checked 136 values is preserved. The motiviation behind this is that the expectation images are usually checked
82 visually, which means that the `image_diff` comparison is likely to ensure that the brightness of 137 visually, which means that the `image_diff` comparison is likely to ensure that the brightness of
83 the image is correct, thus it's good to double-check the range of values (hence the comparably large 138 the image is correct, thus it's good to double-check the range of values (hence the comparably large
86 --> 141 -->
87 <has_image_mean_intensity mean_intensity="63.67" eps="10"/> 142 <has_image_mean_intensity mean_intensity="63.67" eps="10"/>
88 </expand> 143 </expand>
89 </test> 144 </test>
90 <test> 145 <test>
91 <param name="input" value="input1_uint8.tif" /> 146 <param name="input" value="input1_uint8.tiff"/>
92 <param name="filter_type" value="median" /> 147 <conditional name="filter">
93 <expand macro="tests/intensity_image_diff" name="output" value="input1_median.tif" ftype="tiff"> 148 <param name="filter_type" value="median"/>
149 </conditional>
150 <expand macro="tests/intensity_image_diff" name="output" value="input1_median.tiff" ftype="tiff">
94 <!-- See note for Gaussian filter above. --> 151 <!-- See note for Gaussian filter above. -->
95 <has_image_mean_intensity mean_intensity="63.67" eps="10"/> 152 <has_image_mean_intensity mean_intensity="63.67" eps="10"/>
96 </expand> 153 </expand>
97 </test> 154 </test>
98 <test> 155 <test>
99 <param name="input" value="input1_uint8.tif" /> 156 <param name="input" value="input1_uint8.tiff"/>
100 <param name="filter_type" value="prewitt_h" /> 157 <conditional name="filter">
101 <expand macro="tests/intensity_image_diff" name="output" value="input1_prewitt_h.tif" ftype="tiff"/> 158 <param name="filter_type" value="prewitt"/>
102 </test> 159 <param name="axis" value="1"/>
103 <test> 160 </conditional>
104 <param name="input" value="input1_uint8.tif" /> 161 <expand macro="tests/intensity_image_diff" name="output" value="input1_prewitt_h.tiff" ftype="tiff"/>
105 <param name="filter_type" value="prewitt_v" /> 162 </test>
106 <expand macro="tests/intensity_image_diff" name="output" value="input1_prewitt_v.tif" ftype="tiff"/> 163 <test>
107 </test> 164 <param name="input" value="input1_uint8.tiff"/>
108 <test> 165 <conditional name="filter">
109 <param name="input" value="input1_uint8.tif" /> 166 <param name="filter_type" value="prewitt"/>
110 <param name="filter_type" value="sobel_h" /> 167 <param name="axis" value="0"/>
111 <expand macro="tests/intensity_image_diff" name="output" value="input1_sobel_h.tif" ftype="tiff"/> 168 </conditional>
112 </test> 169 <expand macro="tests/intensity_image_diff" name="output" value="input1_prewitt_v.tiff" ftype="tiff"/>
113 <test> 170 </test>
114 <param name="input" value="input1_uint8.tif" /> 171 <test>
115 <param name="filter_type" value="sobel_v" /> 172 <param name="input" value="input1_uint8.tiff"/>
116 <expand macro="tests/intensity_image_diff" name="output" value="input1_sobel_v.tif" ftype="tiff"/> 173 <conditional name="filter">
174 <param name="filter_type" value="sobel"/>
175 <param name="axis" value="1"/>
176 </conditional>
177 <expand macro="tests/intensity_image_diff" name="output" value="input1_sobel_h.tiff" ftype="tiff"/>
178 </test>
179 <test>
180 <param name="input" value="input1_uint8.tiff"/>
181 <conditional name="filter">
182 <param name="filter_type" value="sobel"/>
183 <param name="axis" value="0"/>
184 </conditional>
185 <expand macro="tests/intensity_image_diff" name="output" value="input1_sobel_v.tiff" ftype="tiff"/>
117 </test> 186 </test>
118 <!-- Tests with float TIFF input image --> 187 <!-- Tests with float TIFF input image -->
119 <test> 188 <test>
120 <param name="input" value="input2_float.tif" /> 189 <param name="input" value="input2_float.tiff"/>
121 <param name="filter_type" value="gaussian" /> 190 <conditional name="filter">
122 <expand macro="tests/intensity_image_diff" name="output" value="input2_gaussian.tif" ftype="tiff"> 191 <param name="filter_type" value="gaussian"/>
192 </conditional>
193 <expand macro="tests/intensity_image_diff" name="output" value="input2_gaussian.tiff" ftype="tiff">
123 <!-- See note for Gaussian filter above. --> 194 <!-- See note for Gaussian filter above. -->
124 <has_image_mean_intensity mean_intensity="0.25" eps="0.01"/> 195 <has_image_mean_intensity mean_intensity="0.25" eps="0.01"/>
125 </expand> 196 </expand>
126 </test> 197 </test>
198 <test>
199 <param name="input" value="input2_float.tiff"/>
200 <conditional name="filter">
201 <param name="filter_type" value="uniform"/>
202 <param name="size" value="4"/>
203 </conditional>
204 <expand macro="tests/intensity_image_diff" name="output" value="input2_uniform.tiff" ftype="tiff">
205 <!-- See note for Gaussian filter above. -->
206 <has_image_mean_intensity mean_intensity="0.25" eps="0.01"/>
207 </expand>
208 </test>
209 <!-- Tests with multi-channel image (RGB) -->
210 <test>
211 <param name="input" value="scikit-image/retina.png"/>
212 <conditional name="filter">
213 <param name="filter_type" value="gaussian"/>
214 <param name="sigma" value="5"/>
215 <conditional name="derivative">
216 <param name="order" value="0"/>
217 </conditional>
218 </conditional>
219 <expand macro="tests/intensity_image_diff" name="output" value="retina_gaussian_order0.tiff" ftype="tiff"/>
220 </test>
221 <test>
222 <param name="input" value="scikit-image/retina.png"/>
223 <conditional name="filter">
224 <param name="filter_type" value="gaussian"/>
225 <param name="sigma" value="3"/>
226 <conditional name="derivative">
227 <param name="order" value="2"/>
228 <param name="axis" value="0"/>
229 </conditional>
230 </conditional>
231 <expand macro="tests/intensity_image_diff" name="output" value="retina_gaussian_order2_axis0.tiff" ftype="tiff"/>
232 </test>
127 </tests> 233 </tests>
128 <help> 234 <help>
129 235
130 **Applies a standard filter to a single-channel 2-D image.** 236 **Applies a standard, general-purpose 2-D filter to an image.**
131 237
132 Mean filters like the Gaussian filter or the median filter preserve both the brightness of the image, and the range of values. 238 Support for different image types:
239
240 - For 3-D images, the filter is applied to all z-slices of the image.
241 - For multi-channel images, the filter is applied to all channels of the image.
242 - For time-series images, the filter is also applied for all time steps.
243
244 Mean filters like the Gaussian filter, the box filter, or the median filter preserve both the brightness of the image, and
245 the range of values. This does not hold for the derivative variants of the Gaussian filter, which may produce negative values.
133 246
134 </help> 247 </help>
135 <citations> 248 <citations>
136 <citation type="doi">10.1016/j.jbiotec.2017.07.019</citation> 249 <citation type="doi">10.1016/j.jbiotec.2017.07.019</citation>
137 </citations> 250 </citations>