diff split_image.xml @ 0:6b42bec75e69 draft

planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/split_image/ commit f1052360d410594fa1795cf0e02576b8fa4d4135
author imgteam
date Fri, 07 Mar 2025 08:08:05 +0000
parents
children 73d7a4ffc03d
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/split_image.xml	Fri Mar 07 08:08:05 2025 +0000
@@ -0,0 +1,108 @@
+<tool id="ip_split_image" name="Split image along axes" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="20.05">
+    <description>with NumPy</description>
+    <macros>
+        <import>creators.xml</import>
+        <import>tests.xml</import>
+        <token name="@TOOL_VERSION@">2.2.3</token>
+        <token name="@VERSION_SUFFIX@">0</token>
+    </macros>
+    <creator>
+        <expand macro="creators/bmcv"/>
+    </creator>
+    <edam_operations>
+        <edam_operation>operation_3443</edam_operation>
+    </edam_operations>
+    <requirements>
+        <requirement type="package" version="@TOOL_VERSION@">numpy</requirement>
+        <requirement type="package" version="0.3.2">giatools</requirement>
+        <requirement type="package" version="2024.7.24">tifffile</requirement>
+    </requirements>
+    <command detect_errors="aggressive"><![CDATA[
+
+        mkdir output &&
+        python '$__tool_directory__/split.py'
+
+        '$input'
+        '$axis'
+        output
+
+        $squeeze
+
+    ]]></command>
+    <inputs>
+        <param name="input" type="data" format="tiff,png" label="Image to split" />
+        <param name="axis" type="select" label="Axis to split along">
+            <option value="T">T-axis (split the frames of a temporal image sequence)</option>
+            <option value="Z">Z-axis (split the slices of a 3-D image or image sequence)</option>
+            <option value="C" selected="true">C-axis (split the channels of an image or image sequence)</option>
+            <option value="S">S-axis (split the samples of an image or image sequence)</option>
+        </param>
+        <param name="squeeze" type="boolean" checked="false" truevalue="--squeeze" falsevalue="" label="Squeeze result imags" help="Only axes with more than one element will be retained in the result images. Does not apply for X and Y axes." />
+    </inputs>
+    <outputs>
+        <collection type="list" name="output" label="Split ${on_string} along ${axis} axis">
+            <discover_datasets directory="output" pattern="__name__" format="tiff" />
+        </collection>
+    </outputs>
+    <tests>
+
+        <!-- PNG tests -->
+        <test>
+            <param name="input" value="rgb1.png" />
+            <param name="axis" value="C" />
+            <param name="squeeze" value="false" />
+            <output_collection name="output" type="list" count="3">
+                <expand macro="tests/intensity_image_diff/element" name="1.tiff" value="rgb1_r.tiff" ftype="tiff"/>
+                <expand macro="tests/intensity_image_diff/element" name="2.tiff" value="rgb1_g.tiff" ftype="tiff"/>
+                <expand macro="tests/intensity_image_diff/element" name="3.tiff" value="rgb1_b.tiff" ftype="tiff"/>
+            </output_collection>
+        </test>
+
+        <!-- TIFF tests -->
+        <test>
+            <param name="input" value="zcyx.tiff" />
+            <param name="axis" value="Z" />
+            <param name="squeeze" value="false" />
+            <output_collection name="output" type="list" count="25">
+                <expand macro="tests/intensity_image_diff/element" name="01.tiff" value="zcyx_slice01.tiff" ftype="tiff"/>
+                <expand macro="tests/intensity_image_diff/element" name="25.tiff" value="zcyx_slice25.tiff" ftype="tiff"/>
+            </output_collection>
+        </test>
+
+        <!-- Test squeezing -->
+        <test>
+            <param name="input" value="rgb1.png" />
+            <param name="axis" value="C" />
+            <param name="squeeze" value="true" />
+            <output_collection name="output" type="list" count="3">
+                <expand macro="tests/intensity_image_diff/element" name="1.tiff" value="rgb1_squeezed_r.tiff" ftype="tiff"/>
+                <expand macro="tests/intensity_image_diff/element" name="2.tiff" value="rgb1_squeezed_g.tiff" ftype="tiff"/>
+                <expand macro="tests/intensity_image_diff/element" name="3.tiff" value="rgb1_squeezed_b.tiff" ftype="tiff"/>
+            </output_collection>
+        </test>
+
+        <!-- Test with missing axes -->
+        <test>
+            <param name="input" value="rgb1.png" />
+            <param name="axis" value="Z" />
+            <param name="squeeze" value="false" />
+            <output_collection name="output" type="list" count="1">
+                <expand macro="tests/intensity_image_diff/element" name="1.tiff" value="rgb1_split_z.tiff" ftype="tiff"/>
+            </output_collection>
+        </test>
+
+    </tests>
+    <help>
+
+        **Splits an image along a specific axis (e.g., channels).**
+
+        This tool splits an image along a specifc axis and yields a collection of images.
+        This can be used, for example, to convert a multi-channel image into a collection of single-channel images.
+
+        The pixel data type of the split image is preserved (will be the same as the input image).
+
+    </help>
+    <citations>
+        <citation type="doi">10.1038/s41586-020-2649-2</citation>
+    </citations>
+</tool>