comparison points2label.xml @ 4:64c155acb864 draft

planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points2labelimage/ commit 9a40a5d1e1008c26cc327c6d163df2a1af22a1a0
author imgteam
date Mon, 12 May 2025 14:01:09 +0000
parents 2ae122d5d85a
children dc91192a7150
comparison
equal deleted inserted replaced
3:2ae122d5d85a 4:64c155acb864
1 <tool id="ip_points_to_label" name="Convert point coordinates to label map" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="20.05"> 1 <tool id="ip_points_to_label" name="Convert coordinates to label map" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="20.05">
2 <description></description> 2 <description></description>
3 <macros> 3 <macros>
4 <import>creators.xml</import> 4 <import>creators.xml</import>
5 <import>tests.xml</import> 5 <import>tests.xml</import>
6 <token name="@TOOL_VERSION@">0.4.1</token> 6 <token name="@TOOL_VERSION@">0.4.1</token>
7 <token name="@VERSION_SUFFIX@">0</token> 7 <token name="@VERSION_SUFFIX@">1</token>
8 </macros> 8 </macros>
9 <creator> 9 <creator>
10 <expand macro="creators/bmcv" /> 10 <expand macro="creators/bmcv" />
11 </creator> 11 </creator>
12 <edam_operations> 12 <edam_operations>
13 <edam_operation>operation_3443</edam_operation> 13 <edam_operation>operation_3443</edam_operation>
14 </edam_operations> 14 </edam_operations>
15 <xrefs> 15 <xrefs>
16 <xref type="bio.tools">galaxy_image_analysis</xref> 16 <xref type="bio.tools">galaxy_image_analysis</xref>
17 </xrefs> 17 </xrefs>
18 <requirements> 18 <requirements>
19 <requirement type="package" version="0.21">scikit-image</requirement> 19 <requirement type="package" version="0.21">scikit-image</requirement>
20 <requirement type="package" version="1.26.4">numpy</requirement> 20 <requirement type="package" version="1.26.4">numpy</requirement>
21 <requirement type="package" version="1.2.4">pandas</requirement> 21 <requirement type="package" version="1.2.4">pandas</requirement>
22 <requirement type="package" version="2024.6.18">tifffile</requirement> 22 <requirement type="package" version="2024.6.18">tifffile</requirement>
23 <requirement type="package" version="0.3.1">giatools</requirement> 23 <requirement type="package" version="0.3.1">giatools</requirement>
24 </requirements> 24 </requirements>
25 <command detect_errors="aggressive"><![CDATA[ 25 <command detect_errors="aggressive"><![CDATA[
26 26
27 python '$__tool_directory__/points2label.py' 27 python '$__tool_directory__/points2label.py'
28 '$input' 28 '$input'
32 $has_header 32 $has_header
33 $swap_xy 33 $swap_xy
34 $binary 34 $binary
35 35
36 ]]></command> 36 ]]></command>
37 <inputs> 37 <inputs>
38 <param name="input" type="data" format="tabular" label="Tabular list of points"/> 38 <param name="input" type="data" format="tabular,geojson" label="List of points in tabular or geojson format"/>
39 <param name="shapex" type="integer" value="500" min="1" label="Width of output image" /> 39 <param name="shapex" type="integer" value="500" min="1" label="Width of output image" />
40 <param name="shapey" type="integer" value="500" min="1" label="Height of output image" /> 40 <param name="shapey" type="integer" value="500" min="1" label="Height of output image" />
41 <param name="has_header" type="boolean" checked="true" truevalue="--has_header True" falsevalue="" optional="true" label="Tabular list of points has header" help="Turning this off will ignore the first row and assume that the X and Y coordinates correspond to the first and second column, respectively." /> 41 <param name="has_header" type="boolean" checked="true" truevalue="--has_header True" falsevalue="" optional="true" label="Tabular list of points has header" help="Turning this off will ignore the first row and assume that the X and Y coordinates correspond to the first and second column, respectively. Ignored, if GeoJSON is used for input." />
42 <param name="swap_xy" type="boolean" checked="false" falsevalue="" truevalue="--swap_xy True" optional="true" label="Swap X and Y coordinates" help="Swap the X and Y coordinates, regardless of whether the tabular list has a header or not." /> 42 <param name="swap_xy" type="boolean" checked="false" falsevalue="" truevalue="--swap_xy True" optional="true" label="Swap X and Y coordinates" help="Swap the X and Y coordinates, regardless of whether the tabular list has a header or not." />
43 <param name="binary" type="boolean" checked="false" truevalue="--binary True" falsevalue="" optional="true" label="Produce binary image" help="Use the same label for all points (65535)." /> 43 <param name="binary" type="boolean" checked="false" truevalue="--binary True" falsevalue="" optional="true" label="Produce binary image" help="Use the same label for all points (65535)." />
44 </inputs> 44 </inputs>
45 <outputs> 45 <outputs>
46 <data name="output" format="tiff" /> 46 <data name="output" format="tiff" />
47 </outputs> 47 </outputs>
48 <tests> 48 <tests>
52 <param name="shapex" value="30" /> 52 <param name="shapex" value="30" />
53 <param name="shapey" value="20" /> 53 <param name="shapey" value="20" />
54 <param name="has_header" value="false" /> 54 <param name="has_header" value="false" />
55 <param name="swap_xy" value="true" /> 55 <param name="swap_xy" value="true" />
56 <param name="binary" value="true" /> 56 <param name="binary" value="true" />
57 <expand macro="tests/binary_image_diff" name="output" value="output1_binary.tif" ftype="tiff" /> 57 <expand macro="tests/binary_image_diff" name="output" value="output1_binary.tiff" ftype="tiff" />
58 </test> 58 </test>
59 <!-- Binary / TSV with header / Circles --> 59 <!-- Binary / TSV with header / Circles -->
60 <test> 60 <test>
61 <param name="input" value="input2.tsv" /> 61 <param name="input" value="input2.tsv" />
62 <param name="shapex" value="205" /> 62 <param name="shapex" value="205" />
63 <param name="shapey" value="84" /> 63 <param name="shapey" value="84" />
64 <param name="has_header" value="true" /> 64 <param name="has_header" value="true" />
65 <param name="swap_xy" value="false" /> 65 <param name="swap_xy" value="false" />
66 <param name="binary" value="true" /> 66 <param name="binary" value="true" />
67 <expand macro="tests/binary_image_diff" name="output" value="output2_binary.tif" ftype="tiff" /> 67 <expand macro="tests/binary_image_diff" name="output" value="output2_binary.tiff" ftype="tiff" />
68 </test> 68 </test>
69 <!-- Labeled / TSV with header / Circles --> 69 <!-- Labeled / TSV with header / Circles -->
70 <test> 70 <test>
71 <param name="input" value="input2.tsv" /> 71 <param name="input" value="input2.tsv" />
72 <param name="shapex" value="205" /> 72 <param name="shapex" value="205" />
73 <param name="shapey" value="84" /> 73 <param name="shapey" value="84" />
74 <param name="has_header" value="true" /> 74 <param name="has_header" value="true" />
75 <param name="swap_xy" value="false" /> 75 <param name="swap_xy" value="false" />
76 <param name="binary" value="false" /> 76 <param name="binary" value="false" />
77 <expand macro="tests/label_image_diff" name="output" value="output2.tif" ftype="tiff" /> 77 <expand macro="tests/label_image_diff" name="output" value="output2.tiff" ftype="tiff" />
78 </test> 78 </test>
79 <!-- Binary / TSV with header / TSV with labels / Circles --> 79 <!-- Binary / TSV with header / TSV with labels / Circles -->
80 <test> 80 <test>
81 <param name="input" value="input3.tsv" /> 81 <param name="input" value="input3.tsv" />
82 <param name="shapex" value="200" /> 82 <param name="shapex" value="200" />
83 <param name="shapey" value="100" /> 83 <param name="shapey" value="100" />
84 <param name="has_header" value="true" /> 84 <param name="has_header" value="true" />
85 <param name="swap_xy" value="false" /> 85 <param name="swap_xy" value="false" />
86 <param name="binary" value="true" /> 86 <param name="binary" value="true" />
87 <expand macro="tests/binary_image_diff" name="output" value="output3_binary.tif" ftype="tiff" /> 87 <expand macro="tests/binary_image_diff" name="output" value="output3_binary.tiff" ftype="tiff" />
88 </test> 88 </test>
89 <!-- Labeled / TSV with header / TSV with labels / Circles --> 89 <!-- Labeled / TSV with header / TSV with labels / Circles -->
90 <test> 90 <test>
91 <param name="input" value="input3.tsv" /> 91 <param name="input" value="input3.tsv" />
92 <param name="shapex" value="200" /> 92 <param name="shapex" value="200" />
93 <param name="shapey" value="100" /> 93 <param name="shapey" value="100" />
94 <param name="has_header" value="true" /> 94 <param name="has_header" value="true" />
95 <param name="swap_xy" value="false" /> 95 <param name="swap_xy" value="false" />
96 <param name="binary" value="false" /> 96 <param name="binary" value="false" />
97 <expand macro="tests/label_image_diff" name="output" value="output3.tif" ftype="tiff" /> 97 <expand macro="tests/label_image_diff" name="output" value="output3.tiff" ftype="tiff" />
98 </test> 98 </test>
99 <!-- Labeled / TSV with header / TSV with labels / Rectangles --> 99 <!-- Labeled / TSV with header / TSV with labels / Rectangles -->
100 <test> 100 <test>
101 <param name="input" value="input4.tsv" /> 101 <param name="input" value="input4.tsv" />
102 <param name="shapex" value="200" /> 102 <param name="shapex" value="200" />
103 <param name="shapey" value="100" /> 103 <param name="shapey" value="100" />
104 <param name="has_header" value="true" /> 104 <param name="has_header" value="true" />
105 <param name="swap_xy" value="false" /> 105 <param name="swap_xy" value="false" />
106 <param name="binary" value="false" /> 106 <param name="binary" value="false" />
107 <expand macro="tests/label_image_diff" name="output" value="output4.tif" ftype="tiff" /> 107 <expand macro="tests/label_image_diff" name="output" value="output4.tiff" ftype="tiff" />
108 </test>
109 <!-- Labeled / ROI / Rectangles -->
110 <test>
111 <param name="input" value="rois.geojson" />
112 <param name="shapex" value="300" />
113 <param name="shapey" value="300" />
114 <param name="has_header" value="false" />
115 <param name="swap_xy" value="false" />
116 <param name="binary" value="false" />
117 <expand macro="tests/label_image_diff" name="output" value="output5.tiff" ftype="tiff" />
118 </test>
119 <test>
120 <param name="input" value="rois-noname.geojson" />
121 <param name="shapex" value="300" />
122 <param name="shapey" value="300" />
123 <param name="has_header" value="false" />
124 <param name="swap_xy" value="false" />
125 <param name="binary" value="false" />
126 <expand macro="tests/label_image_diff" name="output" value="output5.tiff" ftype="tiff" />
127 </test>
128 <test>
129 <param name="input" value="rois.geojson" />
130 <param name="shapex" value="300" />
131 <param name="shapey" value="300" />
132 <param name="has_header" value="false" />
133 <param name="swap_xy" value="true" />
134 <param name="binary" value="false" />
135 <expand macro="tests/label_image_diff" name="output" value="output6.tiff" ftype="tiff" />
136 </test>
137 <test expect_failure="true">
138 <!-- The test should fail because the GeoJSON is not rectangular -->
139 <param name="input" value="rois-illegal1.geojson" />
140 <param name="shapex" value="300" />
141 <param name="shapey" value="300" />
142 <param name="has_header" value="false" />
143 <param name="swap_xy" value="false" />
144 <param name="binary" value="false" />
145 </test>
146 <test expect_failure="true">
147 <!-- The test should fail because the GeoJSON is not of `Polygon` type -->
148 <param name="input" value="rois-illegal2.geojson" />
149 <param name="shapex" value="300" />
150 <param name="shapey" value="300" />
151 <param name="has_header" value="false" />
152 <param name="swap_xy" value="false" />
153 <param name="binary" value="false" />
108 </test> 154 </test>
109 </tests> 155 </tests>
110 <help> 156 <help>
111 157
112 **Converts a tabular list of points to a label map by rasterizing the point coordinates.** 158 **Converts a list of points to a label map by rasterizing the coordinates.**
113 159
114 The created image is a single-channel image with 16 bits per pixel (unsigned integer). The points are 160 The created image is a single-channel image with 16 bits per pixel (unsigned integer). The points are
115 rasterized with unique labels, or the value 65535 (white) for binary image output. Pixels not corresponding to 161 rasterized with unique labels, or the value 65535 (white) for binary image output. Pixels not corresponding to
116 any points in the tabular file are assigned the value 0 (black). 162 any points in the tabular file are assigned the value 0 (black).
117 163
118 The tabular list of points can either be header-less. In this case, the first and second columns are expected 164 **Using a tabular input file:** The tabular list of points can either be header-less. In this case, the first
119 to be the X and Y coordinates, respectively. Otherwise, if a header is present, it is searched for the 165 and second columns are expected to be the X and Y coordinates, respectively. Otherwise, if a header is present,
120 following column names: 166 it is searched for the following column names:
121 167
122 - ``pos_x`` or ``POS_X``: This column corresponds to the X coordinates. 168 - ``pos_x`` or ``POS_X``: This column corresponds to the X coordinates.
123 - ``pos_y`` or ``POS_Y``: This column corresponds to the Y coordinates. 169 - ``pos_y`` or ``POS_Y``: This column corresponds to the Y coordinates.
124 - If a ``radius`` or ``RADIUS`` column is present, then the points will be rasterized as circles of the 170 - If a ``radius`` or ``RADIUS`` column is present, then the points will be rasterized as circles of the
125 corresponding radii. 171 corresponding radii.
126 - If ``width`` or ``WIDTH`` and ``height`` or ``HEIGHT`` columns are present, then the points will be rasterized 172 - If ``width`` or ``WIDTH`` and ``height`` or ``HEIGHT`` columns are present, then the points will be rasterized
127 as rectangles of the corresponding size. 173 as rectangles of the corresponding size.
128 - If a ``label`` or ``LABEL`` column is present, then the corresponding labels will be used for rasterization 174 - If a ``label`` or ``LABEL`` column is present, then the corresponding labels will be used for rasterization
129 (unless "Produce binary image" is activated). Different points are allowed to use the same label. 175 (unless "Produce binary image" is activated). Different points are allowed to use the same label. If used, the
176 label must be numeric and integer.
177
178 **Using a GeoJSON input file:** Only rectangular specifications of `Polygon` type geometry is supported.
130 179
131 </help> 180 </help>
132 <citations> 181 <citations>
133 <citation type="doi">10.1016/j.jbiotec.2017.07.019</citation> 182 <citation type="doi">10.1016/j.jbiotec.2017.07.019</citation>
134 </citations> 183 </citations>
135 </tool> 184 </tool>