changeset 1:ad795d260ba8 draft

planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/morphological_operations commit c045f067a57e8308308cf6329060c7ccd3fc372f
author imgteam
date Thu, 04 Apr 2024 15:25:44 +0000
parents f10112b317a1
children 4e25befab102
files creators.xml morphological_operations.xml tests.xml
diffstat 3 files changed, 138 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/creators.xml	Thu Apr 04 15:25:44 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>
--- a/morphological_operations.xml	Fri Mar 08 11:00:41 2024 +0000
+++ b/morphological_operations.xml	Thu Apr 04 15:25:44 2024 +0000
@@ -1,9 +1,14 @@
 <tool id="morphological_operations" name="Apply a morphological operation" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="23.0">
     <description>with SciPy</description>
     <macros>
+        <import>creators.xml</import>
+        <import>tests.xml</import>
         <token name="@TOOL_VERSION@">1.12.0</token>
         <token name="@VERSION_SUFFIX@">0</token>
     </macros>
+    <creator>
+        <expand macro="creators/bmcv"/>
+    </creator>
     <edam_operations>
         <edam_operation>operation_3443</edam_operation>
     </edam_operations>
@@ -11,7 +16,7 @@
         <xref type="biii">scipy</xref>
     </xrefs>
     <requirements>
-        <requirement type="package" version="1.12.0">scipy</requirement>
+        <requirement type="package" version="@TOOL_VERSION@">scipy</requirement>
         <requirement type="package" version="0.22.0">scikit-image</requirement>
     </requirements>
     <command><![CDATA[
@@ -54,28 +59,28 @@
             <param name="operation" value="erosion" />
             <param name="selem_shape" value="disk" />
             <param name="selem_size" value="1" />
-            <output name="result" value="output1_erosion.tiff" ftype="tiff" compare="sim_size" delta="10" />
+            <expand macro="tests/binary_image_diff" name="result" value="output1_erosion.tiff" ftype="tiff"/>
         </test>
         <test>
             <param name="image" value="input1.tiff" />
             <param name="operation" value="dilation" />
             <param name="selem_shape" value="disk" />
             <param name="selem_size" value="2" />
-            <output name="result" value="output1_dilation.tiff" ftype="tiff" compare="sim_size" delta="10" />
+            <expand macro="tests/binary_image_diff" name="result" value="output1_dilation.tiff" ftype="tiff"/>
         </test>
         <test>
             <param name="image" value="input1.tiff" />
             <param name="operation" value="opening" />
             <param name="selem_shape" value="square" />
             <param name="selem_size" value="1" />
-            <output name="result" value="output1_opening.tiff" ftype="tiff" compare="sim_size" delta="10" />
+            <expand macro="tests/binary_image_diff" name="result" value="output1_opening.tiff" ftype="tiff"/>
         </test>
         <test>
             <param name="image" value="input1.tiff" />
             <param name="operation" value="closing" />
             <param name="selem_shape" value="square" />
             <param name="selem_size" value="2" />
-            <output name="result" value="output1_closing.tiff" ftype="tiff" compare="sim_size" delta="10" />
+            <expand macro="tests/binary_image_diff" name="result" value="output1_closing.tiff" ftype="tiff"/>
         </test>
         <!-- Test intensity-based operations (more than two distinct values) -->
         <test>
@@ -83,28 +88,28 @@
             <param name="operation" value="erosion" />
             <param name="selem_shape" value="disk" />
             <param name="selem_size" value="1" />
-            <output name="result" value="output3_erosion.tiff" ftype="tiff" compare="sim_size" delta="10" />
+            <expand macro="tests/intensity_image_diff" name="result" value="output3_erosion.tiff" ftype="tiff"/>
         </test>
         <test>
             <param name="image" value="input3.png" />
             <param name="operation" value="dilation" />
             <param name="selem_shape" value="disk" />
             <param name="selem_size" value="2" />
-            <output name="result" value="output3_dilation.tiff" ftype="tiff" compare="sim_size" delta="10" />
+            <expand macro="tests/intensity_image_diff" name="result" value="output3_dilation.tiff" ftype="tiff"/>
         </test>
         <test>
             <param name="image" value="input3.png" />
             <param name="operation" value="opening" />
             <param name="selem_shape" value="square" />
             <param name="selem_size" value="1" />
-            <output name="result" value="output3_opening.tiff" ftype="tiff" compare="sim_size" delta="10" />
+            <expand macro="tests/intensity_image_diff" name="result" value="output3_opening.tiff" ftype="tiff"/>
         </test>
         <test>
             <param name="image" value="input3.png" />
             <param name="operation" value="closing" />
             <param name="selem_shape" value="square" />
             <param name="selem_size" value="2" />
-            <output name="result" value="output3_closing.tiff" ftype="tiff" compare="sim_size" delta="10" />
+            <expand macro="tests/intensity_image_diff" name="result" value="output3_closing.tiff" ftype="tiff"/>
         </test>
         <!-- Test multi-channel image (with two distinct values per channel) -->
         <test>
@@ -112,11 +117,13 @@
             <param name="operation" value="fill_holes" />
             <param name="selem_shape" value="disk" />
             <param name="selem_size" value="1" />
-            <output name="result" value="output2_fill_holes.tiff" ftype="tiff" compare="sim_size" delta="10" />
+            <expand macro="tests/intensity_image_diff" name="result" value="output2_fill_holes.tiff" ftype="tiff"/>
         </test>
     </tests>
     <help>
-        Applies a morphological operation to a 2-D image.
+
+        **Applies a morphological operation to a 2-D image.**
+
         For multi-channel images, the operation is applied to each channel separately.
 
         The following operations are supported:
@@ -126,8 +133,9 @@
         - **Opening:** Erosion followed by Dilation. Erases tiny bright spots.
         - **Closing:** Dilation followed by Erosion. Erases tiny dark holes.
         - **Fill holes:** Fills the holes (dark areas) in binary images.
+
     </help>
     <citations>
         <citation type="doi">10.1038/s41592-019-0686-2</citation>
     </citations>
-</tool>
\ No newline at end of file
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests.xml	Thu Apr 04 15:25:44 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>