comparison identify_primary_objects.xml @ 3:52c01fb29b2a draft

"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
author bgruening
date Mon, 11 May 2020 07:48:09 -0400
parents d9bf32d13dfd
children b6eec6087271
comparison
equal deleted inserted replaced
2:d9bf32d13dfd 3:52c01fb29b2a
1 <tool id="cp_identify_primary_objects" name="IdentifyPrimaryObjects" version="@CP_VERSION@"> 1 <tool id="cp_identify_primary_objects" name="IdentifyPrimaryObjects" version="@CP_VERSION@">
2 <description>identify biological objects of interest</description> 2 <description>identify biological objects of interest</description>
3 3
4 <macros> 4 <macros>
5 <import>macros.xml</import> 5 <import>macros.xml</import>
6 <xml name="ipo_common"> 6 <xml name="ipo_common">
7 <param name="input_from_nat" type="text" label="Select the input image (from NamesAndTypes)"> 7 <param name="input_from_nat" type="text" label="Enter the name of the input image (from NamesAndTypes)">
8 <expand macro="text_validator" /> 8 <expand macro="text_validator" />
9 </param> 9 </param>
10 <param name="name_to_be_identified" type="text" label="Name the primary objects to be identified"> 10 <param name="name_to_be_identified" type="text" label="Enter the name of the primary objects to be identified">
11 <expand macro="text_validator" /> 11 <expand macro="text_validator" />
12 </param> 12 </param>
13 <param name="min_diameter" type="integer" label="Typical minimum diameter of objects, in pixel units (Min)" value="15" min="0" /> 13 <param name="min_diameter" type="integer" label="Typical minimum diameter of objects, in pixel units (Min)" value="10" min="0">
14 <param name="max_diameter" type="integer" label="Typical maximum diameter of objects, in pixel units (Max)" value="200" min="0" /> 14 <help>
15 <![CDATA[
16 The min and max diameters are crucial for two reasons: first, the module uses it to calculate certain automatic settings in order to identify your objects of interest properly (see below). Second, when used in conjunction with the 'Discard objects outside the diameter range?' setting below, you can choose to remove objects outside the size range you provide here.
17 ]]>
18 </help>
19 </param>
20 <param name="max_diameter" type="integer" label="Typical maximum diameter of objects, in pixel units (Max)" value="40" min="0" />
15 <param name="discard_outside_border" type="select" display="radio" label="Discard objects outside the diameter range?"> 21 <param name="discard_outside_border" type="select" display="radio" label="Discard objects outside the diameter range?">
16 <option value="Yes">Yes</option> 22 <option value="Yes">Yes</option>
17 <option value="No">No</option> 23 <option value="No">No</option>
18 </param> 24 </param>
19 <param name="discard_touching_border" type="select" display="radio" label="Discard objects touching the border of the image?"> 25 <param name="discard_touching_border" type="select" display="radio" label="Discard objects touching the border of the image?">
22 </param> 28 </param>
23 </xml> 29 </xml>
24 30
25 <xml name="clumped_objects_params"> 31 <xml name="clumped_objects_params">
26 <conditional name="con_smoothing_filter"> 32 <conditional name="con_smoothing_filter">
27 <param name="smoothing_filter" type="select" label="Automatically calculate size of smoothing filter for decluping?"> 33 <param name="smoothing_filter" type="select" label="Automatically calculate size of smoothing filter for declumping?">
34 <help>
35 <![CDATA[
36 Select 'Yes' to automatically calculate the amount of smoothing applied to the image to assist in declumping. Select "No" to manually enter the smoothing filter size.
37 This setting, along with the Minimum allowed distance between local maxima setting, affects whether objects close to each other are considered a single object or multiple objects. It does not affect the dividing lines between an object and the background.
38 Please note that this smoothing setting is applied after thresholding, and is therefore distinct from the threshold smoothing method setting above, which is applied before thresholding.
39 The size of the smoothing filter is automatically calculated based on the Typical diameter of objects, in pixel units (Min,Max) setting above. If you see too many objects merged that ought to be separate or too many objects split up that ought to be merged, you may want to override the automatically calculated value.
40 ]]>
41 </help>
28 <option value="Yes">Yes</option> 42 <option value="Yes">Yes</option>
29 <option value="No">No</option> 43 <option value="No">No</option>
30 </param> 44 </param>
31 <when value="No"> 45 <when value="No">
32 <param name="size_smoothing_filter" type="integer" label="Size of smoothing filter" value="1"/> 46 <param name="size_smoothing_filter" type="integer" label="Size of smoothing filter" min="0" max="1" value="1">
47 <help>
48 <![CDATA[
49 If you see too many objects merged that ought to be separated (under-segmentation), this value should be lower. If you see too many objects split up that ought to be merged (over-segmentation), the value should be higher.
50 Note that splitting and merging is also affected by your choice of settings for the setting, Automatically calculate minimum allowed distance between local maxima? It is an art to balance these two settings; read the help carefully for both.
51 Reducing the texture of objects by increasing the smoothing increases the chance that each real, distinct object has only one peak of intensity but also increases the chance that two distinct objects will be recognized as only one object. Note that increasing the size of the smoothing filter increases the processing time exponentially.
52 Enter 0 to prevent any image smoothing in certain cases; for example, for low resolution images with small objects ( < ~5 pixels in diameter).
53 ]]>
54 </help>
55 </param>
33 </when> 56 </when>
34 <when value="Yes" /> 57 <when value="Yes" />
35 </conditional> 58 </conditional>
36 <conditional name="con_min_distance"> 59 <conditional name="con_min_distance">
37 <param name="min_distance" type="select" label="Automatically calculate minimum allowed distance between local maxima?"> 60 <param name="min_distance" type="select" label="Automatically calculate minimum allowed distance between local maxima?">
61 <help>
62 <![CDATA[
63 Select "Yes" to automatically calculate the distance between intensity maxima to assist in declumping. Select "No" to manually enter the permissible maxima distance.
64 This setting, along with the Size of smoothing filter setting, affects whether objects close to each other are considered a single object or multiple objects. It does not affect the dividing lines between an object and the background. Local maxima that are closer together than the minimum allowed distance will be suppressed (the local intensity histogram is smoothed to remove the peaks within that distance).
65 The distance can be automatically calculated based on the minimum entered for the Typical diameter of objects, in pixel units (Min,Max) setting above, but if you see too many objects merged that ought to be separate, or too many objects split up that ought to be merged, you may want to override the automatically calculated value.
66 ]]>
67 </help>
38 <option value="Yes">Yes</option> 68 <option value="Yes">Yes</option>
39 <option value="No">No</option> 69 <option value="No">No</option>
40 </param> 70 </param>
41 <when value="No"> 71 <when value="No">
42 <param name="min_allowed_distance" type="integer" label="Supress local maxima that are closer than this minimum allowed distance" value="1" /> 72 <param name="min_allowed_distance" type="integer" label="Supress local maxima that are closer than this minimum allowed distance" value="7">
73 <help>
74 <![CDATA[
75 Enter a positive integer, in pixel units. If you see too many objects merged that ought to be separated (under-segmentation), the value should be lower. If you see too many objects split up that ought to be merged (over-segmentation), the value should be higher.
76 The maxima suppression distance should be set to be roughly equivalent to the radius of the smallest object of interest that you would expect to see in the experiment.
77 Any distinct 'objects' that are found but are within two times this distance from each other will be assumed to be actually two lumpy parts of the same object, and they will be merged.
78 Note that splitting and merging is also affected by your choice of settings for the setting 'Size of smoothing filter'.
79 ]]>
80 </help>
81 </param>
43 </when> 82 </when>
44 <when value="Yes" /> 83 <when value="Yes" />
45 </conditional> 84 </conditional>
46 <param name="speed_up" type="select" display="radio" label="Speed up by using lower-resolution image to find local maxima?"> 85 <param name="speed_up" type="select" display="radio" label="Speed up by using lower-resolution image to find local maxima?">
86 <help>
87 <![CDATA[
88 Select 'Yes' to down-sample the image for declumping. This can be helpful for saving processing time on large images.
89 Note that if you have entered a minimum object diameter of 10 or less, checking this box will have no effect.
90 ]]>
91 </help>
47 <option value="Yes">Yes</option> 92 <option value="Yes">Yes</option>
48 <option value="No">No</option> 93 <option value="No">No</option>
49 </param> 94 </param>
50 </xml> 95 </xml>
51 96
52 <xml name="clumped_objects"> 97 <xml name="clumped_objects">
53 <conditional name="con_dividing_lines"> 98 <conditional name="con_dividing_lines">
54 <param name="dividing_lines" type="select" label="Method to draw dividing lines between clumped objects"> 99 <param name="dividing_lines" type="select" label="Method to draw dividing lines between clumped objects">
100 <help>
101 <![CDATA[
102 This setting allows you to choose the method that is used to draw the line between segmented objects, provided that you have chosen to declump the objects. To decide between these methods, you can run Test mode to see the results of each.
103 <br> - Intensity: Works best where the dividing lines between clumped objects are dimmer than the remainder of the objects.
104 <br> - Technical description: Using the previously identified local maxima as seeds, this method is a watershed (Vincent and Soille, 1991) on the intensity image.
105 <br> - Shape: Dividing lines between clumped objects are based on the shape of the clump. For example, when a clump contains two objects, the dividing line will be placed where indentations occur between the two objects. The intensity patterns in the original image are largely irrelevant: the cells need not be dimmer along the lines between clumped objects. Technical description: Using the previously identified local maxima as seeds, this method is a watershed on the distance-transformed thresholded image.
106 <br> - Propagate: This method uses a propagation algorithm instead of a watershed. The image is ignored and the pixels are assigned to the objects by repeatedly adding unassigned pixels to the objects that are immediately adjacent to them. This method is suited in cases such as objects with branching extensions, for instance neurites, where the goal is to trace outward from the cell body along the branch, assigning pixels in the branch along the way. See the help for the IdentifySecondaryObjects module for more details on this method.
107 <br> - None: If objects are well separated and bright relative to the background, it may be unnecessary to attempt to separate clumped objects. Using the very fast None option, a simple threshold will be used to identify objects.
108 ]]>
109 </help>
55 <option value="Intensity">Intensity</option> 110 <option value="Intensity">Intensity</option>
56 <option value="Shape">Shape</option> 111 <option value="Shape">Shape</option>
57 <option value="Propagate">Propagate</option> 112 <option value="Propagate">Propagate</option>
58 <option value="None">None</option> 113 <option value="None">None</option>
59 </param> 114 </param>
64 <expand macro="clumped_objects_params"/> 119 <expand macro="clumped_objects_params"/>
65 </when> 120 </when>
66 <when value="Propagate"/> 121 <when value="Propagate"/>
67 <when value="None"/> 122 <when value="None"/>
68 </conditional> 123 </conditional>
69 </xml> 124 </xml>
125 <xml name="otsu_threshold_category">
126
127 <conditional name="con_threshold_class">
128 <param name="threshold_class" type="select" label="Two-class or three-class thresholding?">
129 <help>
130 <![CDATA[
131 - Two classes: Select this option if the grayscale levels are readily distinguishable into only two classes: foreground (i.e., regions of interest) and background.
132 <br> - Three classes: Choose this option if the grayscale levels fall instead into three classes: foreground, background and a middle intensity between the two. You will then be asked whether the middle intensity class should be added to the foreground or background class in order to generate the final two-class output.
133 ]]>
134 </help>
135 <option value="Two classes">Two classes</option>
136 <option value="Three classes">Three classes</option>
137 </param>
138 <when value="Three classes">
139 <param name="assign_pixel" type="select" label="Assign pixels in the middle intensity class to the foreground or the background?" help="Choose whether you want the pixels with middle grayscale intensities to be assigned to the foreground class or the background class.">
140 <option value="Foreground">Foreground</option>
141 <option value="Background">Background</option>
142 </param>
143 </when>
144 <when value="Two classes" />
145 </conditional>
146 </xml>
147 <xml name="threshold_values">
148 <param name="threshold_correction_factor" type="float" value="1.0" min="0.0" label="Threshold correction factor">
149 <help>
150 <![CDATA[
151 The value entered here adjusts the threshold either upwards or downwards, by multiplying it by this value.
152 A value of 1 means no adjustment, 0 to 1 makes the threshold more lenient and greater than 1 makes the threshold more stringent.
153 ]]>
154 </help>
155 </param>
156 <param name="threshold_lower" type="float" value="0.0" min="0.0" max="1.0" label="Lower bound on threshold">
157 <help>
158 <![CDATA[
159 This is helpful as a safety precaution: when the threshold as calculated automatically is clearly outside a reasonable range, the min/max allowable threshold will override the automatic threshold.
160 ]]>
161 </help>
162 </param>
163 <param name="threshold_upper" type="float" value="1.0" min="0.0" max="1.0" label="Upper bound on threshold"/>
164 </xml>
165 <xml name="threshold_smoothing_scale">
166 <param name="threshold_smoothing_scale" type="float" value="1.3488" label="Threshold smoothing scale">
167 <help>
168 <![CDATA[
169 This setting controls the scale used to smooth the input image before the threshold is applied.
170 The input image can be optionally smoothed before being thresholded.
171 Smoothing can improve the uniformity of the resulting objects, by removing holes and jagged edges caused by noise in the acquired image.
172 Smoothing is most likely not appropriate if the input image is binary, if it has already been smoothed or if it is an output of a pixel-based classifier.
173 The scale should be approximately the size of the artifacts to be eliminated by smoothing.
174 A Gaussian is used with a sigma adjusted so that 1/2 of the Gaussian’s distribution falls within the diameter given by the scale (sigma = scale / 0.674) Use a value of 0 for no smoothing.
175 Use a value of 1.3488 for smoothing with a sigma of 1.
176 ]]>
177 </help>
178 </param>
179 </xml>
180 <xml name="threshold_method_help">
181 <help>
182 <![CDATA[
183 The intensity threshold affects the decision of whether each pixel will be considered foreground (region(s) of interest) or background.
184 A higher threshold value will result in only the brightest regions being identified, whereas a lower threshold value will include dim regions.
185 When using the strategy "Global", you can have the threshold automatically calculated from a choice of several methods, however, when you choose "Adaptive" as the thresholding strategy, your only option is Otsu automatic thresholding.
186 The threshold that is used for each image is recorded as a per-image measurement, so if you are surprised by unusual measurements from one of your images, you might check whether the automatically calculated threshold was unusually high or low compared to the other images. See the FlagImage module if you would like to flag an image based on the threshold value.
187
188 <br> - Otsu: This approach calculates the threshold separating the two classes of pixels (foreground and background) by minimizing the variance within the each class.
189 ]]>
190 </help>
191 </xml>
70 </macros> 192 </macros>
71 193
72 <expand macro="py_requirements"/> 194 <expand macro="py_requirements"/>
73 <expand macro="cmd_modules" /> 195 <expand macro="cmd_modules" />
74
75 <configfiles> 196 <configfiles>
76 <inputs name="inputs" /> 197 <inputs name="inputs" />
77 198
78 <configfile name="script_file"> 199 <configfile name="script_file">
79 import json 200 import json
93 214
94 215
95 def write_ipo(): 216 def write_ipo():
96 _str = "\nIdentifyPrimaryObjects:[module_num:%d|svn_version:\\'Unknown\\'|variable_revision_number:13|show_window:True|notes:\\x5B\\'Identify the nuclei from the DNA channel.\\', \\'PARAMS\\x3A\\', \\'- Typical diameter of objects (Min,Max)\\', \\'- Method to distinguish clumped objects\\x3A Shape/None. With Shape, the distance between the 2 centers can be changed.\\'\\x5D|batch_state:array(\\x5B\\x5D, dtype=uint8)|enabled:True|wants_pause:False]\n" % new_count 217 _str = "\nIdentifyPrimaryObjects:[module_num:%d|svn_version:\\'Unknown\\'|variable_revision_number:13|show_window:True|notes:\\x5B\\'Identify the nuclei from the DNA channel.\\', \\'PARAMS\\x3A\\', \\'- Typical diameter of objects (Min,Max)\\', \\'- Method to distinguish clumped objects\\x3A Shape/None. With Shape, the distance between the 2 centers can be changed.\\'\\x5D|batch_state:array(\\x5B\\x5D, dtype=uint8)|enabled:True|wants_pause:False]\n" % new_count
97 218
219 _str += FOURSPACES + "Select the input image:%s\n" % ipo['input_from_nat']
220 _str += FOURSPACES + "Name the primary objects to be identified:%s\n" % ipo['name_to_be_identified']
221 _str += FOURSPACES + "Typical diameter of objects, in pixel units (Min,Max):%d,%d\n" % (ipo['min_diameter'], ipo['max_diameter'])
222 _str += FOURSPACES + "Discard objects outside the diameter range?:%s\n" % ipo['discard_outside_border']
223 _str += FOURSPACES + "Discard objects touching the border of the image?:%s\n" % ipo['discard_touching_border']
224
225
226 # default values when adv=no;required in the cppipe file
227 distinguish_clumped_objects = "Intensity"
228 dividing_lines = "Intensity"
229 size_smoothing_filter = 1
230 min_allowed_distance = 7
231 speed_up = "Yes"
232 fill_hole = "After both thresholding and declumping"
233 calc_size_smoothing_filter = "Yes"
234 calc_min_disance = "Yes"
235 excessive_handling = "Continue"
236 max_obj = 500
237 thre_setting_version = 10
238 threshold_strategy = "Global"
239 threshold_method = "Minimum cross entropy"
240 threshold_smoothing_scale = 1.3488
241 threshold_correction_factor = 1.0
242 threshold_lower = 0.0
243 threshold_upper = 1.0
244 manual_threshold = 0.0
245 threshold_measurement = "None"
246 threshold_class = "Two classes"
247 assign_pixel = "Foreground"
248 adaptive_window = 50
249 lower_outlier_fraction = 0.05
250 upper_outlier_fraction = 0.05
251 avg_method = "Mean"
252 variance_method = "Standard deviation"
253 no_of_deviation = 2.0
254
98 if adv == "Yes": 255 if adv == "Yes":
99 _str += FOURSPACES + "Select the input image:%s\n" % ipo['input_from_nat'] 256 distinguish_clumped_objects = ipo['con_distinguish_clumped_objects'][
100 _str += FOURSPACES + "Name the primary objects to be identified:%s\n" % ipo['name_to_be_identified'] 257 'distinguish_clumped_objects']
101 _str += FOURSPACES + "Typical diameter of objects, in pixel units (Min,Max):%d,%d\n" % (ipo['min_diameter'], ipo['max_diameter'])
102 _str += FOURSPACES + "Discard objects outside the diameter range?:%s\n" % ipo['discard_outside_border']
103 _str += FOURSPACES + "Discard objects touching the border of the image?:%s\n" % ipo['discard_touching_border']
104
105 _str += FOURSPACES + "Method to distinguish clumped objects:%s\n" % ipo['con_distinguish_clumped_objects']['distinguish_clumped_objects']
106
107 if "con_dividing_lines" in ipo['con_distinguish_clumped_objects']: 258 if "con_dividing_lines" in ipo['con_distinguish_clumped_objects']:
108 smoothing = ipo['con_distinguish_clumped_objects']['con_dividing_lines']['con_smoothing_filter'][ 259 smoothing = ipo['con_distinguish_clumped_objects']['con_dividing_lines']['con_smoothing_filter']['smoothing_filter']
109 'smoothing_filter']
110 supress = ipo['con_distinguish_clumped_objects']['con_dividing_lines']['con_min_distance']['min_distance'] 260 supress = ipo['con_distinguish_clumped_objects']['con_dividing_lines']['con_min_distance']['min_distance']
111 261 dividing_lines = ipo['con_distinguish_clumped_objects']['con_dividing_lines']['dividing_lines']
112 _str += FOURSPACES + "Method to draw dividing lines between clumped objects:%s\n" % ipo['con_distinguish_clumped_objects']['con_dividing_lines']['dividing_lines']
113 262
114 if smoothing == "Yes": 263 if smoothing == "Yes":
115 _str += FOURSPACES + "Size of smoothing filter:0\n" 264 size_smoothing_filter= 0
116 else: 265 else:
117 _str += FOURSPACES + "Size of smoothing filter:%d\n" % ipo['con_distinguish_clumped_objects']['con_dividing_lines']['con_smoothing_filter']['size_smoothing_filter'] 266 size_smoothing_filter = ipo['con_distinguish_clumped_objects']['con_dividing_lines']['con_smoothing_filter'][
118 267 'size_smoothing_filter']
119 if supress == "Yes": 268
120 _str += FOURSPACES + "Suppress local maxima that are closer than this minimum allowed distance:7\n" 269 if supress == "No":
270 min_allowed_distance = ipo['con_distinguish_clumped_objects']['con_dividing_lines']['con_min_distance'][
271 'min_allowed_distance']
272
273 speed_up = ipo['con_distinguish_clumped_objects']['con_dividing_lines']['speed_up']
274
275 calc_size_smoothing_filter = ipo['con_distinguish_clumped_objects']['con_dividing_lines']['con_smoothing_filter'][
276 'smoothing_filter']
277 calc_min_disance = ipo['con_distinguish_clumped_objects']['con_dividing_lines']['con_min_distance']['min_distance']
278
279 fill_hole = ipo['fill_hole']
280
281 if "con_handling_excessive" in ipo:
282 excessive_handling = ipo['con_handling_excessive']['excessive_handling']
283 if excessive_handling == "Continue":
284 max_obj = 500
121 else: 285 else:
122 _str += FOURSPACES + "Suppress local maxima that are closer than this minimum allowed distance:%d\n" % ipo['con_distinguish_clumped_objects']['con_dividing_lines']['con_min_distance']['min_allowed_distance'] 286 max_obj = ipo['con_handling_excessive']['max_obj']
123 287
124 _str += FOURSPACES + "Speed up by using lower-resolution image to find local maxima?:%s\n" % ipo['con_distinguish_clumped_objects']['con_dividing_lines']['speed_up'] 288 threshold_strategy=ipo['con_threshold_strategy']['threshold_strategy']
125 289 threshold_method = ipo['con_threshold_strategy']['con_threshold_method']['threshold_method']
126 _str += FOURSPACES + "Fill holes in identified objects?:%s\n" % ipo['fill_hole'] 290
127 291 if threshold_strategy =="Adaptive":
128 if "con_dividing_lines" in ipo['con_distinguish_clumped_objects']: 292 adaptive_window =ipo['con_threshold_strategy']['adaptive_window']
129 _str += FOURSPACES + "Automatically calculate size of smoothing filter for declumping?:%s\n" % ipo['con_distinguish_clumped_objects']['con_dividing_lines']['con_smoothing_filter']['smoothing_filter'] 293 threshold_smoothing_scale = ipo['con_threshold_strategy']['threshold_smoothing_scale']
130 _str += FOURSPACES + "Automatically calculate minimum allowed distance between local maxima?:%s\n" % ipo['con_distinguish_clumped_objects']['con_dividing_lines']['con_min_distance']['min_distance'] 294 threshold_class = ipo['con_threshold_strategy']['con_threshold_method']['con_threshold_class'][
131 295 'threshold_class']
132 if "con_handling_excessive" in ipo: 296 if threshold_class == "Three classes":
133 excessive = ipo['con_handling_excessive']['excessive_handling'] 297 assing_pixel = ipo['con_threshold_strategy']['con_threshold_method']['con_threshold_class']['assign_pixel']
134 298 else:
135 _str += FOURSPACES + "Handling of objects if excessive number of objects identified:%s\n" % ipo['con_handling_excessive']['excessive_handling'] 299 if threshold_method == "Manual":
136 if excessive == "Continue": 300 manual_threshold = ipo['con_threshold_strategy']['con_threshold_method']['manual_threshold']
137 _str += FOURSPACES + "Maximum number of objects:500\n"
138 else: 301 else:
139 _str += FOURSPACES + "Maximum number of objects:%d\n" + ipo['con_handling_excessive']['max_obj'] 302 if threshold_method == "Measurement":
140 303 threshold_measurement = ipo['con_threshold_strategy']['con_threshold_method']['global_measurement_threshold_cat'] +"_" +ipo['con_threshold_strategy']['con_threshold_method']['global_measurement_threshold_measurement']
141 _str += FOURSPACES + "Use advanced settings?:%s\n" % ipo['advanced'] 304
142 _str += FOURSPACES + "Threshold settings version:10\n" 305 if threshold_method == "Otsu":
143 _str += FOURSPACES + "Threshold strategy:%s\n" % ipo['con_threshold_strategy']['threshold_strategy'] 306 threshold_class = ipo['con_threshold_strategy']['con_threshold_method']['con_threshold_class'][
144 307 'threshold_class']
145 threshold_method = ipo['con_threshold_method']['threshold_method'] 308 if threshold_class == "Three classes":
146 _str += FOURSPACES + "Thresholding method:%s\n" % threshold_method 309 assign_pixel=ipo['con_threshold_strategy']['con_threshold_method']['con_threshold_class']['assign_pixel']
147 310
148 _str += FOURSPACES + "Threshold smoothing scale:%.4f\n" % ipo['threshold_smoothing_scale'] 311 threshold_smoothing_scale = ipo['con_threshold_strategy']['con_threshold_method']['threshold_smoothing_scale']
149 _str += FOURSPACES + "Threshold correction factor:%.1f\n" % ipo['threshold_correction_factor'] 312
150 _str += FOURSPACES + "Lower and upper bounds on threshold:%.1f,%.1f\n" % (ipo['threshold_lower'], ipo['threshold_upper']) 313 if threshold_method == "Minimum cross entropy":
151 314 threshold_smoothing_scale = ipo['con_threshold_strategy']['con_threshold_method']['threshold_smoothing_scale']
152 if threshold_method == "Manual": 315
153 _str += FOURSPACES + "Manual threshold:%d\n" % ipo['con_threshold_method']['manual_threshold'] 316 if threshold_method == "RobustBackground":
154 else: 317 threshold_smoothing_scale = ipo['con_threshold_strategy']['con_threshold_method']['threshold_smoothing_scale']
155 _str += FOURSPACES + "Manual threshold:0\n" 318 lower_outlier_fraction = ipo['con_threshold_strategy']['con_threshold_method']['lower_outlier_fraction']
156 319 upper_outlier_fraction =ipo['con_threshold_strategy']['con_threshold_method']['upper_outlier_fraction']
157 if threshold_method == "Measurement": 320 avg_method = ipo['con_threshold_strategy']['con_threshold_method']['avg_method']
158 _str += FOURSPACES + "Select the measurement to threshold with:%s\n" % ipo['con_threshold_method']['threshold_measurement'] 321 variance_method = ipo['con_threshold_strategy']['con_threshold_method'] ['variance_method']
159 else: 322 no_of_deviation = ipo['con_threshold_strategy']['con_threshold_method']['no_of_deviations']
160 _str += FOURSPACES + "Select the measurement to threshold with:None\n" 323
161 324 threshold_correction_factor = ipo['con_threshold_strategy']['con_threshold_method'][
162 threshold_class = ipo['con_threshold_method']['con_threshold_class']['threshold_class'] 325 'threshold_correction_factor']
163 _str += FOURSPACES + "Two-class or three-class thresholding?:%s\n" % threshold_class 326 threshold_lower = ipo['con_threshold_strategy']['con_threshold_method']['threshold_lower']
164 327 threshold_upper = ipo['con_threshold_strategy']['con_threshold_method']['threshold_upper']
165 if threshold_class == "Three classes": 328
166 _str += FOURSPACES + "Assign pixels in the middle intensity class to the foreground or the background?:%s\n" % threshold_class['assign_pixel'] 329 _str += FOURSPACES + "Method to distinguish clumped objects:%s\n" % distinguish_clumped_objects
167 else: 330 _str += FOURSPACES + "Method to draw dividing lines between clumped objects:%s\n" % dividing_lines
168 _str += FOURSPACES + "Assign pixels in the middle intensity class to the foreground or the background?:Foreground\n" 331 _str += FOURSPACES + "Size of smoothing filter:%d\n" % size_smoothing_filter
169 332 _str += FOURSPACES + "Suppress local maxima that are closer than this minimum allowed distance:%d\n" % min_allowed_distance
170 if ipo['con_threshold_strategy']['threshold_strategy'] == "Adaptive": 333 _str += FOURSPACES + "Speed up by using lower-resolution image to find local maxima?:%s\n" % speed_up
171 _str += FOURSPACES + "Size of adaptive window:%d\n" + ipo['con_threshold_strategy']['adaptive_window'] 334 _str += FOURSPACES + "Fill holes in identified objects?:%s\n" % fill_hole
172 else: 335 _str += FOURSPACES + "Automatically calculate size of smoothing filter for declumping?:%s\n" % calc_size_smoothing_filter
173 _str += FOURSPACES + "Size of adaptive window:500\n" 336 _str += FOURSPACES + "Automatically calculate minimum allowed distance between local maxima?:%s\n" % calc_min_disance
174 337 _str += FOURSPACES + "Handling of objects if excessive number of objects identified:%s\n" % excessive_handling
175 if threshold_method == "RobustBackground": 338 _str += FOURSPACES + "Maximum number of objects:%d\n" % max_obj
176 _str += FOURSPACES + "Lower outlier fraction:%.2f\n" % ipo['con_threshold_method']['lower_outlier_fraction'] 339
177 _str += FOURSPACES + "Upper outlier fraction:%.2f\n" % ipo['con_threshold_method']['upper_outlier_fraction'] 340 _str += FOURSPACES + "Use advanced settings?:%s\n" % adv
178 _str += FOURSPACES + "Averaging method:%s\n" % ipo['con_threshold_method']['avg_method'] 341 _str += FOURSPACES + "Threshold settings version:10\n"
179 _str += FOURSPACES + "Variance method:%s\n" % ['variance_method'] 342 _str += FOURSPACES + "Threshold strategy:%s\n" % threshold_strategy
180 _str += FOURSPACES + "# of deviations:%.2f\n" % ipo['con_threshold_method']['no_of_deviations'] 343 _str += FOURSPACES + "Thresholding method:%s\n" % threshold_method
181 else: 344 _str += FOURSPACES + "Threshold smoothing scale:%.4f\n" % threshold_smoothing_scale
182 _str += FOURSPACES + "Lower outlier fraction:0.05\n" 345 _str += FOURSPACES + "Threshold correction factor:%.1f\n" % threshold_correction_factor
183 _str += FOURSPACES + "Upper outlier fraction:0.05\n" 346 _str += FOURSPACES + "Lower and upper bounds on threshold:%.1f,%.1f\n" % (threshold_lower, threshold_upper)
184 _str += FOURSPACES + "Averaging method:Mean\n" 347 _str += FOURSPACES + "Manual threshold:%d\n" % manual_threshold
185 _str += FOURSPACES + "Variance method:Standard deviation\n" 348 _str += FOURSPACES + "Select the measurement to threshold with:%s\n" % threshold_measurement
186 _str += FOURSPACES + "# of deviations:2.0\n" 349 _str += FOURSPACES + "Two-class or three-class thresholding?:%s\n" % threshold_class
187 350 _str += FOURSPACES + "Assign pixels in the middle intensity class to the foreground or the background?:%s\n" % assign_pixel
188 _str += FOURSPACES + "Thresholding method:%s\n" % threshold_method # This is a repeated entry, but needed for pipeline file 351 _str += FOURSPACES + "Size of adaptive window:%d\n" % adaptive_window
352 _str += FOURSPACES + "Lower outlier fraction:%.2f\n" % lower_outlier_fraction
353 _str += FOURSPACES + "Upper outlier fraction:%.2f\n" % upper_outlier_fraction
354 _str += FOURSPACES + "Averaging method:%s\n" % avg_method
355 _str += FOURSPACES + "Variance method:%s\n" % variance_method
356 _str += FOURSPACES + "# of deviations:%.2f\n" % no_of_deviation
357
358 _str += FOURSPACES + "Thresholding method:%s\n" % threshold_method # This is a repeated entry, but needed for pipeline file
189 359
190 return _str 360 return _str
191 361
192 362
193 with open(input_pipeline) as fin: 363 with open(input_pipeline) as fin:
196 k, v = lines[4].strip().split(':') 366 k, v = lines[4].strip().split(':')
197 367
198 module_count = int(v) 368 module_count = int(v)
199 new_count = module_count + 1 369 new_count = module_count + 1
200 lines[4] = k + ":%d\n" % new_count 370 lines[4] = k + ":%d\n" % new_count
201 with open("output", "w") as f: 371 with open("output.cppipe", "w") as f:
202 f.writelines(lines) 372 f.writelines(lines)
203 f.write(write_ipo()) 373 f.write(write_ipo())
204 374 f.close()
205 f.close() 375 </configfile>
206 </configfile>
207 </configfiles> 376 </configfiles>
208 377
209 <inputs> 378 <inputs>
210 <expand macro="input_pipeline_macro" /> 379 <expand macro="input_pipeline_param" />
211 <conditional name="con_advanced"> 380 <conditional name="con_advanced">
212 <param name="advanced" type="select" display="radio" label="Use advanced settings?"> 381 <param name="advanced" type="select" label="Use advanced settings?">
213 <option value="No">No</option> 382 <option value="No">No, use basic settings</option>
214 <option value="Yes">Yes</option> 383 <option value="Yes">Yes, use advanced settings</option>
215 </param> 384 </param>
216 <when value="No"> 385 <when value="No">
217 <expand macro="ipo_common" /> 386 <expand macro="ipo_common" />
218 </when> 387 </when>
219 <when value="Yes"> 388 <when value="Yes">
220 <expand macro="ipo_common" /> 389 <expand macro="ipo_common" />
221 <conditional name="con_threshold_strategy"> 390 <conditional name="con_threshold_strategy">
222 <param name="threshold_strategy" type="select" label="Threshold strategy"> 391 <param name="threshold_strategy" type="select" label="Threshold strategy">
392 <help>
393 <![CDATA[
394 The thresholding strategy determines the type of input that is used to calculate the threshold. These options allow you to calculate a threshold based on the whole image or based on image sub-regions.
395 The choices for the threshold strategy are:
396
397 <br> - Global: Calculates a single threshold value based on the unmasked pixels of the input image and use that value to classify pixels above the threshold as foreground and below as background.
398 image0 This strategy is fast and robust, especially if the background is relatively uniform (for example, after illumination correction).
399
400 <br> - Adaptive: Calculates a different threshold for each pixel, thus adapting to changes in foreground/background intensities across the image. For each pixel, the threshold is calculated based on the pixels within a given neighborhood (or window) surrounding that pixel.
401 image1 This method is slower but can produce better results for non-uniform backgrounds. However, for significant illumination variation, using the CorrectIllumination modules is preferable.
402 ]]>
403 </help>
223 <option value="Global">Global</option> 404 <option value="Global">Global</option>
224 <option value="Adaptive">Adaptive</option> 405 <option value="Adaptive" selected="true">Adaptive</option>
225 </param> 406 </param>
226 <when value="Adaptive"> 407 <when value="Adaptive">
227 <param name="adaptive_window" type="integer" label="Size of adaptive window" value="500"/> 408 <conditional name="con_threshold_method">
409 <param name="threshold_method" type="select" label="Thresholding method">
410 <expand macro="threshold_method_help"/>
411 <option value="Otsu" selected="True">Otsu</option>
412 </param>
413 <when value="Otsu">
414 <expand macro="otsu_threshold_category" />
415
416 </when>
417 </conditional>
418 <param name="adaptive_window" type="integer" label="Size of the adaptive window" value="50" help="Often a good choice is some multiple of the largest expected object size." />
419 <expand macro="threshold_smoothing_scale" />
420 <expand macro="threshold_values" />
228 </when> 421 </when>
229 <when value="Global" /> 422 <when value="Global">
230 </conditional> 423 <conditional name="con_threshold_method">
231 <conditional name="con_threshold_method"> 424 <param name="threshold_method" type="select" label="Thresholding method">
232 <param name="threshold_method" type="select" label="Thresholding method"> 425 <expand macro="threshold_method_help"/>
233 <option value="Manual">Manual</option> 426 <option value="Manual">Manual</option>
234 <option value="Measurement">Measurement</option> 427 <option value="Measurement">Measurement</option>
235 <option value="Minimum cross entropy">Minimum cross entropy</option> 428 <option value="Minimum cross entropy">Minimum cross entropy</option>
236 <option value="Otsu">Otsu</option> 429 <option value="Otsu" selected="True">Otsu</option>
237 <option value="RobustBackground">RobustBackground</option> 430 <option value="RobustBackground">Robust background</option>
238 </param>
239 <when value="Otsu">
240 <conditional name="con_threshold_class">
241 <param name="threshold_class" type="select" label="Two-class or three-class thresholding?">
242 <option value="Two classes">Two classes</option>
243 <option value="Three classes">Three classes</option>
244 </param> 431 </param>
245 <when value="Three classes"> 432 <when value="Otsu">
246 <param name="assign_pixel" type="select" label="Assign pixels in the middle intensity class to the foreground or the background?"> 433 <expand macro="otsu_threshold_category" />
247 <option value="Foreground">Foreground</option> 434
248 <option value="Background">Background</option> 435 <expand macro="threshold_smoothing_scale" />
436 <expand macro="threshold_values" />
437 </when>
438 <when value="Manual">
439 <param name="manual_threshold" type="float" label="Enter the value that will act as an absolute threshold for the images" min="0" max="1" value="0" />
440 </when>
441 <when value="RobustBackground">
442 <param name="lower_outlier_fraction" type="float" value="0.05" min="0.0" max="1.0" label="Lower outlier fraction" />
443 <param name="upper_outlier_fraction" type="float" value="0.05" min="0.0" max="1.0" label="Upper outlier fraction" />
444 <param name="avg_method" type="select" label="Averaging method">
445 <option value="Mean">Mean</option>
446 <option value="Median">Median</option>
447 <option value="Mode">Mode</option>
249 </param> 448 </param>
449 <param name="variance_method" type="select" label="Variance">
450 <option value="Standard deviation">Standard deviation</option>
451 <option value="Median absolute deviation">Median absolute deviation</option>
452 </param>
453 <param name="no_of_deviations" type="float" value="2.0" label="# of deviations">
454 <help>
455 <![CDATA[
456 Robust background calculates the variance, multiplies it by the value given by this setting and adds it to the average.
457 Adding several deviations raises the threshold well above the average. Use a larger number to be more stringent about identifying foreground pixels.
458 Use a smaller number to be less stringent. It’s even possible to use a negative number if you want the threshold to be lower than the average (e.g., for images that are densely covered by foreground).
459 ]]>
460 </help>
461 </param>
462 <expand macro="threshold_smoothing_scale" />
463 <expand macro="threshold_values" />
250 </when> 464 </when>
251 <when value="Two classes" /> 465 <when value="Measurement">
466 <param name="global_measurement_threshold_cat" type="select" label="Select the measurement category to threshold with">
467 <option value="FileName">File Name</option>
468 <option value="Frame">Frame</option>
469 <option value="Height">Height</option>
470 <option value="MD5Digest">MD5Digest</option>
471 <option value="PathName">Path Name</option>
472 <option value="Scaling">Scaling</option>
473 <option value="Series">Series</option>
474 <option value="URL">URL</option>
475 <option value="Width">Width</option>
476 </param>
477 <param name="global_measurement_threshold_measurement" type="text" label="Select the measurement to threshold with">
478 <help>
479 Measurement corresponds to the names in Starting modules.
480 </help>
481 </param>
482 <expand macro="threshold_values" />
483 </when>
484 <when value="Minimum cross entropy">
485 <expand macro="threshold_smoothing_scale" />
486 <expand macro="threshold_values" />
487 </when>
252 </conditional> 488 </conditional>
253 </when> 489 </when>
254 <when value="Manual"> 490 </conditional>
255 <param name="manual_threshold" type="integer" label="Manual threshold" value="0" /> 491
256 </when> 492
257 <when value="RobustBackground">
258 <param name="lower_outlier_fraction" type="float" value="0.05" label="Lower outlier fraction" />
259 <param name="upper_outlier_fraction" type="float" value="0.05" label="Upper outlier fraction" />
260 <param name="avg_method" type="select" label="Averaging method">
261 <option value="Mean">Mean</option>
262 <option value="Median">Median</option>
263 <option value="Mode">Mode</option>
264 </param>
265 <param name="variance_method" type="select" label="Variance">
266 <option value="Standard deviation">Standard deviation</option>
267 <option value="Median absolute deviation">Median absolute deviation</option>
268 </param>
269 <param name="no_of_deviations" type="float" value="2.0" label="# of deviations" />
270 </when>
271 <when value="Measurement"/>
272 <when value="Minimum cross entropy"/>
273 </conditional>
274 <param name="threshold_smoothing_scale" type="float" value="0.0" label="Threshold smoothing scale"/>
275 <param name="threshold_correction_factor" type="float" value="0.0" label="Threshold correction factor"/>
276 <param name="threshold_lower" type="float" value="0.0" label="Lower bounds on threshold"/>
277 <param name="threshold_upper" type="float" value="1.0" label="Upper bounds on threshold"/>
278 <conditional name="con_distinguish_clumped_objects"> 493 <conditional name="con_distinguish_clumped_objects">
279 <param name="distinguish_clumped_objects" type="select" label="Method to distinguish clumped objects"> 494 <param name="distinguish_clumped_objects" type="select" label="Method to distinguish clumped objects">
495 <help>
496 <![CDATA[
497 This setting allows you to choose the method that is used to distinguish between individual objects that are touching each other (and not properly delineated as two objects by thresholding alone). In other words, this setting allows you to “declump” a large, merged object into individual objects of interest. To decide between these methods, you can run Test mode to see the results of each.
498 <br> - Intensity: For objects that tend to have only a single peak of brightness (e.g., objects that are brighter towards their interiors and dimmer towards their edges), this option counts each intensity peak as a separate object. The objects can be any shape, so they need not be round and uniform in size as would be required for the Shape option.
499 <br> - Shape: For cases when there are definite indentations separating objects. The image is converted to black and white (binary) and the shape determines whether clumped objects will be distinguished. The declumping results of this method are affected by the thresholding method you choose.
500 <br> - None: If objects are well separated and bright relative to the background, it may be unnecessary to attempt to separate clumped objects. Using the very fast None option, a simple threshold will be used to identify objects.
501 ]]>
502 </help>
280 <option value="Shape">Shape</option> 503 <option value="Shape">Shape</option>
281 <option value="Intensity">Intensity</option> 504 <option value="Intensity" selected="True">Intensity</option>
282 <option value="None">None</option> 505 <option value="None">None</option>
283 </param> 506 </param>
284 <when value="Shape"> 507 <when value="Shape">
285 <expand macro="clumped_objects"/> 508 <expand macro="clumped_objects"/>
286 </when> 509 </when>
288 <expand macro="clumped_objects"/> 511 <expand macro="clumped_objects"/>
289 </when> 512 </when>
290 <when value="None"/> 513 <when value="None"/>
291 </conditional> 514 </conditional>
292 <param name="fill_hole" type="select" label="Fill holes in identified objects"> 515 <param name="fill_hole" type="select" label="Fill holes in identified objects">
516 <help>
517 <![CDATA[
518 This option controls how holes (regions of background surrounded by one or more objects) are filled in:
519 <br> - After both thresholding and declumping: Fill in holes that are smaller than the maximum object size prior to declumping and to fill in any holes after declumping.
520 <br> - After declumping only: Fill in holes located within identified objects after declumping.
521 <br> - Never: Leave holes within objects. Please note that if an object is located within a hole and this option is enabled, the object will be lost when the hole is filled in.
522 ]]>
523 </help>
293 <option value="Never">Never</option> 524 <option value="Never">Never</option>
294 <option value="After both thresholding and declumping">After both thresholding and declumping</option> 525 <option value="After both thresholding and declumping" selected="True">After both thresholding and declumping</option>
295 <option value="After declumping only">After declumping only</option> 526 <option value="After declumping only">After declumping only</option>
296 </param> 527 </param>
297 528
298 <conditional name="con_handling_excessive"> 529 <conditional name="con_handling_excessive">
299 <param name="excessive_handling" type="select" label="Handling of objects if excessive number of objects identified"> 530 <param name="excessive_handling" type="select" label="Handling of objects if excessive number of objects identified">
531 <help>
532 <![CDATA[
533 This setting deals with images that are segmented into an unreasonable number of objects. This might happen if the module calculates a low threshold or if the image has unusual artifacts. IdentifyPrimaryObjects can handle this condition in one of three ways:
534 <br> - Continue: Continue processing regardless if large numbers of objects are found.
535 <br> - Erase: Erase all objects if the number of objects exceeds the maximum. This results in an image with no primary objects. This option is a good choice if a large number of objects indicates that the image should not be processed; it can save a lot of time in subsequent Measure modules.
536 ]]>
537 </help>
300 <option value="Continue">Continue</option> 538 <option value="Continue">Continue</option>
301 <option value="Erase">Erase</option> 539 <option value="Erase">Erase</option>
302 </param> 540 </param>
303 <when value="Erase"> 541 <when value="Erase">
304 <param name="max_obj" type="integer" value="500" label="Maximum number of objects" /> 542 <param name="max_obj" type="integer" value="500" label="Maximum number of objects" help="This setting limits the number of objects in the image." />
305 </when> 543 </when>
306 <when value="Continue" /> 544 <when value="Continue" />
307 </conditional> 545 </conditional>
308 </when> 546 </when>
309 </conditional> 547 </conditional>
310 </inputs> 548 </inputs>
311 549
312 <outputs> 550 <outputs>
313 <expand macro="output_pipeline_macro" /> 551 <expand macro="output_pipeline_param" />
314 </outputs> 552 </outputs>
315 553
316 <tests> 554 <tests>
317 <test> 555 <test>
556 <!-- no advanced setting -->
557 <expand macro="test_input_pipeline_param" />
558 <conditional name="con_advanced">
559 <param name="advanced" value="No" />
560 <param name="input_from_nat" value="DNA" />
561 <param name="name_to_be_identified" value="Nuclei" />
562 <param name="min_diameter" value="15" />
563 <param name="max_diameter" value="200" />
564 <param name="discard_outside_border" value="Yes" />
565 <param name="discard_touching_border" value="Yes" />
566 </conditional>
567 <expand macro="test_out_file" file="identify_primary_objects_noadv.cppipe" />
568 </test>
569 <test>
570 <!-- advanced setting, adaptive threshold strategy, otsu method -->
318 <expand macro="test_input_pipeline_param" /> 571 <expand macro="test_input_pipeline_param" />
319 <conditional name="con_advanced"> 572 <conditional name="con_advanced">
320 <param name="advanced" value="Yes" /> 573 <param name="advanced" value="Yes" />
321 <param name="input_from_nat" value="DNA" /> 574 <param name="input_from_nat" value="DNA" />
322 <param name="name_to_be_identified" value="Nuclei" /> 575 <param name="name_to_be_identified" value="Nuclei" />
323 <param name="min_diameter" value="15" /> 576 <param name="min_diameter" value="15" />
324 <param name="max_diameter" value="200" /> 577 <param name="max_diameter" value="200" />
325 <param name="discard_outside_border" value="Yes" /> 578 <param name="discard_outside_border" value="Yes" />
326 <param name="discard_touching_border" value="Yes" /> 579 <param name="discard_touching_border" value="Yes" />
580
581 <conditional name="con_threshold_strategy">
582 <param name="threshold_strategy" value="Adaptive" />
583 <conditional name="con_threshold_method">
584 <param name="threshold_method" value="Otsu" />
585 <conditional name="con_threshold_class">
586 <param name="threshold_class" value="Three classes" />
587 <param name="assign_pixel" value="Foreground" />
588 </conditional>
589 </conditional>
590 <param name="adaptive_window" value="50" />
591 <param name="threshold_smoothing_scale" value="1.5" />
592 <param name="threshold_correction_factor" value="1" />
593 <param name="threshold_lower" value="0.0" />
594 <param name="threshold_upper" value="1.0" />
595 </conditional>
596 <conditional name="con_distinguish_clumped_objects">
597 <param name="distinguish_clumped_objects" value="Shape" />
598 <conditional name="con_dividing_lines" >
599 <param name="dividing_lines" value="Shape" />
600 <conditional name="con_smoothing_filter">
601 <param name="smoothing_filter" value="No"/>
602 <param name="size_smoothing_filter" value="1" />
603 </conditional>
604 <conditional name="con_min_distance">
605 <param name="min_distance" value="No"/>
606 <param name="min_allowed_distance" value="1"/>
607 </conditional>
608 <param name="speed_up" value="Yes" />
609 </conditional>
610 </conditional>
611 <param name="fill_hole" value="After both thresholding and declumping" />
612 <conditional name="con_handling_excessive">
613 <param name="excessive_handling" value="Continue"/>
614 </conditional>
615 </conditional>
616 <expand macro="test_out_file" file="identify_primary_objects_adv_adaptive_otsu.cppipe" />
617 </test>
618
619 <test>
620 <!-- advanced setting, global threshold strategy, manual method -->
621 <expand macro="test_input_pipeline_param" />
622 <conditional name="con_advanced">
623 <param name="advanced" value="Yes" />
624 <param name="input_from_nat" value="DNA" />
625 <param name="name_to_be_identified" value="Nuclei" />
626 <param name="min_diameter" value="5" />
627 <param name="max_diameter" value="20" />
628 <param name="discard_outside_border" value="No" />
629 <param name="discard_touching_border" value="Yes" />
630
327 <conditional name="con_threshold_strategy"> 631 <conditional name="con_threshold_strategy">
328 <param name="threshold_strategy" value="Global" /> 632 <param name="threshold_strategy" value="Global" />
329 </conditional> 633 <conditional name="con_threshold_method">
330 <conditional name="con_threshold_method"> 634 <param name="threshold_method" value="Manual" />
331 <param name="threshold_method" value="Otsu" /> 635 <param name="manual_threshold" value="1" />
332 <conditional name="con_threshold_class" > 636 </conditional>
333 <param name="threshold_class" value="Two classes" /> 637 </conditional>
334 </conditional>
335 </conditional>
336 <param name="threshold_smoothing_scale" value="1.3488" />
337 <param name="threshold_correction_factor" value="0.9" />
338 <param name="threshold_lower" value="0.0" />
339 <param name="threshold_upper" value="1.0" />
340 <conditional name="con_distinguish_clumped_objects"> 638 <conditional name="con_distinguish_clumped_objects">
341 <param name="distinguish_clumped_objects" value="Shape" /> 639 <param name="distinguish_clumped_objects" value="Shape" />
342 <conditional name="con_dividing_lines"> 640 <conditional name="con_dividing_lines" >
343 <param name="dividing_lines" value="Shape" /> 641 <param name="dividing_lines" value="Shape" />
344 <conditional name="con_smoothing_filter"> 642 <conditional name="con_smoothing_filter">
345 <param name="smoothing_filter" value="Yes" /> 643 <param name="smoothing_filter" value="No"/>
644 <param name="size_smoothing_filter" value="1" />
346 </conditional> 645 </conditional>
347 <conditional name="con_min_distance"> 646 <conditional name="con_min_distance">
348 <param name="min_distance" value="Yes" /> 647 <param name="min_distance" value="No"/>
349 </conditional> 648 <param name="min_allowed_distance" value="1"/>
350 <param name="speed_up" value="Yes" /> 649 </conditional>
650 <param name="speed_up" value="Yes" />
351 </conditional> 651 </conditional>
352 </conditional> 652 </conditional>
653 <param name="fill_hole" value="After both thresholding and declumping" />
353 <conditional name="con_handling_excessive"> 654 <conditional name="con_handling_excessive">
354 <param name="excessive_handling" value="Continue" /> 655 <param name="excessive_handling" value="Erase"/>
656 <param name="max_obj" value="499" />
657 </conditional>
658 </conditional>
659 <expand macro="test_out_file" file="identify_primary_objects_adv_global_manual.cppipe" />
660 </test>
661 <test>
662 <!-- advanced setting, global threshold strategy, measurement method -->
663 <expand macro="test_input_pipeline_param" />
664 <conditional name="con_advanced">
665 <param name="advanced" value="Yes" />
666 <param name="input_from_nat" value="DNA" />
667 <param name="name_to_be_identified" value="Nuclei" />
668 <param name="min_diameter" value="5" />
669 <param name="max_diameter" value="20" />
670 <param name="discard_outside_border" value="Yes" />
671 <param name="discard_touching_border" value="No" />
672
673 <conditional name="con_threshold_strategy">
674 <param name="threshold_strategy" value="Global" />
675 <conditional name="con_threshold_method">
676 <param name="threshold_method" value="Measurement" />
677 <param name="global_measurement_threshold_cat" value="FileName" />
678 <param name="global_measurement_threshold_measurement" value="DNA" />
679 <param name="threshold_correction_factor" value="1" />
680 <param name="threshold_lower" value="0.1" />
681 <param name="threshold_upper" value="0.4" />
682 </conditional>
683 </conditional>
684 <conditional name="con_distinguish_clumped_objects">
685 <param name="distinguish_clumped_objects" value="Intensity" />
686 <conditional name="con_dividing_lines" >
687 <param name="dividing_lines" value="Shape" />
688 <conditional name="con_smoothing_filter">
689 <param name="smoothing_filter" value="Yes"/>
690 </conditional>
691 <conditional name="con_min_distance">
692 <param name="min_distance" value="No"/>
693 <param name="min_allowed_distance" value="6"/>
694 </conditional>
695 <param name="speed_up" value="Yes" />
696 </conditional>
355 </conditional> 697 </conditional>
356 <param name="fill_hole" value="After both thresholding and declumping" /> 698 <param name="fill_hole" value="After both thresholding and declumping" />
357 </conditional> 699 <conditional name="con_handling_excessive">
358 <expand macro="test_out_file" file="identify_primary_objects.txt" /> 700 <param name="excessive_handling" value="Continue"/>
701 </conditional>
702 </conditional>
703 <expand macro="test_out_file" file="identify_primary_objects_adv_global_measurement.cppipe" />
359 </test> 704 </test>
705
706 <test>
707 <!-- advanced setting, global threshold strategy, minimum cross entropy method -->
708 <expand macro="test_input_pipeline_param" />
709 <conditional name="con_advanced">
710 <param name="advanced" value="Yes" />
711 <param name="input_from_nat" value="DNA" />
712 <param name="name_to_be_identified" value="Nuclei" />
713 <param name="min_diameter" value="15" />
714 <param name="max_diameter" value="40" />
715 <param name="discard_outside_border" value="Yes" />
716 <param name="discard_touching_border" value="Yes" />
717
718 <conditional name="con_threshold_strategy">
719 <param name="threshold_strategy" value="Global" />
720 <conditional name="con_threshold_method">
721 <param name="threshold_method" value="Minimum cross entropy" />
722 <param name="threshold_smoothing_scale" value="1.5" />
723 <param name="threshold_correction_factor" value="1" />
724 <param name="threshold_lower" value="0.0" />
725 <param name="threshold_upper" value="1.0" />
726 </conditional>
727 </conditional>
728 <conditional name="con_distinguish_clumped_objects">
729 <param name="distinguish_clumped_objects" value="Shape" />
730 <conditional name="con_dividing_lines" >
731 <param name="dividing_lines" value="Shape" />
732 <conditional name="con_smoothing_filter">
733 <param name="smoothing_filter" value="No"/>
734 <param name="size_smoothing_filter" value="1" />
735 </conditional>
736 <conditional name="con_min_distance">
737 <param name="min_distance" value="No"/>
738 <param name="min_allowed_distance" value="7"/>
739 </conditional>
740 <param name="speed_up" value="Yes" />
741 </conditional>
742 </conditional>
743 <param name="fill_hole" value="After both thresholding and declumping" />
744 <conditional name="con_handling_excessive">
745 <param name="excessive_handling" value="Continue"/>
746 </conditional>
747 </conditional>
748 <expand macro="test_out_file" file="identify_primary_objects_adv_global_mce.cppipe" />
749 </test>
750
751 <test>
752 <!-- advanced setting, global threshold strategy, robustbackground method -->
753 <expand macro="test_input_pipeline_param" />
754 <conditional name="con_advanced">
755 <param name="advanced" value="Yes" />
756 <param name="input_from_nat" value="DNA" />
757 <param name="name_to_be_identified" value="Nuclei" />
758 <param name="min_diameter" value="10" />
759 <param name="max_diameter" value="40" />
760 <param name="discard_outside_border" value="Yes" />
761 <param name="discard_touching_border" value="Yes" />
762
763 <conditional name="con_threshold_strategy">
764 <param name="threshold_strategy" value="Global" />
765 <conditional name="con_threshold_method">
766 <param name="threshold_method" value="RobustBackground" />
767 <param name="lower_outlier_fraction" value="0.06" />
768 <param name="upper_outlier_fraction" value="0.07" />
769 <param name="avg_method" value="Median"/>
770 <param name="variance_method" value="Median absolute deviation"/>
771 <param name="no_of_deviations" value="3.0" />
772 <param name="threshold_smoothing_scale" value="1.4" />
773 <param name="threshold_correction_factor" value="1" />
774 <param name="threshold_lower" value="0.0" />
775 <param name="threshold_upper" value="1.0" />
776 </conditional>
777 </conditional>
778 <conditional name="con_distinguish_clumped_objects">
779 <param name="distinguish_clumped_objects" value="Shape" />
780 <conditional name="con_dividing_lines" >
781 <param name="dividing_lines" value="Shape" />
782 <conditional name="con_smoothing_filter">
783 <param name="smoothing_filter" value="No"/>
784 <param name="size_smoothing_filter" value="1" />
785 </conditional>
786 <conditional name="con_min_distance">
787 <param name="min_distance" value="No"/>
788 <param name="min_allowed_distance" value="7"/>
789 </conditional>
790 <param name="speed_up" value="Yes" />
791 </conditional>
792 </conditional>
793 <param name="fill_hole" value="After both thresholding and declumping" />
794 <conditional name="con_handling_excessive">
795 <param name="excessive_handling" value="Continue"/>
796 </conditional>
797 </conditional>
798 <expand macro="test_out_file" file="identify_primary_objects_adv_global_rb.cppipe" />
799 </test>
800
360 </tests> 801 </tests>
361 802
362 <expand macro="help" module="IdentifyPrimaryObjects"/> 803 <help>
804 <![CDATA[
805 .. class:: infomark
806
807 **What it does**
808
809 This tool identifies biological objects of interest. It requires grayscale images containing bright objects on a dark background. Incoming images must be 2D (including 2D slices of 3D images); please use the Watershed module for identification of objects in 3D.
810
811 @COMMON_HELP@
812 ]]>
813 </help>
363 814
364 <expand macro="citations" /> 815 <expand macro="citations" />
365 816
366 </tool> 817 </tool>
367