comparison concat_channels.xml @ 3:01c1d5af33be draft default tip

planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/concat_channels/ commit a94f04c109c545a9f892a6ce7a5ffef152253201
author imgteam
date Fri, 12 Dec 2025 21:15:44 +0000
parents ad1caf2331c6
children
comparison
equal deleted inserted replaced
2:ad1caf2331c6 3:01c1d5af33be
1 <tool id="ip_concat_channels" name="Concatenate images or channels" version="0.4" profile="20.05"> 1 <tool id="ip_concat_channels" name="Concatenate images or channels" version="0.5" profile="20.05">
2 <description></description> 2 <description></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 </macros> 6 </macros>
7 <creator> 7 <creator>
8 <expand macro="creators/bmcv"/> 8 <expand macro="creators/bmcv"/>
9 <expand macro="creators/kostrykin"/>
9 </creator> 10 </creator>
10 <edam_operations> 11 <edam_operations>
11 <edam_operation>operation_3443</edam_operation> 12 <edam_operation>operation_3443</edam_operation>
12 </edam_operations> 13 </edam_operations>
13 <xrefs> 14 <xrefs>
15 </xrefs> 16 </xrefs>
16 <requirements> 17 <requirements>
17 <requirement type="package" version="0.25.2">scikit-image</requirement> 18 <requirement type="package" version="0.25.2">scikit-image</requirement>
18 <requirement type="package" version="2.3.5">numpy</requirement> 19 <requirement type="package" version="2.3.5">numpy</requirement>
19 <requirement type="package" version="2025.10.16">tifffile</requirement> 20 <requirement type="package" version="2025.10.16">tifffile</requirement>
20 <requirement type="package" version="0.4.1">giatools</requirement> 21 <requirement type="package" version="0.5.2">giatools</requirement>
21 </requirements> 22 </requirements>
22 <command detect_errors="aggressive"><![CDATA[ 23 <command detect_errors="aggressive"><![CDATA[
23 24
24 python '$__tool_directory__/concat_channels.py' 25 python '$__tool_directory__/concat_channels.py'
25 26
29 30
30 '$output' 31 '$output'
31 '$axis' 32 '$axis'
32 33
33 $mode 34 $mode
35
36 #if $sort_by != ""
37 --sort_by '$sort_by'
38 #end if
34 39
35 ]]></command> 40 ]]></command>
36 <inputs> 41 <inputs>
37 <param name="inputs" type="data" multiple="true" format="tiff,png" label="Images to concatenate"/> 42 <param name="inputs" type="data" multiple="true" format="tiff,png" label="Images to concatenate"/>
38 <param name="axis" type="select" label="Concatenation axis" help="The images will be concatenated along this axis."> 43 <param name="axis" type="select" label="Concatenation axis" help="The images will be concatenated along this axis.">
45 </param> 50 </param>
46 <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."> 51 <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.">
47 <option value="" selected="true">Preserve brightness</option> 52 <option value="" selected="true">Preserve brightness</option>
48 <option value="--preserve_values">Preserve range of values</option> 53 <option value="--preserve_values">Preserve range of values</option>
49 </param> 54 </param>
55 <param name="sort_by" type="select" label="Sort images before concatenating">
56 <option value="" selected="true">Do not sort (keep the order of the datasets)</option>
57 <option value="z_position">Sort images by their position along the Z-axis</option>
58 </param>
50 </inputs> 59 </inputs>
51 <outputs> 60 <outputs>
52 <data format="tiff" name="output"/> 61 <data format="tiff" name="output"/>
53 </outputs> 62 </outputs>
54 <tests> 63 <tests>
55 <!-- Test with "preserve brightness", vertical concatenation --> 64 <!-- Test with "preserve brightness", vertical concatenation -->
56 <test> 65 <test>
57 <param name="inputs" value="input1_uint8.png,input2_float.tiff"/> 66 <param name="inputs" value="input1_uint8.png,input2_float.tiff"/>
58 <param name="axis" value="Y"/> 67 <param name="axis" value="Y"/>
59 <param name="mode" value=""/> 68 <param name="mode" value=""/>
69 <param name="sort_by" value=""/>
60 <expand macro="tests/intensity_image_diff" name="output" value="res_preserve_brightness.tiff" ftype="tiff"/> 70 <expand macro="tests/intensity_image_diff" name="output" value="res_preserve_brightness.tiff" ftype="tiff"/>
71 <assert_stdout>
72 <has_line line="Output TIFF shape: (238, 119, 4)"/>
73 <has_line line="Output TIFF axes: YXC"/>
74 <has_line line="Output TIFF resolution: (1.0, 1.0)"/>
75 </assert_stdout>
61 </test> 76 </test>
62 <!-- Test with "preserve range of values", vertical concatenation --> 77 <!-- Test with "preserve range of values", vertical concatenation -->
63 <test> 78 <test>
64 <param name="inputs" value="input1_uint8.png,input2_float.tiff"/> 79 <param name="inputs" value="input1_uint8.png,input2_float.tiff"/>
65 <param name="axis" value="Y"/> 80 <param name="axis" value="Y"/>
66 <param name="mode" value="--preserve_values"/> 81 <param name="mode" value="--preserve_values"/>
82 <param name="sort_by" value=""/>
67 <expand macro="tests/intensity_image_diff" name="output" value="res_preserve_values.tiff" ftype="tiff"> 83 <expand macro="tests/intensity_image_diff" name="output" value="res_preserve_values.tiff" ftype="tiff">
68 <!-- 84 <!--
69 85
70 The input files have values ranging between 0 and 255. 86 The input files have values ranging between 0 and 255.
71 87
75 the image is correct, thus it's good to double-check the range of values. 91 the image is correct, thus it's good to double-check the range of values.
76 92
77 --> 93 -->
78 <has_image_mean_intensity min="0" max="255"/> 94 <has_image_mean_intensity min="0" max="255"/>
79 </expand> 95 </expand>
96 <assert_stdout>
97 <has_line line="Output TIFF shape: (238, 119, 4)"/>
98 <has_line line="Output TIFF axes: YXC"/>
99 <has_line line="Output TIFF resolution: (1.0, 1.0)"/>
100 </assert_stdout>
80 </test> 101 </test>
81 <!-- Test concatenation of channels (axis *exists* in both images) --> 102 <!-- Test concatenation of channels (axis *exists* in both images) -->
82 <test> 103 <test>
83 <param name="inputs" value="input1_uint8.png,input2_float.tiff"/> 104 <param name="inputs" value="input1_uint8.png,input2_float.tiff"/>
84 <param name="axis" value="C"/> 105 <param name="axis" value="C"/>
106 <param name="sort_by" value=""/>
85 <output name="output" ftype="tiff"> 107 <output name="output" ftype="tiff">
86 <assert_contents> 108 <assert_contents>
87 <has_image_width width="119"/> 109 <has_image_width width="119"/>
88 <has_image_height height="119"/> 110 <has_image_height height="119"/>
89 <has_image_depth depth="1"/> 111 <has_image_depth depth="1"/>
90 <has_image_channels channels="8"/> 112 <has_image_channels channels="8"/>
91 <has_image_frames frames="1"/> 113 <has_image_frames frames="1"/>
92 </assert_contents> 114 </assert_contents>
93 </output> 115 </output>
116 <assert_stdout>
117 <has_line line="Output TIFF shape: (119, 119, 8)"/>
118 <has_line line="Output TIFF axes: YXC"/>
119 <has_line line="Output TIFF resolution: (1.0, 1.0)"/>
120 </assert_stdout>
94 </test> 121 </test>
95 <!-- Test concatenation of frames (axis *does not* exist in both images) --> 122 <!-- Test concatenation of frames (axis *does not* exist in both images) -->
96 <test> 123 <test>
97 <param name="inputs" value="input1_uint8.png,input2_float.tiff"/> 124 <param name="inputs" value="input1_uint8.png,input2_float.tiff"/>
98 <param name="axis" value="T"/> 125 <param name="axis" value="T"/>
126 <param name="sort_by" value=""/>
99 <output name="output" ftype="tiff"> 127 <output name="output" ftype="tiff">
100 <assert_contents> 128 <assert_contents>
101 <has_image_width width="119"/> 129 <has_image_width width="119"/>
102 <has_image_height height="119"/> 130 <has_image_height height="119"/>
103 <has_image_depth depth="1"/> 131 <has_image_depth depth="1"/>
104 <has_image_channels channels="4"/> 132 <has_image_channels channels="4"/>
105 <has_image_frames frames="2"/> 133 <has_image_frames frames="2"/>
106 </assert_contents> 134 </assert_contents>
107 </output> 135 </output>
136 <assert_stdout>
137 <has_line line="Output TIFF shape: (2, 119, 119, 4)"/>
138 <has_line line="Output TIFF axes: TYXC"/>
139 <has_line line="Output TIFF resolution: (1.0, 1.0)"/>
140 </assert_stdout>
141 </test>
142 <!-- Test concatenation of z-slices with metadata -->
143 <test>
144 <param name="inputs" value="heart_ct_4043.tiff,heart_ct_3983.tiff,heart_ct_3953.tiff,heart_ct_3923.tiff"/>
145 <param name="axis" value="Z"/>
146 <param name="mode" value="--preserve_values"/>
147 <param name="sort_by" value=""/>
148 <output name="output" ftype="tiff">
149 <assert_contents>
150 <has_image_width width="512"/>
151 <has_image_height height="512"/>
152 <has_image_depth depth="4"/>
153 <has_image_channels channels="1"/>
154 <has_image_frames frames="1"/>
155 <has_image_center_of_mass slice="0" center_of_mass="254.83911700, 251.72483820" eps="1e-8"/><!-- 4043 -->
156 <has_image_center_of_mass slice="1" center_of_mass="254.94356937, 251.88178729" eps="1e-8"/><!-- 3983 -->
157 <has_image_center_of_mass slice="2" center_of_mass="254.95107235, 252.04425222" eps="1e-8"/><!-- 3953 -->
158 <has_image_center_of_mass slice="3" center_of_mass="254.91235475, 252.24777978" eps="1e-8"/><!-- 3923 -->
159 </assert_contents>
160 </output>
161 <assert_stdout>
162 <has_line line="Output TIFF shape: (4, 512, 512)"/>
163 <has_line line="Output TIFF axes: ZYX"/>
164 <has_line line="Output TIFF resolution: (1.137778101526753, 1.137778101526753), unit: mm, z_position: -219.860001, z_spacing: 2.5"/>
165 </assert_stdout>
166 </test>
167 <!-- Test concatenation of z-slices with metadata + sorting by `z_position` (inputs in wrong order) -->
168 <test>
169 <param name="inputs" value="heart_ct_3953.tiff,heart_ct_3983.tiff,heart_ct_4043.tiff,heart_ct_3923.tiff"/>
170 <param name="axis" value="Z"/>
171 <param name="mode" value="--preserve_values"/>
172 <param name="sort_by" value="z_position"/>
173 <output name="output" ftype="tiff">
174 <assert_contents>
175 <has_image_width width="512"/>
176 <has_image_height height="512"/>
177 <has_image_depth depth="4"/>
178 <has_image_channels channels="1"/>
179 <has_image_frames frames="1"/>
180 <has_image_center_of_mass slice="0" center_of_mass="254.83911700, 251.72483820" eps="1e-8"/><!-- 4043 -->
181 <has_image_center_of_mass slice="1" center_of_mass="254.94356937, 251.88178729" eps="1e-8"/><!-- 3983 -->
182 <has_image_center_of_mass slice="2" center_of_mass="254.95107235, 252.04425222" eps="1e-8"/><!-- 3953 -->
183 <has_image_center_of_mass slice="3" center_of_mass="254.91235475, 252.24777978" eps="1e-8"/><!-- 3923 -->
184 </assert_contents>
185 </output>
186 <assert_stdout>
187 <has_line line="Output TIFF shape: (4, 512, 512)"/>
188 <has_line line="Output TIFF axes: ZYX"/>
189 <has_line line="Output TIFF resolution: (1.137778101526753, 1.137778101526753), unit: mm, z_position: -219.860001, z_spacing: 2.5"/>
190 </assert_stdout>
191 </test>
192 <!-- Test concatenation of z-slices with a missing slice in between (`z_position` must increase) -->
193 <test>
194 <param name="inputs" value="heart_ct_4043.tiff,heart_ct_3983.tiff,heart_ct_3923.tiff"/>
195 <param name="axis" value="Z"/>
196 <param name="mode" value="--preserve_values"/>
197 <param name="sort_by" value=""/>
198 <output name="output" ftype="tiff">
199 <assert_contents>
200 <has_image_width width="512"/>
201 <has_image_height height="512"/>
202 <has_image_depth depth="3"/>
203 <has_image_channels channels="1"/>
204 <has_image_frames frames="1"/>
205 <has_image_center_of_mass slice="0" center_of_mass="254.83911700, 251.72483820" eps="1e-8"/><!-- 4043 -->
206 <has_image_center_of_mass slice="1" center_of_mass="254.94356937, 251.88178729" eps="1e-8"/><!-- 3983 -->
207 <has_image_center_of_mass slice="2" center_of_mass="254.91235475, 252.24777978" eps="1e-8"/><!-- 3923 -->
208 </assert_contents>
209 </output>
210 <assert_stdout>
211 <has_line line="Output TIFF shape: (3, 512, 512)"/>
212 <has_line line="Output TIFF axes: ZYX"/>
213 <has_line line="Output TIFF resolution: (1.137778101526753, 1.137778101526753), unit: mm, z_position: -220.27666766666667, z_spacing: 3.75"/>
214 </assert_stdout>
108 </test> 215 </test>
109 </tests> 216 </tests>
110 <help> 217 <help>
111 218
112 **Concatenates images along arbitrary axes.** 219 **Concatenates images along arbitrary axes.**