comparison crop_image.xml @ 1:457514bb6750 draft default tip

planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/crop_image/ commit 52a95105291e38f3410e347ed3b60d6acd6d5daa
author imgteam
date Fri, 09 Jan 2026 14:54:49 +0000
parents f8bfa85cac4c
children
comparison
equal deleted inserted replaced
0:f8bfa85cac4c 1:457514bb6750
1 <tool id="ip_crop_image" name="Crop image" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="20.05"> 1 <tool id="ip_crop_image" name="Crop image" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="20.05">
2 <description>with giatools</description> 2 <description>with giatools</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@">0.4.1</token> 6 <token name="@TOOL_VERSION@">0.7.3</token>
7 <token name="@VERSION_SUFFIX@">0</token> 7 <token name="@VERSION_SUFFIX@">0</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 </creator> 12 </creator>
12 <edam_operations> 13 <edam_operations>
13 <edam_operation>operation_3443</edam_operation> 14 <edam_operation>operation_3443</edam_operation>
14 </edam_operations> 15 </edam_operations>
15 <xrefs> 16 <xrefs>
17 <xref type="bio.tools">galaxy_image_analysis</xref>
16 <xref type="bio.tools">giatools</xref> 18 <xref type="bio.tools">giatools</xref>
17 </xrefs> 19 </xrefs>
18 <requirements> 20 <requirements>
19 <requirement type="package" version="@TOOL_VERSION@">giatools</requirement> 21 <requirement type="package" version="@TOOL_VERSION@">giatools</requirement>
20 </requirements> 22 </requirements>
21 <command detect_errors="aggressive"><![CDATA[ 23 <command detect_errors="aggressive"><![CDATA[
22 24
23 mkdir ./output && 25 mkdir ./output &&
24 python '$__tool_directory__/crop_image.py' 26 python '$__tool_directory__/crop_image.py'
25 27
26 '$image' 28 #if $image.extension == "zarr"
27 '$labelmap' 29 '$image.extra_files_path/$image.metadata.store_root'
30 #else
31 '$image'
32 #end if
33
34 #if $labelmap.extension == "zarr"
35 '$labelmap.extra_files_path/$labelmap.metadata.store_root'
36 #else
37 '$labelmap'
38 #end if
39
28 '$skip_labels' 40 '$skip_labels'
29 '${image.ext}' 41
42 #if str($image.ext).lower() == 'png'
43 'png'
44 #else
45 'tiff'
46 #end if
30 47
31 ./output 48 ./output
32 49
33 ]]></command> 50 ]]></command>
34 <inputs> 51 <inputs>
35 <param name="image" type="data" format="png,tiff" label="Image file" help="The image to be cropped."/> 52 <param name="image" type="data" format="png,tiff,zarr" label="Image file"
36 <param name="labelmap" type="data" format="png,tiff" label="Label map" help="Each label identifies an individual region of interest, for which a cropped image is produced."/> 53 help="The image to be cropped."/>
54 <param name="labelmap" type="data" format="png,tiff,zarr" label="Label map"
55 help="Each label identifies an individual region of interest, for which a cropped image is produced."/>
37 <param name="skip_labels" type="text" label="Skip labels" value="0" optional="true" help="Comma-separated list of labels for which no cropped image shall be produced."> 56 <param name="skip_labels" type="text" label="Skip labels" value="0" optional="true" help="Comma-separated list of labels for which no cropped image shall be produced.">
38 <validator type="regex">^\d+(,\d+)*$|^$</validator> 57 <validator type="regex">^\d+(,\d+)*$|^$</validator>
39 </param> 58 </param>
40 </inputs> 59 </inputs>
41 <outputs> 60 <outputs>
44 </collection> 63 </collection>
45 </outputs> 64 </outputs>
46 <tests> 65 <tests>
47 <!-- Test 2D TIFF --> 66 <!-- Test 2D TIFF -->
48 <test> 67 <test>
49 <param name="image" value="yx_float32.tiff" ftype="tiff"/> 68 <param name="image" value="yx_float32.tiff"/>
50 <param name="labelmap" value="yx_uint8.tiff"/> 69 <param name="labelmap" value="yx_uint8.tiff"/>
51 <output_collection name="output" type="list" count="2"> 70 <output_collection name="output" type="list" count="2">
52 <expand macro="tests/intensity_image_diff/element" name="1" value="yx_float32_uint8_1.tiff" ftype="tiff"/> 71 <expand macro="tests/intensity_image_diff/element" name="1" value="yx_float32_uint8_1.tiff" ftype="tiff"/>
53 <expand macro="tests/intensity_image_diff/element" name="2" value="yx_float32_uint8_2.tiff" ftype="tiff"/> 72 <expand macro="tests/intensity_image_diff/element" name="2" value="yx_float32_uint8_2.tiff" ftype="tiff"/>
54 </output_collection> 73 </output_collection>
55 </test> 74 </test>
56 <!-- Test with `skip_labels` --> 75 <!-- Test with `skip_labels` -->
57 <test> 76 <test>
58 <param name="image" value="yx_float32.tiff" ftype="tiff"/> 77 <param name="image" value="yx_float32.tiff"/>
59 <param name="labelmap" value="yx_uint8.tiff"/> 78 <param name="labelmap" value="yx_uint8.tiff"/>
60 <param name="skip_labels" value="0,1"/> 79 <param name="skip_labels" value="0,1"/>
61 <output_collection name="output" type="list" count="1"> 80 <output_collection name="output" type="list" count="1">
62 <expand macro="tests/intensity_image_diff/element" name="2" value="yx_float32_uint8_2.tiff" ftype="tiff"/> 81 <expand macro="tests/intensity_image_diff/element" name="2" value="yx_float32_uint8_2.tiff" ftype="tiff"/>
63 </output_collection> 82 </output_collection>
64 </test> 83 </test>
65 <!-- Test with empty `skip_labels` --> 84 <!-- Test with empty `skip_labels` -->
66 <test> 85 <test>
67 <param name="image" value="yx_float32.tiff" ftype="tiff"/> 86 <param name="image" value="yx_float32.tiff"/>
68 <param name="labelmap" value="yx_uint8.tiff"/> 87 <param name="labelmap" value="yx_uint8.tiff"/>
69 <param name="skip_labels" value=""/> 88 <param name="skip_labels" value=""/>
70 <output_collection name="output" type="list" count="3"> 89 <output_collection name="output" type="list" count="3">
71 <expand macro="tests/intensity_image_diff/element" name="0" value="yx_float32_uint8_0.tiff" ftype="tiff"/> 90 <expand macro="tests/intensity_image_diff/element" name="0" value="yx_float32_uint8_0.tiff" ftype="tiff"/>
72 <expand macro="tests/intensity_image_diff/element" name="1" value="yx_float32_uint8_1.tiff" ftype="tiff"/> 91 <expand macro="tests/intensity_image_diff/element" name="1" value="yx_float32_uint8_1.tiff" ftype="tiff"/>
73 <expand macro="tests/intensity_image_diff/element" name="2" value="yx_float32_uint8_2.tiff" ftype="tiff"/> 92 <expand macro="tests/intensity_image_diff/element" name="2" value="yx_float32_uint8_2.tiff" ftype="tiff"/>
74 </output_collection> 93 </output_collection>
75 </test> 94 </test>
76 <!-- Test 3D TIFF (multi-frame) --> 95 <!-- Test 3D TIFF (multi-frame) -->
77 <test> 96 <test>
78 <param name="image" value="zyx_uint16.tiff" ftype="tiff"/> 97 <param name="image" value="zyx_uint16.tiff"/>
79 <param name="labelmap" value="yxz_uint8.tiff"/> 98 <param name="labelmap" value="yxz_uint8.tiff"/>
80 <output_collection name="output" type="list" count="1"> 99 <output_collection name="output" type="list" count="1">
81 <expand macro="tests/intensity_image_diff/element" name="1" value="zyx_uint16_uint8_1.tiff" ftype="tiff"/> 100 <expand macro="tests/intensity_image_diff/element" name="1" value="zyx_uint16_uint8_1.tiff" ftype="tiff">
101 <has_image_width width="5"/>
102 <has_image_height height="3"/>
103 <has_image_depth depth="6"/>
104 </expand>
82 </output_collection> 105 </output_collection>
83 </test> 106 </test>
84 <!-- Test PNG --> 107 <!-- Test PNG (multi-channel) -->
85 <test> 108 <test>
86 <param name="image" value="yxc_uint8.png" ftype="png"/> 109 <param name="image" value="yxc_uint8.png"/>
87 <param name="labelmap" value="yxc_uint8_mask.png"/> 110 <param name="labelmap" value="yxc_uint8_mask.png"/>
88 <output_collection name="output" type="list" count="1"> 111 <output_collection name="output" type="list" count="1">
89 <expand macro="tests/intensity_image_diff/element" name="2" value="yxc_uint8_uint8_2.png" ftype="png"/> 112 <expand macro="tests/intensity_image_diff/element" name="2" value="yxc_uint8_uint8_2.png" ftype="png">
113 <has_image_width width="10"/>
114 <has_image_height height="12"/>
115 <has_image_channels channels="3"/>
116 </expand>
117 </output_collection>
118 </test>
119 <!-- Test PNG+Zarr (multi-channel `image` PNG with single-channel `labelmap` Zarr) -->
120 <test>
121 <param name="image" value="yxc_uint8.png"/>
122 <param name="labelmap" value="yx_uint8_mask.zarr"/>
123 <output_collection name="output" type="list" count="1">
124 <expand macro="tests/intensity_image_diff/element" name="2" value="yxc_uint8_uint8_2.png" ftype="png">
125 <has_image_width width="10"/>
126 <has_image_height height="12"/>
127 <has_image_channels channels="3"/>
128 </expand>
129 </output_collection>
130 </test>
131 <!-- Test Zarr+TIFF (multi-channel `image` Zarr with single-channel `labelmap` TIFF) -->
132 <test>
133 <param name="image" value="cyx_uint8.zarr"/>
134 <param name="labelmap" value="yx_uint8_mask.tiff"/>
135 <output_collection name="output" type="list" count="1">
136 <!--
137 OME-Zarr requires a specific axes order. For this reason, it is not possible to generally write "any" image as an OME-Zarr.
138 This would require adapting the axes order, which is do-able, but changes the image. This might be unintended or unexpected
139 in many cases, which is why it is not happening automatically. We might change this behaviour somehow in the future.
140 -->
141 <expand macro="tests/intensity_image_diff/element" name="2" value="cyx_uint8_uint8.tiff" ftype="tiff">
142 <has_image_width width="10"/>
143 <has_image_height height="12"/>
144 <has_image_channels channels="3"/>
145 </expand>
90 </output_collection> 146 </output_collection>
91 </test> 147 </test>
92 </tests> 148 </tests>
93 <help> 149 <help>
94 150
95 **Crops an image using one or more regions of interest.** 151 **Crops an image using one or more regions of interest.**
96 152
97 The image is cropped using a label map that identifies individual regions of interest. The image and the label map must be of equal size. 153 The image is cropped using a label map that identifies individual regions of interest. The image and the label map must be of
154 compatible size. The sizes are compatible if they are equal, or, if the label map can be broadcasted to the size of the image
155 (e.g., if the image is a multi-channel image and the label map is single-channel but has identical width and height).
98 156
99 This operation preserves the file type of the image, the brightness, and the range of values. 157 This operation preserves the brightness and the range of values of the input image. The file format is also preserved, unless
158 the input image is a Zarr, for which the output image file format is TIFF.
100 159
101 </help> 160 </help>
102 <citations> 161 <citations>
103 <citation type="doi">10.1016/j.jbiotec.2017.07.019</citation> 162 <citation type="doi">10.1016/j.jbiotec.2017.07.019</citation>
104 </citations> 163 </citations>