forked from bgruening/galaxytools
-
Notifications
You must be signed in to change notification settings - Fork 1
/
cellpose.xml
149 lines (148 loc) · 8.55 KB
/
cellpose.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<tool id="cellpose" name="Run generalist cell and nucleus segmentation" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="23.02">
<description>with Cellpose</description>
<macros>
<token name="@TOOL_VERSION@">3.0.10</token>
<token name="@VERSION_SUFFIX@">1</token>
<xml name="channel">
<option value="0" selected="true">grayscale/None</option>
<option value="1">red</option>
<option value="2">green</option>
<option value="3">blue</option>
</xml>
</macros>
<requirements>
<requirement type="package" version="@TOOL_VERSION@">cellpose</requirement>
</requirements>
<stdio>
<exit_code range="1:" level="fatal" description="Error occurred. Please check Tool Standard Error"/>
</stdio>
<version_command>echo "@VERSION@"</version_command>
<command detect_errors="exit_code">
<![CDATA[
export CELLPOSE_LOCAL_MODELS_PATH='cellpose_models' &&
mkdir -p segmentation &&
ln -s '${img_in}' ./image.${img_in.ext} &&
python '$__tool_directory__/cp_segmentation.py'
--inputs '$inputs'
--img_path ./image.${img_in.ext}
--img_format '${img_in.ext}'
--output_dir ./segmentation
]]>
</command>
<configfiles>
<inputs name="inputs" />
</configfiles>
<inputs>
<param name="img_in" type="data" format="ome.tiff,tiff,jpeg,png" label="Choose the image file for segmention (usually after registration)"/>
<param name="model_type" type="select" label="Choose the pre-trained model type">
<option value="nuclei" selected="true">nuclei</option>
<option value="cyto">cyto</option>
<option value="cyto2">cyto2</option>
<option value="cyto3">cyto3</option>
</param>
<param argument="chan" type="select" label="Select the channel to segment" help="In this case, the default is grayscale">
<expand macro="channel"/>
</param>
<param argument="chan2" type="select" optional="true" label="Select the channel for nuclei segmatation" help="In this case, the default is None">
<expand macro="channel"/>
</param>
<param name="chan_first" type="boolean" truevalue="booltrue" falsevalue="boolfalse" checked="false" label="Use the reshaped data with channel as the first dimension?"/>
<param name="show_segmentation" type="boolean" truevalue="booltrue" falsevalue="boolfalse" checked="true" label="Whether to show segmentation?"/>
<param name="use_gpu" type="boolean" truevalue="booltrue" falsevalue="boolfalse" checked="false" label="Whether to use GPU?" />
<section name="options" title="Advanced Options" expanded="False">
<param argument="diameter" type="float" optional="true" label="Cell or nuclei diameter in pixels" help="Leave blank for automated estimation."/>
<param name="resample" type="boolean" truevalue="booltrue" falsevalue="boolfalse" checked="true" label="Run dynamics on the resampled image?"
help="Interpolated flows at the true image size. This option will create smoother ROIs when the cells are large but will be slower in case"/>
<param argument="flow_threshold" type="float" min="0" value="0.4" label="Flow error threshold (all cells with errors below threshold are kept) (not used for 3D)"/>
<param argument="cellprob_threshold" type="float" value="0.0" label="Cell probability threshold (all pixels with prob above threshold kept for masks)"/>
<param argument="niter" type="integer" min="0" value="0" label="Number of iterations"
help="By defalut, sets the number of iterations to be proportional to the ROI diameter. For longer ROIs, more iterations might be needed."/>
<param argument="do_3D" type="boolean" truevalue="booltrue" falsevalue="boolfalse" checked="false" label="Whether to run 3D segmentation on 4D image input?"/>
<param argument="tile" type="boolean" truevalue="booltrue" falsevalue="boolfalse" checked="true" label="Tiles image for test time augmentation and to ensure GPU memory usage limited (recommended)"/>
<param argument="rescale" type="float" value="" optional="true" label="If diameter is set to None, and rescale is not None, then rescale is used instead of diameter for resizing image"/>
<param argument="invert" type="boolean" truevalue="booltrue" falsevalue="boolfalse" checked="false" label="Whether to invert image pixel intensity before running network?"/>
</section>
</inputs>
<outputs>
<data format="tiff" name="cp_mask" from_work_dir="segmentation/cp_masks.tif" label="Cellpose ${model_type} masks on ${on_string}"/>
<data format="png" name="cp_segm" from_work_dir="segmentation/segm_show.png" label="Segmentation Show on ${on_string}">
<filter>show_segmentation</filter>
</data>
</outputs>
<tests>
<test expect_num_outputs="2">
<param name="img_in" value="img02.png"/>
<param name="model_type" value="cyto"/>
<param name="chan" value="2"/>
<param name="chan2" value="3"/>
<output name="cp_mask" file="img02_cp_masks_cyto.tif" compare="image_diff"/>
<output name="cp_segm" file="img02_cp_segm_cyto.png" compare="image_diff"/>
</test>
<test expect_num_outputs="2">
<param name="img_in" value="img02.png"/>
<param name="model_type" value="cyto2"/>
<param name="chan" value="2"/>
<param name="chan2" value="3"/>
<output name="cp_mask" file="img02_cp_masks_cyto2.tif" compare="image_diff"/>
<output name="cp_segm" file="img02_cp_segm_cyto2.png" compare="image_diff"/>
</test>
<test expect_num_outputs="2">
<param name="img_in" value="img02.png"/>
<param name="model_type" value="cyto3"/>
<param name="chan" value="2"/>
<param name="chan2" value="3"/>
<output name="cp_mask" file="img02_cp_masks_cyto3.tif" compare="image_diff"/>
<output name="cp_segm" file="img02_cp_segm_cyto3.png" compare="image_diff"/>
</test>
<test expect_num_outputs="2">
<param name="img_in" value="img02.png"/>
<param name="model_type" value="nuclei"/>
<param name="chan" value="2"/>
<param name="chan2" value="3"/>
<output name="cp_mask" file="img02_cp_masks_nuclei.tif" compare="image_diff"/>
<output name="cp_segm" file="img02_cp_segm_nuclei.png" compare="image_diff"/>
</test>
<test expect_num_outputs="2">
<param name="img_in" value="img02.png"/>
<param name="model_type" value="cyto"/>
<param name="chan" value="2"/>
<param name="chan2" value="1"/>
<output name="cp_mask" file="img02_cp_masks_chan.tif" compare="image_diff"/>
<output name="cp_segm" file="img02_cp_segm_chan.png" compare="image_diff"/>
</test>
<test expect_num_outputs="2">
<param name="img_in" value="img02.png"/>
<param name="model_type" value="cyto"/>
<param name="chan" value="2"/>
<param name="chan2" value="3"/>
<param name="diameter" value="50"/>
<output name="cp_mask" file="img02_cp_masks_diameter.tif" compare="image_diff"/>
<output name="cp_segm" file="img02_cp_segm_diameter.png" compare="image_diff"/>
</test>
<test expect_num_outputs="2">
<param name="img_in" value="img02.png"/>
<param name="use_gpu" value="true"/>
<param name="model_type" value="cyto"/>
<param name="chan" value="2"/>
<param name="chan2" value="3"/>
<output name="cp_mask" file="img02_cp_masks_gpu.tif" compare="image_diff"/>
<output name="cp_segm" file="img02_cp_segm_gpu.png" compare="image_diff"/>
</test>
<test expect_num_outputs="1">
<param name="img_in" value="img02.png"/>
<param name="model_type" value="cyto"/>
<param name="chan" value="2"/>
<param name="chan2" value="3"/>
<param name="show_segmentation" value="false"/>
<output name="cp_mask" file="img02_cp_masks_cyto.tif" compare="image_diff"/>
</test>
</tests>
<help>
<![CDATA[
Cellpose: A generalist algorithm for cell and nucleus segmentation.
]]>
</help>
<citations>
<citation type="doi">10.1101/2020.02.02.931238</citation>
</citations>
</tool>