changeset 5:002f7bad3e82 draft

planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/overlay_images/ commit c045f067a57e8308308cf6329060c7ccd3fc372f
author imgteam
date Thu, 04 Apr 2024 15:25:58 +0000
parents 37662cbf44b8
children 2495f8b2aefd
files creators.xml overlay_images.xml test-data/sample1_uint8_rgb.png test-data/test4.png test-data/test5.png tests.xml
diffstat 6 files changed, 152 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/creators.xml	Thu Apr 04 15:25:58 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/overlay_images.xml	Fri Nov 17 23:34:57 2023 +0000
+++ b/overlay_images.xml	Thu Apr 04 15:25:58 2024 +0000
@@ -1,9 +1,15 @@
 <tool id="ip_overlay_images" name="Overlay images" 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.0.4</token>
-        <token name="@VERSION_SUFFIX@">0</token>
+        <token name="@VERSION_SUFFIX@">1</token>
     </macros>
+    <creator>
+        <expand macro="creators/bmcv"/>
+        <expand macro="creators/thawn"/>
+    </creator>
     <edam_operations>
         <edam_operation>operation_3443</edam_operation>
     </edam_operations>
@@ -38,10 +44,10 @@
     </command>
     <inputs>
         <conditional name="method_option">
-            <param name="method" type="select" label="How to visualize the overlay?">
+            <param name="method" type="select" label="Type of the overlay">
                 <option value="coloc_vis" selected="True">Colocalization</option>
-                <option value="blending">Blending</option>
-                <option value="seg_contour">Segmentation mask over image</option>
+                <option value="blending">Linear blending</option>
+                <option value="seg_contour">Segmentation contours over image</option>
             </param>
             <when value="coloc_vis">
                 <param name="im1" type="data" format="tiff,png" label="Image #1 (red channel)" />
@@ -53,7 +59,7 @@
                 <param name="alpha" type="float" value="0.5" min="0.0" max="1.0" label="The weight for blending: I_out = (1 - w) * I_1 + w * I_2."/>
             </when>
             <when value="seg_contour">
-                <param name="im1" type="data" format="tiff,png" label="Image" />
+                <param name="im1" type="data" format="tiff,png" label="Intensity image" />
                 <param name="im2" type="data" format="tiff,png" label="Label image" />
                 <param name="thickness" type="integer" value="2" min="1" label="Contour thickness (in pixels)" />
                 <param name="color" type="color" value="#ff0000" label="Contour color"/>
@@ -75,14 +81,14 @@
             <param name="im1" value="mask1.tif"/>
             <param name="im2" value="mask1r.tif"/>
             <param name="method" value="coloc_vis"/>
-            <output name="out_tiff" value="test1.tif" ftype="tiff" compare="sim_size" delta_frac="0.1"/>
+            <expand macro="tests/intensity_image_diff" name="out_tiff" value="test1.tif" ftype="tiff"/>
         </test>
         <test expect_num_outputs="1">
             <param name="im1" value="mask1.tif"/>
             <param name="im2" value="mask1r.tif"/>
             <param name="method" value="blending"/>
             <param name="alpha" value="0.3"/>
-            <output name="out_tiff" value="test2.tif" ftype="tiff" compare="sim_size" delta_frac="0.1"/>
+            <expand macro="tests/intensity_image_diff" name="out_tiff" value="test2.tif" ftype="tiff"/>
         </test>
         <test expect_num_outputs="1">
             <param name="im1" value="sample1_uint8.tif"/>
@@ -91,15 +97,15 @@
             <param name="thickness" value="2"/>
             <param name="color" value="#ff0000"/>
             <param name="show_label" value="--show_label"/>
-            <output name="out_png" value="test3.png" ftype="png" compare="sim_size" delta_frac="0.1"/>
+            <expand macro="tests/intensity_image_diff" name="out_png" value="test3.png" ftype="png"/>
         </test>
-        <test expect_num_outputs="1"><!-- segemtation overlay, 8bit test -->
+        <test expect_num_outputs="1"><!-- segmentation overlay, 8bit test -->
             <param name="im1" value="sample1_uint8.tif"/>
             <param name="im2" value="mask2.tif"/>
             <param name="method" value="seg_contour"/>
             <param name="thickness" value="2"/>
             <param name="color" value="#ff0000"/>
-            <output name="out_png" value="test4.png" ftype="png" compare="sim_size" delta_frac="0.1"/>
+            <expand macro="tests/intensity_image_diff" name="out_png" value="test4.png" ftype="png"/>
         </test>
         <test expect_num_outputs="1"><!-- segmentation overlay, 16bit test -->
             <param name="im1" value="sample1_uint16.tif"/>
@@ -107,14 +113,26 @@
             <param name="method" value="seg_contour"/>
             <param name="thickness" value="2"/>
             <param name="color" value="#ff0000"/>
-            <output name="out_png" value="test4.png" ftype="png" compare="sim_size" delta_frac="0.1"/>
+            <expand macro="tests/intensity_image_diff" name="out_png" value="test4.png" ftype="png" eps="1"/>
+        </test>
+        <test expect_num_outputs="1"><!-- segmentation overlay, 8bit RGB test -->
+            <param name="im1" value="sample1_uint8_rgb.png"/>
+            <param name="im2" value="mask2.tif"/>
+            <param name="method" value="seg_contour"/>
+            <param name="thickness" value="2"/>
+            <param name="color" value="#ff0000"/>
+            <expand macro="tests/intensity_image_diff" name="out_png" value="test5.png" ftype="png"/>
         </test>
     </tests>
-    <help>
-    <![CDATA[
-        This tool overlays two image to visualize 1) image blending, 2) colocalization, or 3) a segmentation mask over an image.
-    ]]>
-    </help>
+    <help><![CDATA[
+
+        **Overlays two images for visualization.**
+
+        This tool overlays two image to visualize *linear image blending*, *colocalization*, or *segmentation contours*
+        over an intensity image. For *image blending* and *colocalization*, the input images must be single-channel 2-D
+        images. For *segmentation contours*, the intensity must be a 2-D single-channel or 2-D RGB image.
+
+    ]]></help>
     <citations>
         <citation type="doi">10.1016/j.jbiotec.2017.07.019</citation>
     </citations>
Binary file test-data/sample1_uint8_rgb.png has changed
Binary file test-data/test4.png has changed
Binary file test-data/test5.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests.xml	Thu Apr 04 15:25:58 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>