Mercurial > repos > imgteam > points2labelimage
comparison points2label.xml @ 5:dc91192a7150 draft default tip
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points2labelimage/ commit edac062b00490276ef00d094e0594abdb3a3f23c
| author | imgteam |
|---|---|
| date | Thu, 06 Nov 2025 09:59:19 +0000 |
| parents | 64c155acb864 |
| children |
comparison
equal
deleted
inserted
replaced
| 4:64c155acb864 | 5:dc91192a7150 |
|---|---|
| 1 <tool id="ip_points_to_label" name="Convert 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@" 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.5.0</token> |
| 7 <token name="@VERSION_SUFFIX@">1</token> | |
| 8 </macros> | 7 </macros> |
| 9 <creator> | 8 <creator> |
| 10 <expand macro="creators/bmcv" /> | 9 <expand macro="creators/bmcv" /> |
| 11 </creator> | 10 </creator> |
| 12 <edam_operations> | 11 <edam_operations> |
| 14 </edam_operations> | 13 </edam_operations> |
| 15 <xrefs> | 14 <xrefs> |
| 16 <xref type="bio.tools">galaxy_image_analysis</xref> | 15 <xref type="bio.tools">galaxy_image_analysis</xref> |
| 17 </xrefs> | 16 </xrefs> |
| 18 <requirements> | 17 <requirements> |
| 19 <requirement type="package" version="0.21">scikit-image</requirement> | 18 <requirement type="package" version="0.25.2">scikit-image</requirement> |
| 20 <requirement type="package" version="1.26.4">numpy</requirement> | 19 <requirement type="package" version="2.3.4">numpy</requirement> |
| 21 <requirement type="package" version="1.2.4">pandas</requirement> | 20 <requirement type="package" version="2.3.3">pandas</requirement> |
| 22 <requirement type="package" version="2024.6.18">tifffile</requirement> | 21 <requirement type="package" version="2025.10.16">tifffile</requirement> |
| 23 <requirement type="package" version="0.3.1">giatools</requirement> | 22 <requirement type="package" version="0.3.1">giatools</requirement> |
| 24 </requirements> | 23 </requirements> |
| 25 <command detect_errors="aggressive"><![CDATA[ | 24 <command detect_errors="aggressive"><![CDATA[ |
| 26 | 25 |
| 27 python '$__tool_directory__/points2label.py' | 26 python '$__tool_directory__/points2label.py' |
| 27 '$input.file_ext' | |
| 28 '$input' | 28 '$input' |
| 29 '$output' | 29 '$output' |
| 30 $shapex | 30 $shapex |
| 31 $shapey | 31 $shapey |
| 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,geojson" label="List of points in tabular or geojson format"/> | 38 <param name="input" type="data" format="tabular,geojson" label="Shapes to be rasterized"/> |
| 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 the 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 the 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. Ignored, if GeoJSON is used for input." /> | 41 <param name="has_header" type="boolean" checked="true" truevalue="--has_header True" falsevalue="" optional="true" label="Tabular list of shapes has header" help="Only used if the input is a tabular file (ignored for GeoJSON). Turning this off will interpret the tabular file as a list of points, where the X and Y coordinates correspond to the first and second column, respectively." /> |
| 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 before rasterization. The width and height of the output image is not affected." /> |
| 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 shapes (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> |
| 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.tiff" ftype="tiff" /> | 107 <expand macro="tests/label_image_diff" name="output" value="output4.tiff" ftype="tiff" /> |
| 108 </test> | 108 </test> |
| 109 <!-- Labeled / ROI / Rectangles --> | 109 <!-- Labeled / TSV with header / TSV with labels / Circles + Rectangles --> |
| 110 <test> | |
| 111 <param name="input" value="input5.tsv" /> | |
| 112 <param name="shapex" value="200" /> | |
| 113 <param name="shapey" value="100" /> | |
| 114 <param name="has_header" value="true" /> | |
| 115 <param name="swap_xy" value="false" /> | |
| 116 <param name="binary" value="false" /> | |
| 117 <expand macro="tests/label_image_diff" name="output" value="output8.tiff" ftype="tiff" /> | |
| 118 </test> | |
| 119 <test expect_failure="true"> | |
| 120 <!-- The test should fail because simultaneous usage of radius and width/height on a row is forbidden --> | |
| 121 <param name="input" value="input6.tsv" /> | |
| 122 <param name="shapex" value="200" /> | |
| 123 <param name="shapey" value="100" /> | |
| 124 <param name="has_header" value="true" /> | |
| 125 <param name="swap_xy" value="false" /> | |
| 126 <param name="binary" value="false" /> | |
| 127 <assert_stderr> | |
| 128 <has_text text="Ambiguous shape type (circle or rectangle)" /> | |
| 129 </assert_stderr> | |
| 130 </test> | |
| 131 <!-- Labeled / GeoJSON / mixed name and no-name --> | |
| 110 <test> | 132 <test> |
| 111 <param name="input" value="rois.geojson" /> | 133 <param name="input" value="rois.geojson" /> |
| 112 <param name="shapex" value="300" /> | 134 <param name="shapex" value="300" /> |
| 113 <param name="shapey" value="300" /> | 135 <param name="shapey" value="300" /> |
| 114 <param name="has_header" value="false" /> | 136 <param name="has_header" value="false" /> |
| 115 <param name="swap_xy" value="false" /> | 137 <param name="swap_xy" value="false" /> |
| 116 <param name="binary" value="false" /> | 138 <param name="binary" value="false" /> |
| 117 <expand macro="tests/label_image_diff" name="output" value="output5.tiff" ftype="tiff" /> | 139 <expand macro="tests/label_image_diff" name="output" value="output5.tiff" ftype="tiff" /> |
| 118 </test> | 140 </test> |
| 119 <test> | 141 <test> |
| 142 <param name="input" value="rois.geojson" /> | |
| 143 <param name="shapex" value="300" /> | |
| 144 <param name="shapey" value="300" /> | |
| 145 <param name="has_header" value="false" /> | |
| 146 <param name="swap_xy" value="true" /> | |
| 147 <param name="binary" value="false" /> | |
| 148 <expand macro="tests/label_image_diff" name="output" value="output6.tiff" ftype="tiff" /> | |
| 149 </test> | |
| 150 <!-- Labeled / GeoJSON / no-name --> | |
| 151 <test> | |
| 120 <param name="input" value="rois-noname.geojson" /> | 152 <param name="input" value="rois-noname.geojson" /> |
| 121 <param name="shapex" value="300" /> | 153 <param name="shapex" value="300" /> |
| 122 <param name="shapey" value="300" /> | 154 <param name="shapey" value="300" /> |
| 123 <param name="has_header" value="false" /> | 155 <param name="has_header" value="false" /> |
| 124 <param name="swap_xy" value="false" /> | 156 <param name="swap_xy" value="false" /> |
| 125 <param name="binary" value="false" /> | 157 <param name="binary" value="false" /> |
| 126 <expand macro="tests/label_image_diff" name="output" value="output5.tiff" ftype="tiff" /> | 158 <expand macro="tests/label_image_diff" name="output" value="output7.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> | 159 </test> |
| 137 <test expect_failure="true"> | 160 <test expect_failure="true"> |
| 138 <!-- The test should fail because the GeoJSON is not rectangular --> | 161 <!-- The test should fail because the GeoJSON uses the `LineString` primitive type that is not supported yet --> |
| 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" /> | 162 <param name="input" value="rois-illegal2.geojson" /> |
| 149 <param name="shapex" value="300" /> | 163 <param name="shapex" value="300" /> |
| 150 <param name="shapey" value="300" /> | 164 <param name="shapey" value="300" /> |
| 151 <param name="has_header" value="false" /> | 165 <param name="has_header" value="false" /> |
| 152 <param name="swap_xy" value="false" /> | 166 <param name="swap_xy" value="false" /> |
| 153 <param name="binary" value="false" /> | 167 <param name="binary" value="false" /> |
| 168 <assert_stderr> | |
| 169 <has_text text='Unsupported geometry type: "LineString"' /> | |
| 170 </assert_stderr> | |
| 154 </test> | 171 </test> |
| 155 </tests> | 172 </tests> |
| 156 <help> | 173 <help> |
| 157 | 174 |
| 158 **Converts a list of points to a label map by rasterizing the coordinates.** | 175 **Converts a list of shapes to a label map via rasterization.** |
| 159 | 176 |
| 160 The created image is a single-channel image with 16 bits per pixel (unsigned integer). The points are | 177 The created image is a single-channel image with 16 bits per pixel (unsigned integers). The shapes are |
| 161 rasterized with unique labels, or the value 65535 (white) for binary image output. Pixels not corresponding to | 178 rasterized with unique labels, explicitly given labels (custom), or the value 65535 (white) for binary image |
| 162 any points in the tabular file are assigned the value 0 (black). | 179 output. Pixels not corresponding to any shapes are assigned the value 0 (black). |
| 163 | 180 |
| 164 **Using a tabular input file:** The tabular list of points can either be header-less. In this case, the first | 181 **Using a GeoJSON input file (recommended).** Only features (shape specifications) of `Polygon` and `Point` |
| 165 and second columns are expected to be the X and Y coordinates, respectively. Otherwise, if a header is present, | 182 type are supported. In conjunction with the `radius` property, a `Point` type feature can also be used to |
| 166 it is searched for the following column names: | 183 represent circles. Custom labels can be encoded in the `name` property (must be numeric and integer), and |
| 167 | 184 different features are allowed to use the same labels. |
| 168 - ``pos_x`` or ``POS_X``: This column corresponds to the X coordinates. | 185 |
| 169 - ``pos_y`` or ``POS_Y``: This column corresponds to the Y coordinates. | 186 **Using a tabular input file (deprecated).** The tabular list of points can either be header-less. In this |
| 170 - If a ``radius`` or ``RADIUS`` column is present, then the points will be rasterized as circles of the | 187 case, the first and second columns are expected to be the X and Y coordinates, respectively, and each row |
| 171 corresponding radii. | 188 corresponds to a single point. Otherwise, if a header is present, it is searched for the following column |
| 172 - If ``width`` or ``WIDTH`` and ``height`` or ``HEIGHT`` columns are present, then the points will be rasterized | 189 names: |
| 173 as rectangles of the corresponding size. | 190 |
| 191 - Column ``pos_x`` or ``POS_X`` is mandatory and corresponds to the X coordinates. | |
| 192 - Column ``pos_y`` or ``POS_Y`` is mandatory and corresponds to the Y coordinates. | |
| 193 - If a ``radius`` or ``RADIUS`` column is present and the value in a row is positive, then the row will be | |
| 194 rasterized as a circle of the corresponding size, centered at the given X and Y coordinates. | |
| 195 - If ``width`` or ``WIDTH`` and ``height`` or ``HEIGHT`` columns are present and the values in a row are | |
| 196 positive, then the rows will be rasterized as rectangles of the corresponding size, with the upper-left | |
| 197 corner given by the X and Y coordinates. | |
| 174 - If a ``label`` or ``LABEL`` column is present, then the corresponding labels will be used for rasterization | 198 - If a ``label`` or ``LABEL`` column is present, then the corresponding labels will be used for rasterization |
| 175 (unless "Produce binary image" is activated). Different points are allowed to use the same label. If used, the | 199 (unless "Produce binary image" is activated). Different rows are allowed to use the same label. If used, |
| 176 label must be numeric and integer. | 200 the label must be numeric and integer. |
| 177 | |
| 178 **Using a GeoJSON input file:** Only rectangular specifications of `Polygon` type geometry is supported. | |
| 179 | 201 |
| 180 </help> | 202 </help> |
| 181 <citations> | 203 <citations> |
| 182 <citation type="doi">10.1016/j.jbiotec.2017.07.019</citation> | 204 <citation type="doi">10.1016/j.jbiotec.2017.07.019</citation> |
| 183 </citations> | 205 </citations> |
