comparison biapy.xml @ 0:356d58ae85fa draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/biapy commit 63860b5c6c21e0b76b1c55a5e71cafcb77d6cc84
author iuc
date Fri, 06 Feb 2026 17:50:32 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:356d58ae85fa
1 <tool id="biapy" name="Build a workflow with BiaPy" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@" license="MIT">
2 <description>Accessible deep learning on bioimages</description>
3 <macros>
4 <import>macros.xml</import>
5 </macros>
6 <edam_topics>
7 <edam_topic>topic_3474</edam_topic> <!-- Machine learning -->
8 <!-- <edam_topic>topic_3753</edam_topic> Deep learning (not in EDAM) -->
9 </edam_topics>
10 <edam_operations>
11 <edam_operation>operation_2945</edam_operation> <!-- Image segmentation -->
12 <edam_operation>operation_3925</edam_operation> <!-- Object detection -->
13 <edam_operation>operation_3443</edam_operation> <!-- Image denoising -->
14 <!-- <edam_operation>Single image super-resolution (not in EDAM)</edam_operation> -->
15 <edam_operation>operation_2946</edam_operation> <!-- Image restoration -->
16 <!-- <edam_operation>Image-to-image translation (not in EDAM)</edam_operation> -->
17 <!-- <edam_operation>operation_3442</edam_operation> Image classification -->
18 <!-- <edam_operation>Self-supervision learning (not in EDAM)</edam_operation> -->
19 <edam_operation>operation_2944</edam_operation> <!-- Image analysis -->
20 </edam_operations>
21 <expand macro="requirements" />
22 <required_files>
23 <include path="create_yaml.py" />
24 </required_files>
25 <expand macro="creators" />
26 <command detect_errors="exit_code">
27 <![CDATA[
28 set -xeu &&
29 export OPENCV_IO_ENABLE_OPENEXR=0 &&
30
31 WORKTMP="\$(mktemp -d galaxy-torchinductor.XXXXXX)" &&
32 export TORCHINDUCTOR_CACHE_DIR="\$WORKTMP/torchinductor" &&
33 mkdir -p "\$TORCHINDUCTOR_CACHE_DIR" &&
34
35 ## Define some useful variables
36 #set $train_raw_dir = './dataset/train/raw'
37 #set $train_gt_dir = './dataset/train/gt'
38 #set $test_raw_dir = './dataset/test/raw'
39 #set $test_gt_dir = './dataset/test/gt'
40 #set $checkpoint_dir = './output/my_experiment/checkpoints'
41 #set $checkpoint_file = $checkpoint_dir + '/checkpoint.safetensors'
42 #set $common_yaml_args = " --out_config_path '%s' --biapy_version '@TOOL_VERSION@'" % $config_file
43
44 ## Decide phase and GT availability without touching missing names
45 #set $selected_phase = 'train_test'
46 #set $test_gt_avail = 'test_gt_no'
47
48 #if $mode_selection['selected_mode'] == 'create_new_cfg'
49 #set $phase_decision = $mode_selection['workflow_selection']['phase_decision']
50 #set $selected_phase = $phase_decision['phases']
51
52 ## Safely define raw and gt variables
53 #set $train_sec = $phase_decision.get('train_sec')
54 #set $test_sec = $phase_decision.get('test_sec')
55
56 #set $raw_train = $train_sec and $train_sec.get('raw_train') or []
57 #set $gt_train = $train_sec and $train_sec.get('gt_train') or []
58 #set $raw_test = $test_sec and $test_sec.get('raw_test') or []
59 #set $gt_test = $test_sec and $test_sec.get('gt_test') or []
60
61 #if $selected_phase in ['train_test', 'test']
62 #set $test_gt_selection = $test_sec.get('test_gt_selection')
63 #if $test_gt_selection and $test_gt_selection.get('has_gt') == 'yes'
64 #set $test_gt_avail = 'test_gt_yes'
65 #else
66 #set $test_gt_avail = 'test_gt_no'
67 #end if
68 #end if
69 #else
70 #set $train_sec = $mode_selection.get('train_sec')
71 #set $test_sec = $mode_selection.get('test_sec')
72
73 #set $raw_train = $train_sec and $train_sec.get('raw_train') or []
74 #set $gt_train = $train_sec and $train_sec.get('gt_train') or []
75 #set $raw_test = $test_sec and $test_sec.get('raw_test') or []
76 #set $gt_test = $test_sec and $test_sec.get('gt_test') or []
77
78 ## Infer which phases are actually present
79 #if $raw_train and $raw_test
80 #set $selected_phase = 'train_test'
81 #elif $raw_train
82 #set $selected_phase = 'train'
83 #elif $raw_test
84 #set $selected_phase = 'test'
85 #end if
86
87 #if $gt_test and len($gt_test) > 0
88 #set $test_gt_avail = 'test_gt_yes'
89 #end if
90 #end if
91
92 ## Define output directory
93 mkdir -p output &&
94
95 ## Define checkpoint directory in case it is needed
96 mkdir -p '$checkpoint_dir' &&
97
98 ########## Reuse provided yaml file and update paths ##########
99 #if $mode_selection.selected_mode == 'custom_cfg':
100 #if $mode_selection.get('test_sec') and $mode_selection['test_sec'].get('gt_test'):
101 #set $test_gt_avail = 'test_gt_yes'
102 #end if
103 #set $mpath = $mode_selection.get('biapy_model_path')
104 #if $mpath and str($mpath) not in ['None', '']
105 ln -fs '$mpath' ${checkpoint_file} &&
106 #end if
107 python3 '$__tool_directory__/create_yaml.py'
108 --input_config_path '$mode_selection.config_path'
109 --num_cpus "\${GALAXY_SLOTS:-1}"
110 ${common_yaml_args}
111 ## Optionally override data paths with the staged dirs if user provided inputs
112 #if $selected_phase in ['train_test', 'train'] and $mode_selection.get('train_sec') and $mode_selection['train_sec'].get('raw_train')
113 --raw_train '$train_raw_dir'
114 #if $mode_selection['train_sec'].get('gt_train')
115 --gt_train '$train_gt_dir'
116 #end if
117 #end if
118 #if $selected_phase in ['train_test', 'test'] and $mode_selection.get('test_sec') and $mode_selection['test_sec'].get('raw_test')
119 --test_raw_path '$test_raw_dir'
120 #if $test_gt_avail == 'test_gt_yes' and $mode_selection['test_sec'].get('gt_test')
121 --test_gt_path '$test_gt_dir'
122 #end if
123 #end if
124 #if $mpath and str($mpath) not in ['None', '']
125 --model '$checkpoint_file'
126 --model_source 'biapy'
127 #end if
128 #else
129 ########## Create new yaml file ##########
130 #set $pm = $mode_selection["pretrained_model"]
131 python3 '$__tool_directory__/create_yaml.py'
132 --new_config
133 --num_cpus "\${GALAXY_SLOTS:-1}"
134 ${common_yaml_args}
135 --workflow '$mode_selection["workflow_selection"]["workflow"]'
136 --dims '$mode_selection["dimensionality"]["is_3d"]'
137 --obj_slices '$mode_selection["dimensionality"].get("obj_slices")'
138 --obj_size '$mode_selection["obj_size"]'
139 --img_channel '$mode_selection["img_channel"]'
140 #if $pm["model_source"] == 'biapy'
141 --model_source 'biapy'
142 #elif $pm["model_source"] == 'biapy_pretrained'
143 --model '$checkpoint_file'
144 --model_source 'biapy'
145 #elif $pm.get("model_source") == 'bmz_pretrained'
146 --model_source 'bmz'
147 --model '$pm.get("bmz_model_name", "")'
148 #end if
149 #if $selected_phase == 'train_test'
150 --raw_train '$train_raw_dir'
151 #if $gt_train
152 --gt_train '$train_gt_dir'
153 #end if
154 --test_raw_path '$test_raw_dir'
155 #if $test_gt_avail == 'test_gt_yes'
156 --test_gt_path '$test_gt_dir'
157 #end if
158 #elif $selected_phase == 'train'
159 --raw_train '$train_raw_dir'
160 #if $gt_train
161 --gt_train '$train_gt_dir'
162 #end if
163 #elif $selected_phase == 'test'
164 --test_raw_path '$test_raw_dir'
165 #if $test_gt_avail == 'test_gt_yes'
166 --test_gt_path '$test_gt_dir'
167 #end if
168 #end if
169
170 #if $pm["model_source"] == 'biapy_pretrained'
171 && ln -fs '$pm["biapy_model_path"]' ${checkpoint_file}
172 #end if
173 #end if
174
175 &&
176
177 ## Copy the training data
178 #if $selected_phase in ['train_test', 'train']:
179 mkdir -p '$train_raw_dir' &&
180 #for $i, $image in enumerate($raw_train)
181 #set $ext = $image.ext
182 ln -fs '$image' ${train_raw_dir}/training-${i}.${ext} &&
183 #end for
184 #if $gt_train and len($gt_train) > 0
185 mkdir -p '$train_gt_dir' &&
186 #for $i, $image in enumerate($gt_train)
187 #set $ext = $image.ext
188 ln -fs '$image' ${train_gt_dir}/training-gt-${i}.${ext} &&
189 #end for
190 #end if
191 #end if
192
193 ## Copy the test data
194 #if $selected_phase in ['train_test', 'test']:
195 mkdir -p '$test_raw_dir' &&
196 #for $i, $image in enumerate($raw_test)
197 #set $ext = $image.ext
198 ln -fs '$image' ${test_raw_dir}/test-${i}.${ext} &&
199 #end for
200 #if $test_gt_avail == 'test_gt_yes':
201 mkdir -p '$test_gt_dir' &&
202 #for $i, $image in enumerate($gt_test)
203 #set $ext = $image.ext
204 ln -fs '$image' ${test_gt_dir}/test-gt-${i}.${ext} &&
205 #end for
206 #end if
207 #end if
208
209 ########## Run BiaPy ##########
210 biapy
211 --config '$config_file'
212 --result_dir './output'
213 --name 'my_experiment'
214 --run_id 1
215 --gpu \${GALAXY_BIAPY_GPU_STRING:-""}
216
217 #set $outs = $selected_outputs or []
218
219 ## Copy the selected output to the correct place
220 #if $selected_phase in ['train_test', 'test']:
221
222 #if 'raw' in $outs
223 ########
224 ## RAW #
225 ########
226 && mkdir -p raw && {
227 ## Instance segmentation
228 if [ -d "output/my_experiment/results/my_experiment_1/per_image_instances" ]; then
229 mv output/my_experiment/results/my_experiment_1/per_image_instances/* raw/;
230
231 ## Instance segmentation
232 elif [ -d "output/my_experiment/results/my_experiment_1/full_image_instances" ]; then
233 mv output/my_experiment/results/my_experiment_1/full_image_instances/* raw/;
234
235 ## Semantic segmentation
236 elif [ -d "output/my_experiment/results/my_experiment_1/per_image_binarized" ]; then
237 mv output/my_experiment/results/my_experiment_1/per_image_binarized/* raw/;
238
239 ## Semantic segmentation
240 elif [ -d "output/my_experiment/results/my_experiment_1/full_image_binarized" ]; then
241 mv output/my_experiment/results/my_experiment_1/full_image_binarized/* raw/;
242
243 ## I2I
244 elif [ -d "output/my_experiment/results/my_experiment_1/full_image" ]; then
245 mv output/my_experiment/results/my_experiment_1/full_image/* raw/;
246
247 ## Detection
248 elif [ -d "output/my_experiment/results/my_experiment_1/per_image_local_max_check" ]; then
249 mv output/my_experiment/results/my_experiment_1/per_image_local_max_check/* raw/;
250
251 ## Detection, Denoising, I2I, SSL, SR
252 elif [ -d "output/my_experiment/results/my_experiment_1/per_image" ]; then
253 mv output/my_experiment/results/my_experiment_1/per_image/* raw/;
254
255 ## Classification
256 elif [ -f "output/my_experiment/results/my_experiment_1/predictions.csv" ]; then
257 mv output/my_experiment/results/my_experiment_1/predictions.csv raw/;
258 fi;
259 }
260 #end if
261
262 #if 'post_proc' in $outs
263 ##############
264 ## POST-PROC #
265 ##############
266 && mkdir -p post_proc && {
267 ## Instance segmentation
268 if [ -d "output/my_experiment/results/my_experiment_1/per_image_post_processing" ]; then
269 mv output/my_experiment/results/my_experiment_1/per_image_post_processing/* post_proc/;
270
271 ## Instance segmentation
272 elif [ -d "output/my_experiment/results/my_experiment_1/full_image_post_processing" ]; then
273 mv output/my_experiment/results/my_experiment_1/full_image_post_processing/* post_proc/;
274
275 ## Detection
276 elif [ -d "output/my_experiment/results/my_experiment_1/per_image_local_max_check_post_proc" ]; then
277 mv output/my_experiment/results/my_experiment_1/per_image_local_max_check_post_proc/* post_proc/;
278 fi;
279 }
280 #end if
281
282 #if 'metrics' in $outs and $test_gt_avail == "test_gt_yes":
283 && mkdir -p metrics &&
284 mv output/my_experiment/results/my_experiment_1/test_results_metrics.csv metrics/ 2>/dev/null || true
285 #end if
286 #end if
287 #if $selected_phase in ['train_test', 'train']:
288 #if 'tcharts' in $outs
289 && mkdir -p train_charts
290 #end if
291 #if 'tlogs' in $outs
292 && mkdir -p train_logs
293 #end if
294 #end if
295 #if 'checkpoint' in $outs
296 && mkdir -p checkpoints
297 #end if
298 ]]>
299 </command>
300
301 <inputs>
302 <conditional name="mode_selection">
303 <param name="selected_mode" type="select" label="Do you have a configuration file?">
304 <option value="custom_cfg" selected="true">
305 Yes, I already have one and I want to run BiaPy directly.
306 </option>
307 <option value="create_new_cfg">
308 No, I want to create one from scratch.
309 </option>
310 </param>
311 <when value="custom_cfg">
312 <param name="config_path" type="data" format="yaml" optional="false" label="Select a configuration file" help="Input configuration file"/>
313 <param name="biapy_model_path" type="data" format="safetensors" optional="true" label="Select the model checkpoint (if needed)" help="Path to a pre-trained model checkpoint (.safetensors) generated by BiaPy. Use this only if 'MODEL.LOAD_CHECKPOINT' is set to 'True' in your configuration."/>
314 <section name="train_sec" title="If train is enabled select the training images">
315 <expand macro="train_raw_param" optional="true"/>
316 <expand macro="train_gt_param" optional="true"/>
317 </section>
318 <section name="test_sec" title="If test is enabled select the test images">
319 <expand macro="test_raw_param" optional="true"/>
320 <expand macro="test_gt_param" optional="true"/>
321 </section>
322 </when>
323 <when value="create_new_cfg">
324 <conditional name="dimensionality">
325 <param name="is_3d" type="select" label="Are your images in 3D?" help="Select the type of images you will use: 'No' = 2D images (e.g. (512, 1024, 2)); 'Yes' = 3D images (e.g. (400, 400, 50, 1)); 'No, but output as 3D stack' = process 2D images and combine them into a 3D stack after inference, useful if 2D slices form a larger 3D volume.">
326 <option value="2d" selected="true">No</option>
327 <option value="3d">Yes</option>
328 <option value="2d_stack">No, but I would like to have a 3D stack output</option>
329 </param>
330 <when value="3d">
331 <param name="obj_slices" type="select" label="How many slices can an object be represented in?" help="This parameter defines the approximate size of the objects of interest along the Z axis. For example, in nucleus segmentation it refers to how many slices a nucleus spans in the stack; knowing this helps set an appropriate value.">
332 <option value="1-5" selected="true">1-5 slices</option>
333 <option value="5-10">5-10 slices</option>
334 <option value="10-20">10-20 slices</option>
335 <option value="20-60">20-60 slices</option>
336 <option value="60+">More than 60 slices</option>
337 </param>
338 </when>
339 <when value="2d"/>
340 <when value="2d_stack"/>
341 </conditional>
342 <param name="obj_size" type="select" label="What is the average object width/height in pixels?" help="This parameter defines the approximate size of the objects of interest in your images; for example, in nucleus segmentation it refers to the typical size of nuclei, and only a rough estimation is needed.">
343 <option value="0-25" selected="true">0-25 px</option>
344 <option value="25-100">25-100 px</option>
345 <option value="100-200">100-200 px</option>
346 <option value="200-500">200-500 px</option>
347 <option value="500+">More than 500 px</option>
348 </param>
349 <param name="img_channel" type="integer" value="1" min="1" max="10" label="Input the number of channels of the images" help="This parameter specifies the number of channels in your images; for example, use 3 for RGB images or 1 for grayscale, so the model can correctly interpret the input data."/>
350
351 <conditional name="workflow_selection">
352 <param name="workflow" type="select" label="Do you want to:" help="Select a workflow to run; see https://biapy.readthedocs.io/en/latest/get_started/select_workflow.html for further explanation.">
353 <option value="semantic" selected="true">Generate masks of different (or just one) objects/regions within the image</option>
354 <option value="instance">Generate masks for each object in the image</option>
355 <option value="detection">Identify and count roughly circular objects in the images, without needing an exact outline around each one</option>
356 <option value="denoising">Clean noisy images</option>
357 <option value="sr">Upsample images into higher resolution</option>
358 <option value="cls">Assign a label to each image</option>
359 <option value="sr2">Restore a degraded image</option>
360 <option value="i2i">Generate new images based on an input one</option>
361 </param>
362 <when value="semantic">
363 <expand macro="supervised_phase_block"/>
364 </when>
365 <when value="instance">
366 <expand macro="supervised_phase_block"/>
367 </when>
368 <when value="detection">
369 <expand macro="supervised_phase_block"/>
370 </when>
371 <when value="sr">
372 <expand macro="supervised_phase_block"/>
373 </when>
374 <when value="cls">
375 <expand macro="supervised_phase_block"/>
376 </when>
377 <when value="sr2">
378 <expand macro="supervised_phase_block"/>
379 </when>
380 <when value="i2i">
381 <expand macro="supervised_phase_block"/>
382 </when>
383 <when value="denoising">
384 <expand macro="unsupervised_phase_block"/>
385 </when>
386 </conditional>
387 <conditional name="pretrained_model">
388 <param name="model_source" type="select" label="Do you want to use a pre-trained model?" help="This parameter defines how the deep learning model will be built: (1) build from scratch based on the workflow and image size, (2) load a model previously trained in BiaPy (checkpoint .safetensors in the results/checkpoints folder), or (3) load a pre-trained model from external sources such as the BioImage Model Zoo; training requires labeled data, but pre-trained models can save time and improve results if they match your task.">
389 <option value="biapy" selected="true">No, I want to build a model from scratch</option>
390 <option value="biapy_pretrained">Yes, I have a model previously trained in BiaPy</option>
391 <option value="bmz_pretrained">Yes, I want to use a pre-trained from the BioImage Model Zoo</option>
392 </param>
393 <when value="biapy_pretrained">
394 <param name="biapy_model_path" type="data" format="data" optional="false" label="Select the model trained with BiaPy before" help="Select a pre-trained BiaPy model checkpoint (.safetensors) to use for inference or to resume training. Checkpoints are typically generated by previous BiaPy training runs and appear in your Galaxy history as output datasets."/>
395 </when>
396 <when value="bmz_pretrained">
397 <param name="bmz_model_name" type="text" optional="false" value="sensible-cat" label="BioImage Model Zoo model name" help="Enter the name of a pre-trained model from the BioImage Model Zoo (https://bioimage.io/#/models); filter by the BiaPy icon and ensure the model matches your dimensionality (2D/3D) and task (e.g. semantic segmentation).">
398 <validator type="regex" message="Use an adjective-noun pattern like 'sensible-cat' (letters and dashes only).">^[A-Za-z]+(?:-[A-Za-z]+)+$</validator>
399 </param>
400 </when>
401 <when value="biapy"/>
402 </conditional>
403
404 </when>
405 </conditional>
406 <param name="selected_outputs" type="select" display="checkboxes" multiple="true" label="Select the outputs" help="Select which outputs to generate from running BiaPy (e.g. predictions, metrics, logs, or intermediate results).">
407 <option value="raw" selected="true">Test predictions (if exist)</option>
408 <option value="post_proc">Post-processed test predictions (if exist)</option>
409 <option value="metrics">Evaluation metrics (if exist, on test data)</option>
410 <option value="tcharts">Training charts (if exist)</option>
411 <option value="tlogs">Training logs (if exist)</option>
412 <option value="checkpoint">Model checkpoint</option>
413 </param>
414
415 </inputs>
416
417 <outputs>
418 <collection name="predictions_raw" type="list" label="${tool.name} on ${on_string}: Test predictions">
419 <discover_datasets directory="raw" pattern="(?P&lt;designation&gt;.+)\.tif" format="tif" recurse="false"/>
420 <discover_datasets directory="raw" pattern="(?P&lt;designation&gt;.+)\.tiff" format="tiff" recurse="false"/>
421 <discover_datasets directory="raw" pattern="(?P&lt;designation&gt;.+)\.csv" format="csv" recurse="false"/>
422 <discover_datasets directory="raw" pattern="(?P&lt;designation&gt;.+)\.h5" format="h5" recurse="false"/>
423 <filter><![CDATA[
424 'raw' in selected_outputs and (
425 (mode_selection['selected_mode'] == 'create_new_cfg' and
426 mode_selection['workflow_selection']['phase_decision']['phases'] in ['test','train_test'])
427 or
428 (mode_selection['selected_mode'] == 'custom_cfg')
429 )
430 ]]></filter>
431 </collection>
432
433 <collection name="predictions_post_proc" type="list" label="${tool.name} on ${on_string}: Post-processed test predictions">
434 <discover_datasets directory="post_proc" pattern="(?P&lt;designation&gt;.+)\.tif" format="tif" recurse="false" />
435 <discover_datasets directory="post_proc" pattern="(?P&lt;designation&gt;.+)\.tiff" format="tiff" recurse="false"/>
436 <discover_datasets directory="post_proc" pattern="(?P&lt;designation&gt;.+)\.csv" format="csv" recurse="false"/>
437 <discover_datasets directory="post_proc" pattern="(?P&lt;designation&gt;.+)\.h5" format="h5" recurse="false" />
438 <filter><![CDATA[
439 'post_proc' in selected_outputs and (
440 (mode_selection['selected_mode'] == 'create_new_cfg' and
441 mode_selection['workflow_selection']['phase_decision']['phases'] in ['test','train_test'])
442 or
443 (mode_selection['selected_mode'] == 'custom_cfg')
444 )
445 ]]>
446 </filter>
447 </collection>
448
449 <collection name="test_metrics" type="list" label="${tool.name} on ${on_string}: Test metrics">
450 <discover_datasets directory="metrics" pattern="(?P&lt;designation&gt;.+)\.csv" format="csv" recurse="false" />
451 <filter><![CDATA[
452 'metrics' in selected_outputs and (
453 (mode_selection['selected_mode'] == 'create_new_cfg' and
454 mode_selection['workflow_selection']['phase_decision']['phases'] in ['test','train_test'] and
455 mode_selection['workflow_selection']['phase_decision'].get('test_sec') and
456 mode_selection['workflow_selection']['phase_decision']['test_sec'].get('test_gt_selection') and
457 mode_selection['workflow_selection']['phase_decision']['test_sec']['test_gt_selection']['has_gt'] == 'yes')
458 or
459 (mode_selection['selected_mode'] == 'custom_cfg' and mode_selection['test_sec'].get('gt_test'))
460 )
461 ]]></filter>
462 </collection>
463
464 <collection name="train_charts" type="list" label="${tool.name} on ${on_string}: Training charts">
465 <discover_datasets directory="output/my_experiment/results/my_experiment_1/charts" pattern="(?P&lt;designation&gt;.+)\.png" format="png" recurse="false" />
466 <filter><![CDATA[
467 'tcharts' in selected_outputs and (
468 (mode_selection['selected_mode'] == 'create_new_cfg' and
469 mode_selection['workflow_selection']['phase_decision']['phases'] in ['train','train_test'])
470 or
471 (mode_selection['selected_mode'] == 'custom_cfg')
472 )
473 ]]>
474 </filter>
475 </collection>
476
477 <collection name="train_logs" type="list" label="${tool.name} on ${on_string}: Training logs">
478 <discover_datasets directory="output/my_experiment/train_logs" pattern="(?P&lt;designation&gt;.+)\.txt" format="txt" recurse="false" />
479 <filter><![CDATA[
480 'tlogs' in selected_outputs and (
481 (mode_selection['selected_mode'] == 'create_new_cfg' and
482 mode_selection['workflow_selection']['phase_decision']['phases'] in ['train','train_test'])
483 or
484 (mode_selection['selected_mode'] == 'custom_cfg')
485 )
486 ]]>
487 </filter>
488 </collection>
489
490 <collection name="model_checkpoint" type="list" label="${tool.name} on ${on_string}: Model checkpoint">
491 <discover_datasets pattern="(?P&lt;designation&gt;.+)\.safetensors" format="data" directory="output/my_experiment/checkpoints" recurse="false" />
492 <filter><![CDATA[
493 'checkpoint' in selected_outputs
494 ]]>
495 </filter>
496 </collection>
497
498 <data name="config_file" format="yaml" label="Generated BiaPy configuration" />
499 </outputs>
500 <tests>
501 <!-- test1: test with custom cfg -->
502 <test expect_num_outputs="3">
503 <!-- Choose the conditional branch -->
504 <param name="mode_selection|selected_mode" value="custom_cfg"/>
505
506 <param name="mode_selection|config_path" value="example.yaml"/>
507 <param name="mode_selection|test_sec|raw_test" value="im_0000.png"/>
508 <param name="mode_selection|test_sec|gt_test" value="mask_0000.png"/>
509 <param name="selected_outputs" value="raw,metrics"/>
510 <output_collection name="predictions_raw" type="list" count="1" />
511 <output_collection name="test_metrics" type="list" count="1"/>
512 <output name="config_file">
513 <assert_contents>
514 <has_size min="1"/>
515 <has_text text="SEMANTIC_SEG" />
516 <has_text text="sensible-cat" />
517 </assert_contents>
518 </output>
519 <assert_command>
520 <has_text text="--config "/>
521 <has_text text="--result_dir './output'"/>
522 <has_text text="--name 'my_experiment'"/>
523 <has_text text="--run_id 1"/>
524 </assert_command>
525 </test>
526
527 <!-- test2: create_new_cfg using a model from the zoo -->
528 <test expect_num_outputs="3">
529 <param name="mode_selection|selected_mode" value="create_new_cfg" />
530
531 <!-- Dimensionality (Q1) -->
532 <param name="mode_selection|dimensionality|is_3d" value="2d" />
533
534 <!-- Object size (Q6) & channels -->
535 <param name="mode_selection|obj_size" value="0-25" />
536 <param name="mode_selection|img_channel" value="1" />
537
538 <!-- Workflow (Q2) -->
539 <param name="mode_selection|workflow_selection|workflow" value="semantic" />
540
541 <!-- Pretrained model (Q3, Q5) -->
542 <param name="mode_selection|pretrained_model|model_source" value="bmz_pretrained" />
543 <param name="mode_selection|pretrained_model|bmz_model_name" value="sensible-cat" />
544
545 <!-- Phase decision (Q8) -->
546 <param name="mode_selection|workflow_selection|phase_decision|phases" value="test" />
547
548 <!-- Test data (Q11/Q12/Q13) -->
549 <param name="mode_selection|workflow_selection|phase_decision|test_sec|raw_test" value="im_0000.png" />
550 <param name="mode_selection|workflow_selection|phase_decision|test_sec|test_gt_selection|has_gt" value="yes" />
551 <param name="mode_selection|workflow_selection|phase_decision|test_sec|test_gt_selection|gt_test" value="mask_0000.png" />
552
553 <param name="selected_outputs" value="raw,metrics" />
554 <output_collection name="predictions_raw" type="list" count="1" />
555 <output_collection name="test_metrics" type="list" count="1"/>
556 <output name="config_file">
557 <assert_contents>
558 <has_size min="1"/>
559 <has_text text="SEMANTIC_SEG" />
560 <has_text text="sensible-cat" />
561 </assert_contents>
562 </output>
563
564 <assert_command>
565 <has_text text="--config "/>
566 <has_text text="--result_dir './output'"/>
567 <has_text text="--name 'my_experiment'"/>
568 <has_text text="--run_id 1"/>
569 </assert_command>
570 </test>
571
572 </tests>
573 <help><![CDATA[
574 **What it does**
575
576 This tool runs a BiaPy workflow for image analysis using deep learning models. BiaPy is a bioimage analysis pipeline designed to simplify training, prediction, and evaluation across a variety of tasks such as image segmentation, classification, denoising, and more.
577
578 ---
579
580 **Usage**
581
582 There are two main usage modes for this tool:
583
584 1. **Using a custom configuration file (YAML)**
585 If you already have a BiaPy configuration file, you can upload it directly. The tool will use this configuration without further modification to run the specified BiaPy workflow.
586
587 2. **Constructing a configuration interactively**
588 If you do not have a YAML configuration file, the tool can help you build one by asking a set of guided questions. This includes settings like:
589 - Task type (e.g., segmentation, classification)
590 - Model architecture
591 - Input/output patch sizes
592 - Data paths and formats
593 - Training parameters (epochs, batch size, etc.)
594
595 Once these options are specified, the tool generates a valid BiaPy YAML config and proceeds to execute the workflow.
596
597 ---
598
599 **Output**
600
601 The output depends on the chosen workflow and may include:
602 - Trained model weights
603 - Prediction results
604 - Evaluation metrics (if ground truth is available)
605 - Log files and training history
606
607 ---
608
609 **Tips**
610
611 - For best results, ensure that your input data format matches what BiaPy expects. Refer to the [BiaPy documentation](https://biapy.readthedocs.io/en/latest/) for details.
612 - Use the "interactive mode" if you're new to BiaPy and want guidance on configuration.
613 - Advanced users with pre-tuned configs may prefer uploading a YAML directly for faster execution.
614
615 ---
616
617 **References**
618 - BiaPy landing page: https://biapyx.github.io/
619 - BiaPy documentation: https://biapy.readthedocs.io/
620 - Galaxy Tool Development: https://galaxyproject.org/tools/
621 ]]></help>
622 <expand macro="citations"/>
623 </tool>