diff points2label.xml @ 3:de611b3b5ae8 draft default tip

planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points2labelimage/ commit 6fc9ab8db9ef72ac7ded30d7373768feeae9390d
author imgteam
date Fri, 27 Sep 2024 17:41:21 +0000
parents 30ca5d5d03ec
children
line wrap: on
line diff
--- a/points2label.xml	Mon Nov 13 22:11:46 2023 +0000
+++ b/points2label.xml	Fri Sep 27 17:41:21 2024 +0000
@@ -1,41 +1,121 @@
-<tool id="ip_points_to_label" name="Convert point coordinates to label map" version="0.3-2"> 
+<tool id="ip_points_to_label" name="Convert point coordinates to label map" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="20.05">
     <description></description>
+    <macros>
+        <import>creators.xml</import>
+        <import>tests.xml</import>
+        <token name="@TOOL_VERSION@">0.4</token>
+        <token name="@VERSION_SUFFIX@">0</token>
+    </macros>
+    <creator>
+        <expand macro="creators/bmcv" />
+    </creator>
     <edam_operations>
         <edam_operation>operation_3443</edam_operation>
     </edam_operations>
     <xrefs>
         <xref type="bio.tools">galaxy_image_analysis</xref>
     </xrefs>
-    <requirements>
-        <requirement type="package" version="1.15.4">numpy</requirement>
-        <requirement type="package" version="0.14.2">scikit-image</requirement>
-        <requirement type="package" version="0.23.4">pandas</requirement>
-        <requirement type="package" version="0.15.1">tifffile</requirement>
-    </requirements> 
-    <command detect_errors="aggressive">
-    <![CDATA[
-        python '$__tool_directory__/points2label.py' '$input' '$output' '$org_file' $has_header
-    ]]>
-    </command>
-    <inputs>
-        <param name="input" type="data" format="tabular" label="Point CSV file"/>
-        <param name="org_file" type="data" format="tiff" label="Original label image file"/>
-        <param name="has_header" type="boolean" checked="false" truevalue="--has_header True" falsevalue="" optional="true" label="Does point file contain header?" /> 
+    <requirements> 
+        <requirement type="package" version="0.21">scikit-image</requirement> 
+        <requirement type="package" version="1.26.4">numpy</requirement>
+        <requirement type="package" version="1.2.4">pandas</requirement>
+        <requirement type="package" version="2024.6.18">tifffile</requirement>
+        <requirement type="package" version="0.3.1">giatools</requirement> 
+    </requirements>
+    <command detect_errors="aggressive"><![CDATA[
+
+        python '$__tool_directory__/points2label.py'
+        '$input'
+        '$output'
+        $shapex
+        $shapey
+        $has_header
+        $swap_xy
+        $binary
+
+    ]]></command>
+    <inputs> 
+        <param name="input" type="data" format="tabular" label="Tabular list of points"/> 
+        <param name="shapex" type="integer" value="500" min="1" label="Width of output image" />
+        <param name="shapey" type="integer" value="500" min="1" label="Height of output image" />
+        <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." /> 
+        <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." />
+        <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)." /> 
     </inputs>
     <outputs>
-        <data name="output" format="tiff"/>
+        <data name="output" format="tiff" />
     </outputs>
     <tests>
+        <!-- Binary / TSV without header -->
         <test>
-            <param name="input" value="points.tsv"/>
-            <param name="org_file" value="galaxyIcon_noText.tif"/>
-            <output name="output" file="out.tif" ftype="tiff" compare="sim_size"/>
+            <param name="input" value="input1.tsv" />
+            <param name="shapex" value="30" />
+            <param name="shapey" value="20" />
+            <param name="has_header" value="false" />
+            <param name="swap_xy" value="true" />
+            <param name="binary" value="true" />
+            <expand macro="tests/binary_image_diff" name="output" value="output1_binary.tif" ftype="tiff" />
+        </test>
+        <!-- Binary / TSV with header -->
+        <test>
+            <param name="input" value="input2.tsv" />
+            <param name="shapex" value="205" />
+            <param name="shapey" value="84" />
+            <param name="has_header" value="true" />
+            <param name="swap_xy" value="false" />
+            <param name="binary" value="true" />
+            <expand macro="tests/binary_image_diff" name="output" value="output2_binary.tif" ftype="tiff" />
+        </test>
+        <!-- Labeled / TSV with header -->
+        <test>
+            <param name="input" value="input2.tsv" />
+            <param name="shapex" value="205" />
+            <param name="shapey" value="84" />
+            <param name="has_header" value="true" />
+            <param name="swap_xy" value="false" />
+            <param name="binary" value="false" />
+            <expand macro="tests/label_image_diff" name="output" value="output2.tif" ftype="tiff" />
+        </test>
+        <!-- Binary / TSV with header / TSV with labels -->
+        <test>
+            <param name="input" value="input3.tsv" />
+            <param name="shapex" value="200" />
+            <param name="shapey" value="100" />
+            <param name="has_header" value="true" />
+            <param name="swap_xy" value="false" />
+            <param name="binary" value="true" />
+            <expand macro="tests/binary_image_diff" name="output" value="output3_binary.tif" ftype="tiff" />
+        </test>
+        <!-- Labeled / TSV with header / TSV with labels -->
+        <test>
+            <param name="input" value="input3.tsv" />
+            <param name="shapex" value="200" />
+            <param name="shapey" value="100" />
+            <param name="has_header" value="true" />
+            <param name="swap_xy" value="false" />
+            <param name="binary" value="false" />
+            <expand macro="tests/label_image_diff" name="output" value="output3.tif" ftype="tiff" />
         </test>
     </tests>
     <help>
-    **What it does**
+
+        **Converts a tabular list of points to a label map by rasterizing the point coordinates.**
+
+        The created image is a single-channel image with 16 bits per pixel (unsigned integer). The points are
+        rasterized with unique labels, or the value 65535 (white) for binary image output. Pixels not corresponding to
+        any points in the tabular file are assigned the value 0 (black).
 
-    This tool converts points to a label image.
+        The tabular list of points can either be header-less. In this case, the first and second columns are expected
+        to be the X and Y coordinates, respectively. Otherwise, if a header is present, it is searched for the
+        following column names:
+
+        - ``pos_x`` or ``POS_X``: This column corresponds to the X coordinates.
+        - ``pos_y`` or ``POS_Y``: This column corresponds to the Y coordinates.
+        - If a ``radius`` or ``RADIUS`` column is present, then the points will be rasterized as circles of the
+          corresponding radii.
+        - If a ``label`` or ``LABEL`` column is present, then the corresponding labels will be used for rasterization
+          (unless "Produce binary image" is activated). Different points are allowed to use the same label.
+
     </help>
     <citations>
         <citation type="doi">10.1016/j.jbiotec.2017.07.019</citation>