upstream/tools/image_processing/imagej2/imagej2_analyze_particles_binary.xml
1<tool id="imagej2_analyze_particles_binary" name="Analyze particles" 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#if str($show) == 'Nothing':
20 #set display_results = 'yes'
21 #set output_filename = ''
22 #set output_datatype = ''
23 #set results_filename = $results
24#else:
25 #set display_results = $display_results
26 #set output_filename = '.'.join(['output', $input.ext])
27 #set output_datatype = $input.ext
28 touch '$output_filename' &&
29 #if str($display_results) == 'yes':
30 #set results_filename = $results
31 #else:
32 #set results_filename = ''
33 #end if
34#end if
35#if str($export_rois) == 'true':
36 #set rois_filename = $rois
37#else:
38 #set rois_filename = ''
39#end if
40ImageJ --ij2 --headless --debug
41--jython '$__tool_directory__/imagej2_analyze_particles_binary_jython_script.py'
42'$rois_filename'
43'$input'
44'$black_background'
45'$size'
46$circularity_min
47$circularity_max
48'$show'
49'$display_results'
50'$exclude_edges'
51'$include_holes'
52'$output_filename'
53'$output_datatype'
54'$results_filename'
55#if str($output_filename) != '':
56 && mv '$output_filename' '$output';
57#end if
58]]></command>
59 <inputs>
60 <expand macro="param_input"/>
61 <expand macro="black_background_param"/>
62 <param name="size" type="text" value="0-Infinity" label="Size (pixel^2)" help="Enter a single value and particles smaller than that value will be ignored."/>
63 <param name="circularity_min" type="float" value="0.0" label="Circularity minimum" help="Values from 0.0 to 1.0, but less than maximum">
64 <validator type="in_range" min="0" max="1"/>
65 </param>
66 <param name="circularity_max" type="float" value="1.0" label="Circularity maximum" help="Values from 0.0 to 1.0, but greater than minimum">
67 <validator type="in_range" min="0" max="1"/>
68 </param>
69 <param name="show" type="select" label="Show" help="Selecting Nothing will display results, but no image.">
70 <option value="Outlines" selected="True">Outlines</option>
71 <option value="Bare_Outlines">Bare Outlines</option>
72 <option value="Ellipses">Ellipses</option>
73 <option value="Masks">Masks</option>
74 <option value="Count_Masks">Count Masks</option>
75 <option value="Overlay">Overlay</option>
76 <option value="Overlay_Masks">Overlay Masks</option>
77 <option value="Nothing">Nothing</option>
78 </param>
79 <param name="display_results" type="select" label="Display results">
80 <option value="no" selected="True">No</option>
81 <option value="yes">Yes</option>
82 </param>
83 <param name="exclude_edges" type="select" label="Exclude on edges?">
84 <option value="no" selected="True">No</option>
85 <option value="yes">Yes</option>
86 </param>
87 <param name="include_holes" type="select" label="Include holes?">
88 <option value="no" selected="True">No</option>
89 <option value="yes">Yes</option>
90 </param>
91 <param name="export_rois" type="boolean" truevalue="true" falsevalue="false" checked="false" label="Export particles outlines coordinates" help="Exports particles coordinates as a tabular file, which can be imported as ROIs in OMERO." />
92 </inputs>
93 <outputs>
94 <data name="output" format_source="input">
95 <filter>show != "Nothing"</filter>
96 </data>
97 <data format="tabular" name="results" label="${tool.name} (results) on ${on_string}">
98 <filter>show == "Nothing" or display_results == "yes"</filter>
99 </data>
100 <data format="tabular" name="rois" label="${tool.name} (particles coordinates) on ${on_string}">
101 <filter>export_rois</filter>
102 </data>
103 </outputs>
104 <tests>
105 <test expect_num_outputs="1">
106 <param name="input" value="blobs.gif"/>
107 <param name="show" value="Nothing"/>
108 <output name="results" file="analyze_particles_nothing.tabular"/>
109 </test>
110 <test expect_num_outputs="1">
111 <param name="input" value="blobs.gif"/>
112 <param name="show" value="Outlines"/>
113 <output name="output" file="analyze_particles_outlines.gif" compare="image_diff"/>
114 </test>
115 <test expect_num_outputs="1">
116 <param name="input" value="blobs.gif"/>
117 <param name="show" value="Bare_Outlines"/>
118 <param name="exclude_edges" value="yes"/>
119 <param name="include_holes" value="yes"/>
120 <output name="output" file="analyze_particles_bareoutlines.gif" compare="image_diff" metric="iou"/>
121 </test>
122 <test expect_num_outputs="3">
123 <param name="input" value="blobs.gif"/>
124 <param name="show" value="Overlay_Masks"/>
125 <param name="display_results" value="yes"/>
126 <param name="export_rois" value="true"/>
127 <output name="output" file="analyze_particles_overlaymasks.gif" compare="image_diff"/>
128 <output name="results" file="analyze_particles_nothing.tabular"/>
129 <output name="rois" file="analyze_particles_rois.tabular"/>
130 </test>
131 <test expect_num_outputs="3">
132 <param name="input" value="confocal-series-first-channel_threshold_default.tiff"/>
133 <param name="black_background" value="yes"/>
134 <param name="show" value="Overlay_Masks"/>
135 <param name="display_results" value="yes"/>
136 <param name="export_rois" value="true"/>
137 <output name="output" file="confocal-series-first-channel_threshold_default_overlay_mask.tiff" compare="sim_size"/>
138 <output name="results" file="confocal_analyze_particles.tabular"/>
139 <output name="rois" file="confocal_analyze_particles_rois.tabular"/>
140 </test>
141 <test expect_num_outputs="2">
142 <param name="input" value="blobs.gif"/>
143 <param name="size" value="100000-Infinity"/>
144 <param name="show" value="Nothing"/>
145 <param name="export_rois" value="true"/>
146 <output name="results">
147 <assert_contents>
148 <has_n_lines n="0"/>
149 </assert_contents>
150 </output>
151 <output name="rois" file="analyze_particles_rois_empty.tabular"/>
152 </test>
153 </tests>
154 <help>
155.. class:: warningmark
156
157@requires_binary_input@
158
159**What it does**
160
161<![CDATA[
162Counts and measures objects in binary or thresholded images. It works by scanning the image until
163it finds the edge of an object. It then outlines the object, measures it, fills it to make it
164invisible, then resumes scanning until it reaches the end of the image. Features of thresholded
165images can be extracted by specifying suitable **Size** and **Circularity** ranges and/or by choosing
166if particles should be traced by their outer edge or by flood filling.
167
168- **Size** - Particles with size (area) outside the range specified in this field are ignored. Values may range between 0 and ‘Infinity’. Enter a single value and particles smaller than that value will be ignored.
169- **Cicularity** - Particles with size circularity values outside the range specified in the min/max fields are also ignored.
170- **Show: Nothing** - No image will be generated, but **Display Results** will be set to Yes. Note that the particle analyzer will display a blank image when the count of detected particles is zero and **Show** is not **Nothing**.
171- **Show: Outlines** - Generates an 8-bit image containing numbered outlines of the measured particles (gray levels: Outlines: 0; Labels: 1; Background: 255).
172- **Show: Bare Outlines** - Generates an 8-bit image containing simple outlines of the measured particles without labels (graylevels: Outlines: 0; Background: 255).
173- **Show: Ellipses** - Generates an 8-bit image containing the best fit ellipse of each measured particle (gray levels: Ellipses: 0; Background: 255).
174- **Show: Masks** - Generates an 8-bit image containing filled outlines of the measured particles (gray levels: Masks: 0; Background: 255).
175- **Show: Count Masks** - Generates a 16-bit image containing filled outlines of the measured particles painted with a grayscale value corresponding to the particle number.
176- **Display Results** - If Yes, the measurements for each particle will be generated.
177- **All results** - If No, results will be restricted to the particle count, total particle area, average particle size, and area fraction.
178- **Exclude on Edges** - If Yes, particles touching the edge of the image will be ignored.
179- **Include Holes** - If Yes, interior holes will be included (set to No to exclude interior holes and to measure particles enclosed by other particles).
180]]>
181
182 </help>
183 <expand macro="fiji_headless_citations"/>
184</tool>