diff concat_channels.xml @ 2:ad1caf2331c6 draft

planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/concat_channels/ commit 4573c7c050968a40f6377a95727694105fbd69c7
author imgteam
date Sun, 07 Dec 2025 16:15:54 +0000
parents 31c8c700d98d
children 01c1d5af33be
line wrap: on
line diff
--- a/concat_channels.xml	Mon Jul 22 04:56:23 2019 -0400
+++ b/concat_channels.xml	Sun Dec 07 16:15:54 2025 +0000
@@ -1,40 +1,121 @@
-<tool id="ip_concat_channels" name="Concatenate images" version="0.2"> 
+<tool id="ip_concat_channels" name="Concatenate images or channels" version="0.4" 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>
+    <xrefs>
+        <xref type="bio.tools">galaxy_image_analysis</xref>
+    </xrefs>
     <requirements>
-        <requirement type="package" version="0.14.2">scikit-image</requirement>
-        <requirement type="package" version="1.15.4">numpy</requirement>
-        <requirement type="package" version="0.15.1">tifffile</requirement>
+        <requirement type="package" version="0.25.2">scikit-image</requirement>
+        <requirement type="package" version="2.3.5">numpy</requirement>
+        <requirement type="package" version="2025.10.16">tifffile</requirement>
+        <requirement type="package" version="0.4.1">giatools</requirement>
     </requirements>
-    <command detect_errors="aggressive">
-    <![CDATA[
-        python '$__tool_directory__/concat_channels.py' 
+    <command detect_errors="aggressive"><![CDATA[
+
+        python '$__tool_directory__/concat_channels.py'
+
         #for $input in $inputs
-            '$input' 
+            '$input'
         #end for
-        -o '$output' --axis '$axis'
-    ]]>
-    </command>
+
+        '$output'
+        '$axis'
+
+        $mode
+
+    ]]></command>
     <inputs>
-        <param name="inputs" type="data" multiple="true" format="tiff,png,jpg,bmp" label="Binary Image Files" help="one or multiple binary image fiels"/>
-        <param name="axis" type="select" label="Concatenation Axis">
-            <option value="0">0</option>
-            <option value="2">2</option>
+        <param name="inputs" type="data" multiple="true" format="tiff,png" label="Images to concatenate"/>
+        <param name="axis" type="select" label="Concatenation axis" help="The images will be concatenated along this axis.">
+            <option value="X">X-axis (concatenate images or image sequences horizontally)</option>
+            <option value="Y">Y-axis (concatenate images or image sequences vertically)</option>
+            <option value="T">T-axis (concatenate images as frames of a temporal image sequence)</option>
+            <option value="Z">Z-axis (concatenate images as slices of a 3-D image or image sequence)</option>
+            <option value="C" selected="true">C-axis (concatenate the channels/samples of images or image sequences)</option>
+            <option value="Q">Q-axis (concatenate along other or unknown axis)</option>
+        </param>
+        <param name="mode" type="select" label="Scaling of values" help="If the brightness is to be preserved (default), then the values will be scaled between 0 and 1, and a floating point pixel data type will be used.">
+            <option value="" selected="true">Preserve brightness</option>
+            <option value="--preserve_values">Preserve range of values</option>
         </param>
     </inputs>
     <outputs>
         <data format="tiff" name="output"/>
     </outputs>
     <tests>
+        <!-- Test with "preserve brightness", vertical concatenation -->
         <test>
-            <param name="inputs" value="sample1.png,sample2.png"/>
-            <param name="axis" value="0"/>
-            <output name="output" value="res.tiff" ftype="tiff" compare="sim_size"/>
+            <param name="inputs" value="input1_uint8.png,input2_float.tiff"/>
+            <param name="axis" value="Y"/>
+            <param name="mode" value=""/>
+            <expand macro="tests/intensity_image_diff" name="output" value="res_preserve_brightness.tiff" ftype="tiff"/>
+        </test>
+        <!-- Test with "preserve range of values", vertical concatenation -->
+        <test>
+            <param name="inputs" value="input1_uint8.png,input2_float.tiff"/>
+            <param name="axis" value="Y"/>
+            <param name="mode" value="--preserve_values"/>
+            <expand macro="tests/intensity_image_diff" name="output" value="res_preserve_values.tiff" ftype="tiff">
+                <!--
+
+                The input files have values ranging between 0 and 255.
+
+                Below, we use an assertion in addition to the `image_diff` comparison, to ensure that the range of
+                values is preserved. The motiviation behind this is that the expectation images are usually checked
+                visually, which means that the `image_diff` comparison is likely to ensure that the brightness of
+                the image is correct, thus it's good to double-check the range of values.
+
+                -->
+                <has_image_mean_intensity min="0" max="255"/>
+            </expand>
+        </test>
+        <!-- Test concatenation of channels (axis *exists* in both images) -->
+        <test>
+            <param name="inputs" value="input1_uint8.png,input2_float.tiff"/>
+            <param name="axis" value="C"/>
+            <output name="output" ftype="tiff">
+                <assert_contents>
+                    <has_image_width width="119"/>
+                    <has_image_height height="119"/>
+                    <has_image_depth depth="1"/>
+                    <has_image_channels channels="8"/>
+                    <has_image_frames frames="1"/>
+                </assert_contents>
+            </output>
+        </test>
+        <!-- Test concatenation of frames (axis *does not* exist in both images) -->
+        <test>
+            <param name="inputs" value="input1_uint8.png,input2_float.tiff"/>
+            <param name="axis" value="T"/>
+            <output name="output" ftype="tiff">
+                <assert_contents>
+                    <has_image_width width="119"/>
+                    <has_image_height height="119"/>
+                    <has_image_depth depth="1"/>
+                    <has_image_channels channels="4"/>
+                    <has_image_frames frames="2"/>
+                </assert_contents>
+            </output>
         </test>
     </tests>
     <help>
-    **What it does**
+
+        **Concatenates images along arbitrary axes.**
 
-    This tool concatenates images.
+        This can be used, for example, to spatially concatenate images, or along their channels.
+
+        This tool either preserves the image brightness, or the range of values.
+        In general, both cannot be preserved when concatenating images of different pixel types (e.g., uint8 and uint16).
+
     </help>
     <citations>
         <citation type="doi">10.1016/j.jbiotec.2017.07.019</citation>