upstream/tools/image_processing/imagej2/imagej2_adjust_threshold_binary.xml
1<tool id="imagej2_adjust_threshold_binary" name="Adjust threshold" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="23.0">
2 <description>with ImageJ2</description>
3 <macros>
4 <import>imagej2_macros.xml</import>
5 </macros>
6 <edam_operations>
7 <edam_operation>operation_3443</edam_operation>
8 </edam_operations>
9 <xrefs>
10 <xref type="bio.tools">imagej</xref>
11 <xref type="biii">imagej2</xref>
12 </xrefs>
13 <expand macro="fiji_requirements"/>
14 <command detect_errors="exit_code"><![CDATA[
15#import os
16#set input_sans_ext = $os.path.splitext($os.path.basename($input.file_name))[0]
17#set input_with_ext = './' + '.'.join([input_sans_ext, $input.ext])
18ln -s '$input.file_name' '$input_with_ext' &&
19#set output_filename = '.'.join(['output', $input.ext])
20touch '$output_filename' &&
21ImageJ --ij2 --headless --debug
22--jython '$__tool_directory__/imagej2_adjust_threshold_binary_jython_script.py'
23'$input_with_ext'
24$method_cond.threshold_min
25$method_cond.threshold_max
26'$method_cond.method'
27'$display'
28'$method_cond.black_background'
29'$output_filename'
30'$input.ext'
31&& mv '$output_filename' '$output';
32]]></command>
33 <inputs>
34 <expand macro="param_input"/>
35 <conditional name="method_cond">
36 <param name="auto_method" type="select" label="Use autothreshold or manual">
37 <option value="Auto" selected="true">Autothreshold</option>
38 <option value="Manual" selected="true">Manual (set min max values)</option>
39 </param>
40 <when value="Auto">
41 <param name="method" type="select" label="Method" help="The Default method is the modified IsoData algorithm.">
42 <option value="Default" selected="True">Default</option>
43 <option value="Huang">Huang</option>
44 <option value="Huang2">Huang2</option>
45 <option value="Intermodes">Intermodes</option>
46 <option value="IsoData">IsoData</option>
47 <option value="Li">Li</option>
48 <option value="MaxEntropy">MaxEntropy</option>
49 <option value="Mean">Mean</option>
50 <option value="MinError(I)">MinError(I)</option>
51 <option value="Minimum">Minimum</option>
52 <option value="Moments">Moments</option>
53 <option value="Otsu">Otsu</option>
54 <option value="Percentile">Percentile</option>
55 <option value="RenyiEntropy">RenyiEntropy</option>
56 <option value="Shanbhag">Shanbhag</option>
57 <option value="Triangle">Triangle</option>
58 <option value="Yen">Yen</option>
59 </param>
60 <expand macro="black_background_param"/>
61 <param type="hidden" name="threshold_min" value="0.0"/>
62 <param type="hidden" name="threshold_max" value="255.0"/>
63 </when>
64 <when value="Manual">
65 <param type="hidden" name="method" value="Manual"/>
66 <param type="hidden" name="black_background" value="yes"/>
67 <param name="threshold_min" type="float" value="0" min="0" max="255" label="Minimum threshold value"/>
68 <param name="threshold_max" type="float" value="0" min="0" max="255" label="Maximum threshold value"/>
69 </when>
70 </conditional>
71 <param name="display" type="select" label="Display">
72 <option value="red" selected="True">Red</option>
73 <option value="bw">Black and White</option>
74 <option value="over_under">Over/Under</option>
75 </param>
76 </inputs>
77 <outputs>
78 <data name="output" format_source="input"/>
79 </outputs>
80 <tests>
81 <test>
82 <param name="input" value="blobs.gif"/>
83 <conditional name="method_cond">
84 <param name="method" value="Default"/>
85 <param name="black_background" value="no"/>
86 </conditional>
87 <param name="display" value="red"/>
88 <output name="output" file="blobs_threshold_default.gif" compare="image_diff" metric="iou"/>
89 </test>
90 <test>
91 <param name="input" value="blobs.gif"/>
92 <conditional name="method_cond">
93 <param name="method" value="Percentile"/>
94 <param name="black_background" value="no"/>
95 </conditional>
96 <param name="display" value="over_under"/>
97 <output name="output" file="blobs_threshold_percentile.gif" compare="image_diff" metric="iou"/>
98 </test>
99 <test>
100 <param name="input" value="blobs.gif"/>
101 <conditional name="method_cond">
102 <param name="method" value="Huang"/>
103 <param name="black_background" value="yes"/>
104 </conditional>
105 <param name="display" value="bw"/>
106 <output name="output" file="blobs_threshold_huang_dark.gif" compare="image_diff" metric="iou"/>
107 </test>
108 <test>
109 <param name="input" value="blobs.gif"/>
110 <conditional name="method_cond">
111 <param name="auto_method" value="Manual"/>
112 <param name="threshold_min" value="8"/>
113 <param name="threshold_max" value="255"/>
114 </conditional>
115 <param name="display" value="bw"/>
116 <output name="output" file="blobs_threshold_8-255.gif" compare="image_diff" metric="iou"/>
117 </test>
118 <test>
119 <param name="input" value="blobs.gif"/>
120 <conditional name="method_cond">
121 <param name="auto_method" value="Manual"/>
122 <param name="threshold_min" value="0"/>
123 <param name="threshold_max" value="8"/>
124 </conditional>
125 <param name="display" value="bw"/>
126 <output name="output" file="blobs_threshold_0-8.gif" compare="image_diff" metric="iou"/>
127 </test>
128 <test>
129 <param name="input" value="confocal-series-first-channel.tiff"/>
130 <conditional name="method_cond">
131 <param name="method" value="Default"/>
132 <param name="black_background" value="yes"/>
133 </conditional>
134 <param name="display" value="bw"/>
135 <output name="output" file="confocal-series-first-channel_threshold_default.tiff" compare="sim_size"/>
136 </test>
137 </tests>
138 <help>
139
140@requires_binary_input@
141
142**What it does**
143
144<![CDATA[
145Sets lower and upper threshold values, segmenting grayscale images into features of interest and background
146
147- **Minimum threshold value** - Adjusts the minimum threshold value.
148- **Maximum threshold value** - Adjusts the maximum threshold value.
149- **Method** - Allows any of the 17 different automatic thresholding methods to be selected. These are global thresholding methods that typically cannot deal with unevenly illuminated images (such as in brightfield microscopy)."
150- **Display** - Selects one of three display mode: **Red** displays the thresholded values in red, **Black and White** features are displayed in black and background in white, **Over/Under** displays pixels below the lower threshold value in blue, thresholded pixels in grayscale, and pixels above the upper threshold value in green.
151- **Black background** - Select **yes** when features are lighter than the background.
152]]>
153
154 </help>
155 <expand macro="fiji_headless_citations"/>
156</tool>