Mercurial > repos > imgteam > split_image
comparison split_image.xml @ 3:d45a07063da1 draft default tip
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/split_image/ commit df96ae15da34285b0a9d435a48924665fff37d6a
| author | imgteam |
|---|---|
| date | Sat, 04 Apr 2026 21:22:07 +0000 |
| parents | 227e8928af6e |
| children |
comparison
equal
deleted
inserted
replaced
| 2:227e8928af6e | 3:d45a07063da1 |
|---|---|
| 2 <description>with NumPy</description> | 2 <description>with NumPy</description> |
| 3 <macros> | 3 <macros> |
| 4 <import>creators.xml</import> | 4 <import>creators.xml</import> |
| 5 <import>tests.xml</import> | 5 <import>tests.xml</import> |
| 6 <token name="@TOOL_VERSION@">2.3.5</token> | 6 <token name="@TOOL_VERSION@">2.3.5</token> |
| 7 <token name="@VERSION_SUFFIX@">0</token> | 7 <token name="@VERSION_SUFFIX@">1</token> |
| 8 </macros> | 8 </macros> |
| 9 <creator> | 9 <creator> |
| 10 <expand macro="creators/bmcv"/> | 10 <expand macro="creators/bmcv"/> |
| 11 <expand macro="creators/kostrykin"/> | 11 <expand macro="creators/kostrykin"/> |
| 12 </creator> | 12 </creator> |
| 16 <xrefs> | 16 <xrefs> |
| 17 <xref type="bio.tools">galaxy_image_analysis</xref> | 17 <xref type="bio.tools">galaxy_image_analysis</xref> |
| 18 </xrefs> | 18 </xrefs> |
| 19 <requirements> | 19 <requirements> |
| 20 <requirement type="package" version="@TOOL_VERSION@">numpy</requirement> | 20 <requirement type="package" version="@TOOL_VERSION@">numpy</requirement> |
| 21 <requirement type="package" version="0.5.2">giatools</requirement> | 21 <requirement type="package" version="0.7.3">giatools</requirement> |
| 22 <requirement type="package" version="2025.10.16">tifffile</requirement> | |
| 23 </requirements> | 22 </requirements> |
| 23 <required_files> | |
| 24 <include type="glob" path="*.py"/> | |
| 25 </required_files> | |
| 24 <command detect_errors="aggressive"><![CDATA[ | 26 <command detect_errors="aggressive"><![CDATA[ |
| 25 | 27 |
| 26 mkdir output && | 28 mkdir output && |
| 27 python '$__tool_directory__/split.py' | 29 python '$__tool_directory__/split.py' |
| 28 | 30 |
| 29 '$input' | 31 '$input' |
| 30 '$axis' | 32 '$axis' |
| 31 output | 33 output |
| 32 | 34 |
| 35 $offset | |
| 36 $step | |
| 33 $squeeze | 37 $squeeze |
| 38 | |
| 39 #if str($count) != "" | |
| 40 --count $count | |
| 41 #end if | |
| 34 | 42 |
| 35 ]]></command> | 43 ]]></command> |
| 36 <inputs> | 44 <inputs> |
| 37 <param name="input" type="data" format="tiff,png" label="Image to split" /> | 45 <param name="input" type="data" format="tiff,png" label="Image to split"/> |
| 38 <param name="axis" type="select" label="Axis to split along"> | 46 <param name="axis" type="select" label="Axis to split along"> |
| 39 <option value="T">T-axis (split the frames of a temporal image sequence)</option> | 47 <option value="T">T-axis (split the frames of a temporal image sequence)</option> |
| 40 <option value="Z">Z-axis (split the slices of a 3-D image or image sequence)</option> | 48 <option value="Z">Z-axis (split the slices of a 3-D image or image sequence)</option> |
| 41 <option value="C" selected="true">C-axis (split the channels of an image or image sequence)</option> | 49 <option value="C" selected="true">C-axis (split the channels of an image or image sequence)</option> |
| 42 <option value="S">S-axis (split the samples of an image or image sequence)</option> | 50 <option value="S">S-axis (split the samples of an image or image sequence)</option> |
| 43 <option value="Q">Q-axis (other or unknown axis)</option> | 51 <option value="Q">Q-axis (other or unknown axis)</option> |
| 44 <option value="">Split dataset that contains multiple images (e.g., multi-series TIFF)</option> | 52 <option value="">Split dataset that contains multiple images (e.g., multi-series TIFF)</option> |
| 45 </param> | 53 </param> |
| 46 <param name="squeeze" type="boolean" checked="false" truevalue="--squeeze" falsevalue="" label="Squeeze result images" | 54 <param name="squeeze" type="boolean" checked="false" truevalue="--squeeze" falsevalue="" label="Squeeze result images" |
| 47 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." /> | 55 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."/> |
| 56 <param name="offset" type="integer" value="0" min="0" label="Offset" | |
| 57 help="Number of slices to skip at the beginning."/> | |
| 58 <param name="step" type="integer" value="1" min="1" label="Step" | |
| 59 help="Number of slices between extracted images (each slice is extracted for a value of 1, each second slice is extracted for a value of two, and so on)."/> | |
| 60 <param name="count" type="integer" optional="true" min="1" label="Count" | |
| 61 help="Maximum number of slices to extract."/> | |
| 48 </inputs> | 62 </inputs> |
| 49 <outputs> | 63 <outputs> |
| 50 <collection type="list" name="output" label="Split ${on_string} along ${axis} axis"> | 64 <collection type="list" name="output" label="Split ${on_string} along ${axis} axis"> |
| 51 <discover_datasets directory="output" pattern="__name__" format="tiff" /> | 65 <discover_datasets directory="output" pattern="__name__" format="tiff"/> |
| 52 </collection> | 66 </collection> |
| 53 </outputs> | 67 </outputs> |
| 54 <tests> | 68 <tests> |
| 55 | 69 |
| 56 <!-- PNG tests --> | 70 <!-- PNG tests --> |
| 64 <expand macro="tests/intensity_image_diff/element" name="3.tiff" value="rgb1_b.tiff" ftype="tiff"/> | 78 <expand macro="tests/intensity_image_diff/element" name="3.tiff" value="rgb1_b.tiff" ftype="tiff"/> |
| 65 </output_collection> | 79 </output_collection> |
| 66 <assert_stdout> | 80 <assert_stdout> |
| 67 <has_line line="Input image axes: YXC"/> | 81 <has_line line="Input image axes: YXC"/> |
| 68 <has_line line="Input image shape: (32, 32, 3)"/> | 82 <has_line line="Input image shape: (32, 32, 3)"/> |
| 69 <has_line line="Writing 3 image(s)"/> | 83 <has_line line="Writing 3 out of 3 image(s)"/> |
| 70 <has_line line="Output axes: YXC"/> | 84 <has_line line="Output axes: YXC"/> |
| 71 <has_line line="Output shape: (32, 32, 1)"/> | 85 <has_line line="Output shape: (32, 32, 1)"/> |
| 72 </assert_stdout> | 86 </assert_stdout> |
| 73 </test> | 87 </test> |
| 74 <test> | 88 <test> |
| 77 <param name="squeeze" value="false" /> | 91 <param name="squeeze" value="false" /> |
| 78 <output_collection name="output" type="list" count="1"> | 92 <output_collection name="output" type="list" count="1"> |
| 79 <expand macro="tests/intensity_image_diff/element" name="1.tiff" value="rgb1.tiff" ftype="tiff"/> | 93 <expand macro="tests/intensity_image_diff/element" name="1.tiff" value="rgb1.tiff" ftype="tiff"/> |
| 80 </output_collection> | 94 </output_collection> |
| 81 <assert_stdout> | 95 <assert_stdout> |
| 82 <has_line line="Not a TIFF file"/> | 96 <has_line line="Found 1 image(s) in file"/> |
| 83 <has_line line="Writing 1 image(s)"/> | 97 <has_line line="Writing 1 out of 1 image(s)"/> |
| 84 <has_line line="Output axes: YXC"/> | 98 <has_line line="Output axes: YXC"/> |
| 85 <has_line line="Output shape: (32, 32, 3)"/> | 99 <has_line line="Output shape: (32, 32, 3)"/> |
| 86 </assert_stdout> | 100 </assert_stdout> |
| 87 </test> | 101 </test> |
| 88 | 102 |
| 89 <!-- TIFF tests --> | 103 <!-- TIFF tests --> |
| 90 <test> | 104 <test> |
| 91 <param name="input" value="zcyx.tiff" /> | 105 <param name="input" value="zcyx.tiff"/> |
| 92 <param name="axis" value="Z" /> | 106 <param name="axis" value="Z"/> |
| 93 <param name="squeeze" value="false" /> | 107 <param name="squeeze" value="false"/> |
| 94 <output_collection name="output" type="list" count="25"> | 108 <param name="offset" value="9"/> |
| 95 <expand macro="tests/intensity_image_diff/element" name="01.tiff" value="zcyx_slice01.tiff" ftype="tiff"/> | 109 <param name="step" value="2"/> |
| 96 <expand macro="tests/intensity_image_diff/element" name="25.tiff" value="zcyx_slice25.tiff" ftype="tiff"/> | 110 <param name="count" value="5"/> |
| 111 <output_collection name="output" type="list" count="5"> | |
| 112 <expand macro="tests/intensity_image_diff/element" name="10.tiff" value="zcyx_slice10.tiff" ftype="tiff"/> | |
| 113 <expand macro="tests/intensity_image_diff/element" name="18.tiff" value="zcyx_slice18.tiff" ftype="tiff"/> | |
| 97 </output_collection> | 114 </output_collection> |
| 98 <assert_stdout> | 115 <assert_stdout> |
| 99 <has_line line="Input image axes: ZCYX"/> | 116 <has_line line="Input image axes: ZCYX"/> |
| 100 <has_line line="Input image shape: (25, 2, 50, 50)"/> | 117 <has_line line="Input image shape: (25, 2, 50, 50)"/> |
| 101 <has_line line="Writing 25 image(s)"/> | 118 <has_line line="Writing 5 out of 25 image(s)"/> |
| 102 <has_line line="Output axes: ZCYX"/> | 119 <has_line line="Output axes: ZCYX"/> |
| 103 <has_line line="Output shape: (1, 2, 50, 50)"/> | 120 <has_line line="Output shape: (1, 2, 50, 50)"/> |
| 104 </assert_stdout> | 121 </assert_stdout> |
| 105 </test> | 122 </test> |
| 106 <test> | 123 <test> |
| 112 <expand macro="tests/intensity_image_diff/element" name="2.tiff" value="qyx_q2.tiff" ftype="tiff"/> | 129 <expand macro="tests/intensity_image_diff/element" name="2.tiff" value="qyx_q2.tiff" ftype="tiff"/> |
| 113 </output_collection> | 130 </output_collection> |
| 114 <assert_stdout> | 131 <assert_stdout> |
| 115 <has_line line="Input image axes: QYX"/> | 132 <has_line line="Input image axes: QYX"/> |
| 116 <has_line line="Input image shape: (2, 256, 256)"/> | 133 <has_line line="Input image shape: (2, 256, 256)"/> |
| 117 <has_line line="Writing 2 image(s)"/> | 134 <has_line line="Writing 2 out of 2 image(s)"/> |
| 118 <has_line line="Output axes: QYX"/> | 135 <has_line line="Output axes: QYX"/> |
| 119 <has_line line="Output shape: (1, 256, 256)"/> | 136 <has_line line="Output shape: (1, 256, 256)"/> |
| 120 </assert_stdout> | 137 </assert_stdout> |
| 121 </test> | 138 </test> |
| 122 <test> | 139 <test> |
| 125 <param name="squeeze" value="false" /> | 142 <param name="squeeze" value="false" /> |
| 126 <output_collection name="output" type="list" count="1"> | 143 <output_collection name="output" type="list" count="1"> |
| 127 <expand macro="tests/intensity_image_diff/element" name="1.tiff" value="qyx.tiff" ftype="tiff"/> | 144 <expand macro="tests/intensity_image_diff/element" name="1.tiff" value="qyx.tiff" ftype="tiff"/> |
| 128 </output_collection> | 145 </output_collection> |
| 129 <assert_stdout> | 146 <assert_stdout> |
| 130 <has_line line="Found TIFF with 1 series"/> | 147 <has_line line="Found 1 image(s) in file"/> |
| 131 </assert_stdout> | 148 </assert_stdout> |
| 132 </test> | 149 </test> |
| 133 | 150 |
| 134 <!-- Test splitting multi-series TIFF --> | 151 <!-- Test splitting multi-series TIFF --> |
| 135 <test> | 152 <test> |
| 139 <output_collection name="output" type="list" count="6"> | 156 <output_collection name="output" type="list" count="6"> |
| 140 <expand macro="tests/intensity_image_diff/element" name="1.tiff" value="multiseries_series1.tiff" ftype="tiff"/> | 157 <expand macro="tests/intensity_image_diff/element" name="1.tiff" value="multiseries_series1.tiff" ftype="tiff"/> |
| 141 <expand macro="tests/intensity_image_diff/element" name="6.tiff" value="multiseries_series6.tiff" ftype="tiff"/> | 158 <expand macro="tests/intensity_image_diff/element" name="6.tiff" value="multiseries_series6.tiff" ftype="tiff"/> |
| 142 </output_collection> | 159 </output_collection> |
| 143 <assert_stdout> | 160 <assert_stdout> |
| 144 <has_line line="Found TIFF with 6 series"/> | 161 <has_line line="Found 6 image(s) in file"/> |
| 145 <has_line line="Writing 6 image(s)"/> | 162 <has_line line="Writing 6 out of 6 image(s)"/> |
| 146 <has_line line="Output 1 axes: CYX"/> | 163 <has_line line="Output 1 axes: CYX"/> |
| 147 <has_line line="Output 1 shape: (4, 5, 5)"/> | 164 <has_line line="Output 1 shape: (4, 5, 5)"/> |
| 148 <has_line line="Output 2 axes: CYX"/> | 165 <has_line line="Output 2 axes: CYX"/> |
| 149 <has_line line="Output 2 shape: (4, 5, 5)"/> | 166 <has_line line="Output 2 shape: (4, 5, 5)"/> |
| 150 <has_line line="Output 3 axes: CYX"/> | 167 <has_line line="Output 3 axes: CYX"/> |
| 169 <expand macro="tests/intensity_image_diff/element" name="3.tiff" value="rgb1_squeezed_b.tiff" ftype="tiff"/> | 186 <expand macro="tests/intensity_image_diff/element" name="3.tiff" value="rgb1_squeezed_b.tiff" ftype="tiff"/> |
| 170 </output_collection> | 187 </output_collection> |
| 171 <assert_stdout> | 188 <assert_stdout> |
| 172 <has_line line="Input image axes: YXC"/> | 189 <has_line line="Input image axes: YXC"/> |
| 173 <has_line line="Input image shape: (32, 32, 3)"/> | 190 <has_line line="Input image shape: (32, 32, 3)"/> |
| 174 <has_line line="Writing 3 image(s)"/> | 191 <has_line line="Writing 3 out of 3 image(s)"/> |
| 175 <has_line line="Output axes: YX"/> | 192 <has_line line="Output axes: YX"/> |
| 176 <has_line line="Output shape: (32, 32)"/> | 193 <has_line line="Output shape: (32, 32)"/> |
| 177 </assert_stdout> | 194 </assert_stdout> |
| 178 </test> | 195 </test> |
| 179 | 196 |
| 186 <expand macro="tests/intensity_image_diff/element" name="1.tiff" value="rgb1_split_z.tiff" ftype="tiff"/> | 203 <expand macro="tests/intensity_image_diff/element" name="1.tiff" value="rgb1_split_z.tiff" ftype="tiff"/> |
| 187 </output_collection> | 204 </output_collection> |
| 188 <assert_stdout> | 205 <assert_stdout> |
| 189 <has_line line="Input image axes: YXC"/> | 206 <has_line line="Input image axes: YXC"/> |
| 190 <has_line line="Input image shape: (32, 32, 3)"/> | 207 <has_line line="Input image shape: (32, 32, 3)"/> |
| 191 <has_line line="Writing 1 image(s)"/> | 208 <has_line line="Writing 1 out of 1 image(s)"/> |
| 192 <has_line line="Output axes: YXC"/> | 209 <has_line line="Output axes: YXC"/> |
| 193 <has_line line="Output shape: (32, 32, 3)"/> | 210 <has_line line="Output shape: (32, 32, 3)"/> |
| 194 </assert_stdout> | 211 </assert_stdout> |
| 195 </test> | 212 </test> |
| 196 | 213 |
