changeset 2:8f76184ca03f draft

planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/2d_filter_segmentation_by_features/ commit c045f067a57e8308308cf6329060c7ccd3fc372f
author imgteam
date Thu, 04 Apr 2024 15:23:28 +0000
parents 6ad1d3cfdea1
children 9d47aabda459
files 2d_filter_segmentation_by_features.xml creators.xml tests.xml
diffstat 3 files changed, 176 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/2d_filter_segmentation_by_features.xml	Mon Nov 13 22:10:21 2023 +0000
+++ b/2d_filter_segmentation_by_features.xml	Thu Apr 04 15:23:28 2024 +0000
@@ -1,5 +1,12 @@
-<tool id="ip_2d_filter_segmentation_by_features" name="Filter label map by rules" version="0.0.1-2">
-   <description></description>
+<tool id="ip_2d_filter_segmentation_by_features" name="Filter label map by rules" version="0.0.1-3" profile="20.05">
+    <description></description>
+    <macros>
+        <import>creators.xml</import>
+        <import>tests.xml</import>
+    </macros>
+    <creator>
+        <expand macro="creators/bmcv" />
+    </creator>
     <edam_operations>
         <edam_operation>operation_3443</edam_operation>
     </edam_operations>
@@ -12,15 +19,20 @@
         <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__/2d_filter_segmentation_by_features.py' '$input' '$output' '$feature_file' '$rule_file'
-    ]]>
-    </command>
+    <command detect_errors="aggressive"><![CDATA[
+
+        python '$__tool_directory__/2d_filter_segmentation_by_features.py'
+
+        '$input'
+        '$output'
+        '$feature_file'
+        '$rule_file'
+
+    ]]></command>
     <inputs>
-        <param name="input" type="data" format="tiff" label="Source file" /> 
-        <param name="feature_file" type="data" format="tabular" label="Feature file" /> 
-        <param name="rule_file" type="data" format="tabular" label="Rules file" /> 
+        <param name="input" type="data" format="tiff" label="Label map" /> 
+        <param name="feature_file" type="data" format="tabular" label="Features" /> 
+        <param name="rule_file" type="data" format="tabular" label="Rules" /> 
     </inputs>
     <outputs>
        <data format="tiff" name="output" />
@@ -30,12 +42,45 @@
             <param name="input" value="in.tif"/>
             <param name="feature_file" value="features.tabular"/>
             <param name="rule_file" value="rules.tabular"/>
-            <output name="output" value="out.tif" ftype="tiff" compare="sim_size"/>
+            <expand macro="tests/label_image_diff" name="output" value="out.tif" ftype="tiff"/>
         </test>
     </tests>
     <help>
-        Filter label image by rules (e.g., remove large or deformed objects).
-        Rules file has a specific format (cols: ,f1,2, rows: feature_name, min, max). The features have to be also profived in a specific format (cols: label, f1, f2).
+
+        **Filters a label map by rules (e.g., remove large or deformed objects).**
+
+        The properties of the labeled image regions (features) must be provided in a specific tabular format
+        (columns: ``label``, ``feature1``, ``feature2``, and so on, where ``feature1`` and ``feature2`` can be arbitrary strings).
+        Each row corresponds to a labeled image region.
+        An example is given below.
+
+        +-------+-------+---------------------+
+        | label | area  | eccentricity        |
+        +-------+-------+---------------------+
+        | 1     | 344   | 0.42521053699241596 |
+        +-------+-------+---------------------+
+        | 2     | 434   | 0.47679001553231926 |
+        +-------+-------+---------------------+
+        | 3     | 907   | 0.9973539531125177  |
+        +-------+-------+---------------------+
+        | 4     | 14320 | 0.17131009631035327 |
+        +-------+-------+---------------------+
+
+        The rules also must be supplied in a specific tabular format with three rows.
+        The top-left cell is empty, and the rest of the first row corresponds to the feature names (such as ``feature1`` or ``feature2``, see above).
+        The rest of the first column corresponds to the two values ``min`` and ``max``.
+        Each of the rows defines the minimum and maximum values for the corresponding features.
+        A labeled image region is retrained if and only if it passes all checks with repsect to the given ``min`` and ``max`` values.
+        An example is given below.
+
+        +-----+--------+--------------+
+        |     | area   | eccentricity |
+        +-----+--------+--------------+
+        | min | 500    | 0.           |
+        +-----+--------+--------------+
+        | max | 100000 | 0.5          |
+        +-----+--------+--------------+
+
     </help>
     <citations>
         <citation type="doi">10.1016/j.jbiotec.2017.07.019</citation>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/creators.xml	Thu Apr 04 15:23:28 2024 +0000
