Mercurial > repos > imgteam > split_image
view split_image.xml @ 2:227e8928af6e draft default tip
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/split_image/ commit 5e452f10eb88f0fa8a420eec66c6c97e3060e433
| author | imgteam |
|---|---|
| date | Fri, 12 Dec 2025 21:02:25 +0000 |
| parents | 4b7940d0c051 |
| children |
line wrap: on
line source
<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.3.5</token> <token name="@VERSION_SUFFIX@">0</token> </macros> <creator> <expand macro="creators/bmcv"/> <expand macro="creators/kostrykin"/> </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="@TOOL_VERSION@">numpy</requirement> <requirement type="package" version="0.5.2">giatools</requirement> <requirement type="package" version="2025.10.16">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> <option value="Q">Q-axis (other or unknown axis)</option> <option value="">Split dataset that contains multiple images (e.g., multi-series TIFF)</option> </param> <param name="squeeze" type="boolean" checked="false" truevalue="--squeeze" falsevalue="" label="Squeeze result images" help="Only non-singleton axes (axes with more than one element) will be retained in the result images. This does not apply for the X and Y axes which always are retained." /> </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> <assert_stdout> <has_line line="Input image axes: YXC"/> <has_line line="Input image shape: (32, 32, 3)"/> <has_line line="Writing 3 image(s)"/> <has_line line="Output axes: YXC"/> <has_line line="Output shape: (32, 32, 1)"/> </assert_stdout> </test> <test> <param name="input" value="rgb1.png" /> <param name="axis" value="" /> <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.tiff" ftype="tiff"/> </output_collection> <assert_stdout> <has_line line="Not a TIFF file"/> <has_line line="Writing 1 image(s)"/> <has_line line="Output axes: YXC"/> <has_line line="Output shape: (32, 32, 3)"/> </assert_stdout> </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> <assert_stdout> <has_line line="Input image axes: ZCYX"/> <has_line line="Input image shape: (25, 2, 50, 50)"/> <has_line line="Writing 25 image(s)"/> <has_line line="Output axes: ZCYX"/> <has_line line="Output shape: (1, 2, 50, 50)"/> </assert_stdout> </test> <test> <param name="input" value="qyx.tiff" /> <param name="axis" value="Q" /> <param name="squeeze" value="false" /> <output_collection name="output" type="list" count="2"> <expand macro="tests/intensity_image_diff/element" name="1.tiff" value="qyx_q1.tiff" ftype="tiff"/> <expand macro="tests/intensity_image_diff/element" name="2.tiff" value="qyx_q2.tiff" ftype="tiff"/> </output_collection> <assert_stdout> <has_line line="Input image axes: QYX"/> <has_line line="Input image shape: (2, 256, 256)"/> <has_line line="Writing 2 image(s)"/> <has_line line="Output axes: QYX"/> <has_line line="Output shape: (1, 256, 256)"/> </assert_stdout> </test> <test> <param name="input" value="qyx.tiff" /> <param name="axis" value="" /> <param name="squeeze" value="false" /> <output_collection name="output" type="list" count="1"> <expand macro="tests/intensity_image_diff/element" name="1.tiff" value="qyx.tiff" ftype="tiff"/> </output_collection> <assert_stdout> <has_line line="Found TIFF with 1 series"/> </assert_stdout> </test> <!-- Test splitting multi-series TIFF --> <test> <param name="input" value="multiseries.ome.tiff" /> <param name="axis" value="" /> <param name="squeeze" value="false" /> <output_collection name="output" type="list" count="6"> <expand macro="tests/intensity_image_diff/element" name="1.tiff" value="multiseries_series1.tiff" ftype="tiff"/> <expand macro="tests/intensity_image_diff/element" name="6.tiff" value="multiseries_series6.tiff" ftype="tiff"/> </output_collection> <assert_stdout> <has_line line="Found TIFF with 6 series"/> <has_line line="Writing 6 image(s)"/> <has_line line="Output 1 axes: CYX"/> <has_line line="Output 1 shape: (4, 5, 5)"/> <has_line line="Output 2 axes: CYX"/> <has_line line="Output 2 shape: (4, 5, 5)"/> <has_line line="Output 3 axes: CYX"/> <has_line line="Output 3 shape: (4, 5, 5)"/> <has_line line="Output 4 axes: CYX"/> <has_line line="Output 4 shape: (4, 5, 5)"/> <has_line line="Output 5 axes: CYX"/> <has_line line="Output 5 shape: (4, 5, 5)"/> <has_line line="Output 6 axes: CYX"/> <has_line line="Output 6 shape: (4, 5, 5)"/> </assert_stdout> </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> <assert_stdout> <has_line line="Input image axes: YXC"/> <has_line line="Input image shape: (32, 32, 3)"/> <has_line line="Writing 3 image(s)"/> <has_line line="Output axes: YX"/> <has_line line="Output shape: (32, 32)"/> </assert_stdout> </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> <assert_stdout> <has_line line="Input image axes: YXC"/> <has_line line="Input image shape: (32, 32, 3)"/> <has_line line="Writing 1 image(s)"/> <has_line line="Output axes: YXC"/> <has_line line="Output shape: (32, 32, 3)"/> </assert_stdout> </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>
