upstream/tools/image_processing/imagej2/imagej2_find_maxima.xml
1<tool id="imagej2_find_maxima" name="Find maxima" 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($output_type) == 'List' or str($output_type) == 'Count':
20 #set list_or_count = True
21#else:
22 #set output_filename = '.'.join(['output', $input.ext])
23 touch '$output_filename' &&
24 #set list_or_count = False
25#end if
26ImageJ --ij2 --headless --debug
27--jython '$__tool_directory__/imagej2_find_maxima_jython_script.py'
28'$input_with_ext'
29'$scale_when_converting'
30'$weighted_rgb_conversions'
31$noise_tolerance
32'$output_type'
33'$exclude_edge_maxima'
34'$light_background'
35#if $list_or_count:
36 '$results'
37 'tabular'
38#else:
39 '$output_filename'
40 '$input.ext'
41#end if
42#if $list_or_count
43 && mv '$results' '$output';
44#else
45 && mv '$output_filename' '$output';
46#end if
47]]></command>
48 <inputs>
49 <expand macro="param_input"/>
50 <param name="noise_tolerance" type="integer" value="10" min="0" label="Noise tolerance" help="Maxima are ignored if they do not stand out from the surroundings by more than this value."/>
51 <param name="output_type" type="select" label="Output type">
52 <option value="Single_Points" selected="True">Single Points</option>
53 <option value="Maxima_Within_Tolerance">Maxima Within Tolerance</option>
54 <option value="Segmented_Particles">Segmented Particles</option>
55 <!--
56 This version of Fiji does not produce the same resultsTable
57 as the previous version, so eliminating these options until
58 there is time to investigate
59 <option value="List">List</option>
60 <option value="Count">Count</option>
61 -->
62 </param>
63 <param name="exclude_edge_maxima" type="select" label="Exclude edge maxima?">
64 <option value="no" selected="True">No</option>
65 <option value="yes">Yes</option>
66 </param>
67 <param name="light_background" type="select" label="Light background?">
68 <option value="no" selected="True">No</option>
69 <option value="yes">Yes</option>
70 </param>
71 <param name="scale_when_converting" type="select" label="Scale when converting?" help="Applies only to 24-bit (RGB) images, ignored for other types.">
72 <option value="yes" selected="True">Yes</option>
73 <option value="no">No</option>
74 </param>
75 <param name="weighted_rgb_conversions" type="select" label="Weighted RGB conversions?" help="Applies only to 24-bit (RGB) images, ignored for other types.">
76 <option value="no" selected="True">No</option>
77 <option value="yes">Yes</option>
78 </param>
79 </inputs>
80 <outputs>
81 <data name="output" format_source="input">
82 <filter>output_type != "List" and output_type != "Count"</filter>
83 </data>
84 <!-- see comment at output_type parameter
85 <data name="results" format="tabular">
86 <filter>output_type == "List" or output_type == "Count"</filter>
87 </data> -->
88 </outputs>
89 <tests>
90 <test expect_num_outputs="1">
91 <param name="input" value="blobs.gif"/>
92 <output name="output" file="blobs_single_points.gif" compare="image_diff"/>
93 </test>
94 <test expect_num_outputs="1">
95 <param name="input" value="blobs.gif"/>
96 <param name="noise_tolerance" value="13"/>
97 <param name="output_type" value="Maxima_Within_Tolerance"/>
98 <output name="output" file="blobs_tolerance.gif" compare="image_diff"/>
99 </test>
100 <test expect_num_outputs="1">
101 <param name="input" value="blobs.gif"/>
102 <param name="noise_tolerance" value="16"/>
103 <param name="output_type" value="Segmented_Particles"/>
104 <param name="exclude_edge_maxima" value="yes"/>
105 <output name="output" file="blobs_segmented.gif" compare="image_diff"/>
106 </test>
107 <!--
108 This version of Fiji does not produce the same resultsTable
109 as the previous version, so eliminating these options until
110 there is time to investigate
111 <test>
112 <param name="input" value="blobs.gif" />
113 <param name="output_type" value="List" />
114 <output name="output" file="blobs_list.tabular" />
115 </test>
116 <test>
117 <param name="input" value="blobs.gif" />
118 <param name="output_type" value="Count" />
119 <output name="output" file="blobs_count.tabular" />
120 </test>
121 -->
122 </tests>
123 <help>
124
125**What it does**
126
127Determines the local maxima in an image and creates a binary (mask-like) image of the same size with the
128maxima (or one segmented particle per maximum) marked. For RGB images, maxima of luminance are selected
129with the luminance defined as the weighted or unweighted average of the colors depending on the **Scale
130when converting** and **Weighted RGB conversions** settings.
131
132- **Scale when converting** (RGB images only) - If "yes", the tool will scale from min--max to 0--255 when converting from 16-bit or 32-bit to 8-bit or to scale from min--max to 0--65535 when converting from 32-bit to 16-bit.
133
134- **Weighted RGB conversions** (RGB images only) - If "yes", the formula gray = 0.299 × red + 0.587 × green + 0.114 × blue is used to convert RGB images to grayscale. If "no", the formula gray = (red + green + blue) ⁄ 3 is used.
135
136- **Noise Tolerance** - Maxima are ignored if they do not stand out from the surroundings by more than this value (calibrated units for calibrated images). In other words, a threshold is set at the maximum value minus noise tolerance and the contiguous area around the maximum above the threshold is analyzed. For accepting a maximum, this area must not contain any point with a value higher than the maximum. Only one maximum within this area is accepted.
137
138- **Output Type** can be:
139
140 - **Single Points** - Produces an image with one single point per maximum.
141
142 - **Maxima Within Tolerance** - Produces an image with all points within the "Noise Tolerance" for each maximum.
143
144 - **Segmented Particles** - Assumes that each maximum belongs to a particle and segments the image by a watershed algorithm applied to the values of the image.
145
146 - **List** - Produces the list x, y of maxima in the image.
147
148 - **Count** - Produces the number of maxima in the image.
149
150- **Exclude Edge Maxima** - Excludes maxima if the area within the noise tolerance surrounding a maximum touches the edge of the image (edge of the selection does not matter).
151
152- **Light Background** - Select "yes" if the image background is brighter than the objects you want to find.
153
154 </help>
155 <expand macro="fiji_headless_citations"/>
156</tool>