@@ -0,0 +1,23 @@
+<macros>
+
+    <xml name="creators/bmcv">
+        <organization name="Biomedical Computer Vision Group, Heidelberg Universtiy" alternateName="BMCV" url="http://www.bioquant.uni-heidelberg.de/research/groups/biomedical_computer_vision.html" />
+        <yield />
+    </xml>
+
+    <xml name="creators/alliecreason">
+        <person givenName="Allison" familyName="Creason"/>
+        <yield/>
+    </xml>
+
+    <xml name="creators/bugraoezdemir">
+        <person givenName="Bugra" familyName="Oezdemir"/>
+        <yield/>
+    </xml>
+
+    <xml name="creators/thawn">
+        <person givenName="Till" familyName="Korten"/>
+        <yield/>
+    </xml>
+    
+</macros>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests.xml	Thu Apr 04 15:23:28 2024 +0000
@@ -0,0 +1,95 @@
+<macros>
+
+    <!-- Macros for verification of image outputs -->
+
+    <xml
+        name="tests/binary_image_diff"
+        tokens="name,value,ftype,metric,eps"
+        token_metric="mae"
+        token_eps="0.01">
+
+        <output name="@NAME@" value="@VALUE@" ftype="@FTYPE@" compare="image_diff" metric="@METRIC@" eps="@EPS@" pin_labels="0">
+            <assert_contents>
+                <has_image_n_labels n="2"/>
+                <yield/>
+            </assert_contents>
+        </output>
+
+    </xml>
+
+    <xml
+        name="tests/label_image_diff"
+        tokens="name,value,ftype,metric,eps,pin_labels"
+        token_metric="iou"
+        token_eps="0.01"
+        token_pin_labels="0">
+
+        <output name="@NAME@" value="@VALUE@" ftype="@FTYPE@" compare="image_diff" metric="@METRIC@" eps="@EPS@" pin_labels="@PIN_LABELS@">
+            <assert_contents>
+                <yield/>
+            </assert_contents>
+        </output>
+
+    </xml>
+
+    <xml
+        name="tests/intensity_image_diff"
+        tokens="name,value,ftype,metric,eps"
+        token_metric="rms"
+        token_eps="0.01">
+
+        <output name="@NAME@" value="@VALUE@" ftype="@FTYPE@" compare="image_diff" metric="@METRIC@" eps="@EPS@">
+            <assert_contents>
+                <yield/>
+            </assert_contents>
+        </output>
+
+    </xml>
+
+    <!-- Variants of the above for verification of collection elements -->
+
+    <xml
+        name="tests/binary_image_diff/element"
+        tokens="name,value,ftype,metric,eps"
+        token_metric="mae"
+        token_eps="0.01">
+
+        <element name="@NAME@" value="@VALUE@" ftype="@FTYPE@" compare="image_diff" metric="@METRIC@" eps="@EPS@" pin_labels="0">
+            <assert_contents>
+                <has_image_n_labels n="2"/>
+                <yield/>
+            </assert_contents>
+        </element>
+
+    </xml>
+
+    <xml
+        name="tests/label_image_diff/element"
+        tokens="name,value,ftype,metric,eps"
+        token_metric="iou"
+        token_eps="0.01"
+        token_pin_labels="0">
+
+        <element name="@NAME@" value="@VALUE@" ftype="@FTYPE@" compare="image_diff" metric="@METRIC@" eps="@EPS@" pin_labels="@PIN_LABELS@">
+            <assert_contents>
+                <yield/>
+            </assert_contents>
+        </element>
+
+    </xml>
+
+    <xml
+        name="tests/intensity_image_diff/element"
+        tokens="name,value,ftype,metric,eps"
+        token_metric="rms"
+        token_eps="0.01">
+
+        <element name="@NAME@" value="@VALUE@" ftype="@FTYPE@" compare="image_diff" metric="@METRIC@" eps="@EPS@">
+            <assert_contents>
+                <yield/>
+            </assert_contents>
+        </element>
+
+    </xml>
+
+</macros>