comparison display_data_on_image.xml @ 3:4e12ef887a2a draft

"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
author bgruening
date Mon, 11 May 2020 07:55:32 -0400
parents 7c70e5268acd
children 6a7da2e5f696
comparison
equal deleted inserted replaced
2:7c70e5268acd 3:4e12ef887a2a
1 <tool id="cp_display_data_on_image" name="DisplayDataOnImage" version="@CP_VERSION@"> 1 <tool id="cp_display_data_on_image" name="DisplayDataOnImage" version="@CP_VERSION@">
2 <description>produce an image with data on top of identified objects</description> 2 <description>produce an image with data on top of identified objects</description>
3 <macros> 3 <macros>
4 <import>macros.xml</import> 4 <import>macros.xml</import>
5 <xml name="display_object"> 5 <xml name="display_object">
6 <param name="select_input_obj" label="Select the input objects" type="text" /> 6 <param name="select_input_obj" label="Enter the name of the input objects" type="text" help="Enter the name of the objects identified by some other tool used upstream in the workflow (such as IdentifyPrimaryObjects or IdentifySecondaryObjects)." />
7
7 <conditional name="con_obj_measurement_category"> 8 <conditional name="con_obj_measurement_category">
8 <param name="measurement_category" label="Measurement category" type="select"> 9 <param name="measurement_category" label="Measurement category" type="select" help="The measurement will be made by some other tool used upstream in the workflow on either the whole image or on the objects you selected.">
10
9 <option value="Location">Location</option> 11 <option value="Location">Location</option>
10 <option value="Number">Number</option> 12 <option value="Number">Number</option>
11 </param> 13 </param>
12 <when value="Number"> 14 <when value="Number">
13 <param name="measurement" label="Measurement" type="select"> 15 <param name="measurement" label="Measurement" type="select">
61 <option value="Frame">Frame</option> 63 <option value="Frame">Frame</option>
62 <option value="ImageId">ImageId</option> 64 <option value="ImageId">ImageId</option>
63 <option value="Screen">Screen</option> 65 <option value="Screen">Screen</option>
64 <option value="Series">Series</option> 66 <option value="Series">Series</option>
65 </param> 67 </param>
66 </when> 68 </when>
67 <when value="PathName"> 69 <when value="PathName">
68 <param name="measurement" label="Measurement" type="text" /> 70 <param name="measurement" label="Measurement" type="text" />
69 </when> 71 </when>
70 <when value="Scaling"> 72 <when value="Scaling">
71 <param name="measurement" label="Measurement" type="text" /> 73 <param name="measurement" label="Measurement" type="text" />
87 <param name="measurement" label="Measurement" type="text" /> 89 <param name="measurement" label="Measurement" type="text" />
88 </when> 90 </when>
89 </conditional> 91 </conditional>
90 </xml> 92 </xml>
91 </macros> 93 </macros>
92 94
93 <expand macro="py_requirements"/> 95 <expand macro="py_requirements"/>
94 <expand macro="cmd_modules" /> 96 <expand macro="cmd_modules" />
95 97
96 <configfiles> 98 <configfiles>
97 <inputs name="inputs" /> 99 <inputs name="inputs" />
98 <configfile name="script_file"> 100 <configfile name="script_file">
99 import json 101 import json
116 _str += FOURSPACES + "Display object or image measurements?:%s\n" % obj_img_params['display_obj_image'] 118 _str += FOURSPACES + "Display object or image measurements?:%s\n" % obj_img_params['display_obj_image']
117 119
118 input_obj = obj_img_params['select_input_obj'] if obj_img_params['display_obj_image'] == "Object" else "None" 120 input_obj = obj_img_params['select_input_obj'] if obj_img_params['display_obj_image'] == "Object" else "None"
119 121
120 _str += FOURSPACES + "Select the input objects:%s\n" % input_obj 122 _str += FOURSPACES + "Select the input objects:%s\n" % input_obj
121 _str += FOURSPACES + "Measurement to display:%s_%s\n" % (obj_img_params['con_obj_measurement_category'][ 123 _str += FOURSPACES + "Measurement to display:%s_%s\n" % (obj_img_params['con_obj_measurement_category']['measurement_category'],obj_img_params['con_obj_measurement_category']['measurement'])
122 'measurement_category'],obj_img_params['con_obj_measurement_category']['measurement']) 124 _str += FOURSPACES + "Select the image on which to display the measurements:%s\n" % params['image_to_display_measurements']
123 _str += FOURSPACES + "Select the image on which to display the measurements:%s\n" % params[
124 'image_to_display_measurements']
125 125
126 display_mode = display_mode_params['display_mode'] 126 display_mode = display_mode_params['display_mode']
127 127
128 if display_mode == "Text": 128 if display_mode == "Text":
129 text_color = display_mode_params['text_color'] 129 text_color = display_mode_params['text_color']
138 font_size = 11 138 font_size = 11
139 no_of_decimals = 0 139 no_of_decimals = 0
140 annotation_offset = 0 140 annotation_offset = 0
141 color_map = display_mode_params['color_map'] 141 color_map = display_mode_params['color_map']
142 color_map_scale = display_mode_params['con_color_map_scale']['color_map_scale'] 142 color_map_scale = display_mode_params['con_color_map_scale']['color_map_scale']
143 if color_map_scale == "Manual": 143
144 color_map_range ="%.1f,%.1f" % (display_mode_params['con_color_map_scale']['min_color_map_range'], display_mode_params['con_color_map_scale']['max_color_map_range']) 144 if color_map_scale == "Manual":
145 else: 145 color_map_range ="%.1f,%.1f" % (display_mode_params['con_color_map_scale']['min_color_map_range'],display_mode_params['con_color_map_scale']['max_color_map_range'])
146 color_map_range = "0.0,1.0" 146 else:
147 color_map_range = "0.0,1.0"
147 148
148 _str += FOURSPACES + "Text color:%s\n" % text_color 149 _str += FOURSPACES + "Text color:%s\n" % text_color
149 _str += FOURSPACES + "Name the output image that has the measurements displayed:%s\n" % params['name_output_image'] 150 _str += FOURSPACES + "Name the output image that has the measurements displayed:%s\n" % params['name_output_image']
150 _str += FOURSPACES + "Font size (points):%d\n" % font_size 151 _str += FOURSPACES + "Font size (points):%d\n" % font_size
151 _str += FOURSPACES + "Number of decimals:%d\n" % no_of_decimals 152 _str += FOURSPACES + "Number of decimals:%d\n" % no_of_decimals
167 168
168 module_count = int(v) 169 module_count = int(v)
169 new_count = module_count + 1 170 new_count = module_count + 1
170 lines[4] = k + ":%d\n" % new_count 171 lines[4] = k + ":%d\n" % new_count
171 172
172 with open("output", "w") as f: 173 with open("output.cppipe", "w") as f:
173 f.writelines(lines) 174 f.writelines(lines)
174 f.write(writemi()) 175 f.write(writemi())
175 176
176 f.close() 177 f.close()
177 </configfile> 178 </configfile>
178 </configfiles> 179 </configfiles>
179 180
180 <inputs> 181 <inputs>
181 <expand macro="input_pipeline_macro" /> 182 <expand macro="input_pipeline_param" />
182 <conditional name="con_display_obj_image"> 183 <conditional name="con_display_obj_image">
183 <param name="display_obj_image" type="select" label="Display object or image measurements?"> 184 <param name="display_obj_image" type="select" label="Display object or image measurements?">
184 <option value="Object">Object</option> 185 <option value="Object">Object</option>
185 <option value="Image">Image</option> 186 <option value="Image">Image</option>
186 </param> 187 </param>
190 <when value="Image"> 191 <when value="Image">
191 <expand macro="display_image" /> 192 <expand macro="display_image" />
192 </when> 193 </when>
193 </conditional> 194 </conditional>
194 195
195 <param name="display_background_image" label="Display background image?" type="select" display="radio"> 196 <param name="display_background_image" label="Display background image?" type="select" display="radio" help="Usually, you will want to see the image context for the measurements, but it may be useful to save just the overlay of the text measurements and composite the overlay image and the original image later.">
196 <option value="Yes">Yes</option> 197 <option value="Yes">Yes</option>
197 <option value="No">No</option> 198 <option value="No">No</option>
198 </param> 199 </param>
199 200
200 <param name="image_to_display_measurements" label="Select the image on which to display the measurements" type="text"> 201 <param name="image_to_display_measurements" label="Enter the name of the image on which to display the measurements" type="text">
201 <expand macro="text_validator" /> 202 <expand macro="text_validator" />
202 </param> 203 </param>
203 204
204 <conditional name="con_display_mode"> 205 <conditional name="con_display_mode">
205 <param name="display_mode" type="select" label="Display mode"> 206 <param name="display_mode" type="select" label="Display mode" help="If you choose Text, DisplayDataOnImage will display the numeric value on top of each object. If you choose Color, DisplayDataOnImage will convert the image to grayscale, if necessary, and display the portion of the image within each object using a hue that indicates the measurement value relative to the other objects in the set using the default color map.">
206 <option value="Text">Text</option> 207 <option value="Text">Text</option>
207 <option value="Color">Color</option> 208 <option value="Color">Color</option>
208 </param> 209 </param>
209 <when value="Text"> 210 <when value="Text">
210 <param name="text_color" type="color" label="Text color" /> 211 <param name="text_color" type="color" label="Text color" />
211 <param name="font_size" type="integer" label="Font size(points)" value="11" min="8"> 212 <param name="font_size" type="integer" label="Font size (points)" value="11" min="5">
212 </param> 213 </param>
213 <param name="number_of_decimals" type="integer" label="Number of decimals" value="0"/> 214 <param name="number_of_decimals" type="integer" label="Number of decimals" value="2" min="0" max="10"/>
214 <param name="annotation_offset" type="integer" label="Annotation offset (in pixels)" value="0" /> 215 <param name="annotation_offset" type="integer" label="Annotation offset (in pixels)" value="0" min="0" help="Normally, the text is placed at the object (or image) center, which can obscure relevant features of the object. This setting adds a specified offset to the text, in a random direction." />
215 </when> 216 </when>
216 <when value="Color"> 217 <when value="Color">
217 <param name="color_map" label="Color map" type="select" help="DisplayDataOnImage assigns a color to each object’s measurement value from a colormap when in colormap-mode, mapping the value to a color along the colormap’s continuum. This mapping has implicit upper and lower bounds to its range which are the extremes of the colormap. This setting determines whether the extremes are the minimum and maximum "> 218 <param name="color_map" label="Color map" type="select" help="DisplayDataOnImage assigns a color to each object’s measurement value from a colormap when in colormap-mode, mapping the value to a color along the colormap’s continuum. This mapping has implicit upper and lower bounds to its range which are the extremes of the colormap. This setting determines whether the extremes are the minimum and maximum ">
218 <option value="Default">Default</option> 219 <option value="Default">Default</option>
219 </param> 220 </param>
220 <conditional name="con_color_map_scale"> 221 <conditional name="con_color_map_scale">
221 <param name="color_map_scale" label="Color map scale" type="select" help="assigns a color to each object’s measurement value from a colormap when in colormap-mode, mapping the value to a color along the colormap’s continuum. This mapping has implicit upper and lower bounds to its range which are the extremes of the colormap. This setting determines whether the extremes are the minimum and maximum values of the measurement from among the objects in the current image or manually-entered extremes"> 222 <param name="color_map_scale" label="Color map scale" type="select">
223
224 <help>
225 <![CDATA[
226 This tool assigns a color to each object’s measurement value from a colormap when in colormap-mode, mapping the value to a color along the colormap’s continuum. This mapping has implicit upper and lower bounds to its range which are the extremes of the colormap. This setting determines whether the extremes are the minimum and maximum values of the measurement from among the objects in the current image or manually-entered extremes.
227 <br>- Use this image's measurement range: Use the full range of colors to get the maximum contrast within the image.
228 <br>- Manual: Manually set the upper and lower bounds so that images with different maxima and minima can be compared by a uniform color mapping.
229 ]]>
230 </help>
222 <option value="Use this image's measurement range">Use this image's measurement range</option> 231 <option value="Use this image's measurement range">Use this image's measurement range</option>
223 <option value="Manual">Manual</option> 232 <option value="Manual">Manual</option>
224 <sanitizer sanitize="false"/> 233 <sanitizer sanitize="false"/>
225 </param> 234 </param>
226 <when value="Manual"> 235 <when value="Manual">
227 <param name="min_color_map_range" label="Min. color map range" type="float" help="This setting determines the lower bounds of the values for the color map" value="0.0" min="0.0" /> 236 <param name="min_color_map_range" label="Min. color map range" type="float" help="This setting determines the lower bounds of the values for the color map" value="0.0" min="0.0" />
228 <param name="max_color_map_range" label="Max. color map range" type="float" help="This setting determines the upper bounds of the values for the color map" value="1.0" max="1.0" /> 237 <param name="max_color_map_range" label="Max. color map range" type="float" help="This setting determines the upper bounds of the values for the color map" value="1.0" max="1.0" />
229 </when> 238 </when>
230 <when value="Use this image's measurement range" /> 239 <when value="Use this image's measurement range" />
234 243
235 <param name="name_output_image" label="Name the output image that has the measurements displayed" type="text"> 244 <param name="name_output_image" label="Name the output image that has the measurements displayed" type="text">
236 <expand macro="text_validator" /> 245 <expand macro="text_validator" />
237 </param> 246 </param>
238 <param name="element_to_save" type="select" label="Image elements to save"> 247 <param name="element_to_save" type="select" label="Image elements to save">
248 <help>
249 <![CDATA[
250 This setting controls the level of annotation on the image:
251 <br>- Image: Saves the image with the overlaid measurement annotations.
252 <br>- Figure: Adds a title and other decorations.
253 <br>- Axes: Adds axes with tick marks and image coordinates.
254 ]]>
255 </help>
239 <option value="Image">Image</option> 256 <option value="Image">Image</option>
240 <option value="Figure">Figure</option> 257 <option value="Figure">Figure</option>
241 <option value="Axes">Axes</option> 258 <option value="Axes">Axes</option>
242 </param> 259 </param>
243 </inputs> 260 </inputs>
244 261
245 <outputs> 262 <outputs>
246 <expand macro="output_pipeline_macro" /> 263 <expand macro="output_pipeline_param" />
247 </outputs> 264 </outputs>
248 265
249 <tests> 266 <tests>
250 <test> 267 <test>
251 <expand macro="test_input_pipeline_param" /> 268 <expand macro="test_input_pipeline_param" />
267 <param name="annotation_offset" value="0" /> 284 <param name="annotation_offset" value="0" />
268 </conditional> 285 </conditional>
269 <param name="name_output_image" value="ImageDisplay" /> 286 <param name="name_output_image" value="ImageDisplay" />
270 <param name="element_to_save" value="Image" /> 287 <param name="element_to_save" value="Image" />
271 288
272 <expand macro="test_out_file" file="display_data_on_image.txt" /> 289 <expand macro="test_out_file" file="display_data_on_image.cppipe" />
273 </test> 290 </test>
274 </tests> 291 </tests>
275 <expand macro="help" module="DisplayDataOnImage"/> 292 <help>
293 <![CDATA[
294 .. class:: infomark
295
296 **What it does**
297
298 This module displays either a single image measurement on an image of your choosing, or one object measurement per object on top of every object in an image. The display itself is an image which you can save to a file using *SaveImages*.
299
300 @COMMON_HELP@
301 ]]>
302 </help>
276 <expand macro="citations" /> 303 <expand macro="citations" />
277 </tool> 304 </tool>