comparison imagej2_crop.xml @ 0:018144807556 draft default tip

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit 8f49f3c66b5a1de99ec15e65c2519a56792f1d56
author bgruening
date Tue, 24 Sep 2024 17:12:52 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:018144807556
1 <tool id="imagej2_crop" name="Crop image" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="23.0">
2 <description>with ImageJ2</description>
3 <macros>
4 <import>imagej2_macros.xml</import>
5 </macros>
6 <edam_operations>
7 <edam_operation>operation_3443</edam_operation>
8 </edam_operations>
9 <xrefs>
10 <xref type="bio.tools">imagej</xref>
11 <xref type="biii">imagej2</xref>
12 </xrefs>
13 <expand macro="fiji_requirements"/>
14 <command detect_errors="exit_code"><![CDATA[
15 #import os
16 #set input_sans_ext = $os.path.splitext($os.path.basename($input.file_name))[0]
17 #set input_with_ext = './' + '.'.join([input_sans_ext, $input.ext])
18 ln -s '$input.file_name' '$input_with_ext' &&
19 #set output_filename = '.'.join(['output', $input.ext])
20 touch '$output_filename' &&
21 ImageJ --ij2 --headless --debug
22 --jython '$__tool_directory__/imagej2_crop_jython_script.py'
23 '$input_with_ext'
24 $xleft
25 $width
26 $ytop
27 $height
28 $first_channel
29 $last_channel
30 $first_slice
31 $last_slice
32 $first_frame
33 $last_frame
34 '$output_filename'
35 '$input.ext'
36 && mv '$output_filename' '$output';
37 ]]></command>
38 <inputs>
39 <expand macro="param_input"/>
40 <param name="xleft" type="integer" min="0" value="0" label="Left coordinate of the cropped region" />
41 <param name="width" type="integer" min="0" value="0" label="Final width in pixel (leave 0 to go to the maximum width)" />
42 <param name="ytop" type="integer" min="0" value="0" label="Top coordinate of the cropped region" />
43 <param name="height" type="integer" min="0" value="0" label="Final height in pixel (leave 0 to go to the maximum height)" />
44 <param name="first_channel" type="integer" min="1" value="1" label="First channel to keep." />
45 <param name="last_channel" type="integer" min="0" value="0" label="Last channel to keep (leave 0 to go to the last channel)." />
46 <param name="first_slice" type="integer" min="1" value="1" label="First slice to keep." />
47 <param name="last_slice" type="integer" min="0" value="0" label="Last slice to keep (leave 0 to the last slice)." />
48 <param name="first_frame" type="integer" min="1" value="1" label="First frame to keep." />
49 <param name="last_frame" type="integer" min="0" value="0" label="Last frame to keep (leave 0 to the last frame)." />
50 </inputs>
51 <outputs>
52 <data name="output" format_source="input"/>
53 </outputs>
54 <tests>
55 <test>
56 <param name="input" value="blobs.gif"/>
57 <output name="output" file="blobs.gif" compare="image_diff">
58 <assert_contents>
59 <has_image_height height="144" />
60 <has_image_width width="144" />
61 </assert_contents>
62 </output>
63 </test>
64 <test>
65 <param name="input" value="blobs.gif"/>
66 <param name="width" value="50"/>
67 <output name="output" file="blobs_crop_width50.gif" compare="image_diff">
68 <assert_contents>
69 <has_image_height height="144" />
70 <has_image_width width="50" />
71 </assert_contents>
72 </output>
73 </test>
74 <test>
75 <param name="input" value="blobs.gif"/>
76 <param name="ytop" value="50"/>
77 <output name="output" file="blobs_crop_top50.gif" compare="image_diff">
78 <assert_contents>
79 <has_image_height height="94" />
80 <has_image_width width="144" />
81 </assert_contents>
82 </output>
83 </test>
84 <test>
85 <param name="input" value="confocal-series-both-channels.tiff"/>
86 <param name="xleft" value="17"/>
87 <param name="width" value="16"/>
88 <param name="ytop" value="18"/>
89 <param name="height" value="8"/>
90 <param name="last_channel" value="1"/>
91 <output name="output" file="confocal-series-first-channel_cropped.tiff" compare="sim_size">
92 <!-- <assert_contents> -->
93 <!-- This gives 16 (the width)
94 <has_image_channels channels="1" /> -->
95 <!-- This gives 25 (the slices)
96 <has_image_height height="8" /> -->
97 <!-- This gives 8 (the height)
98 <has_image_width width="16" /> -->
99 <!-- </assert_contents> -->
100 </output>
101 </test>
102 <test>
103 <param name="input" value="confocal-series-both-channels.tiff"/>
104 <param name="xleft" value="17"/>
105 <param name="width" value="16"/>
106 <param name="ytop" value="18"/>
107 <param name="height" value="8"/>
108 <param name="last_slice" value="1"/>
109 <output name="output" file="confocal-series-both-channels_cropped_singleZ.tiff" compare="sim_size">
110 <assert_contents>
111 <!-- This gives 16 (the width)
112 <has_image_channels channels="2" /> -->
113 <!-- This gives 2 (the number of channels)
114 <has_image_height height="8" /> -->
115 <!-- This gives 8 (the height)
116 <has_image_width width="16" /> -->
117 </assert_contents>
118 </output>
119 </test>
120 <test>
121 <param name="input" value="confocal-series-both-channels.tiff"/>
122 <param name="xleft" value="17"/>
123 <param name="width" value="16"/>
124 <param name="ytop" value="18"/>
125 <param name="height" value="8"/>
126 <param name="last_channel" value="1"/>
127 <param name="last_slice" value="1"/>
128 <output name="output" file="confocal-series-first-channel_cropped_singleZ.tiff" compare="sim_size">
129 <assert_contents>
130 <has_image_channels channels="1" />
131 <has_image_height height="8" />
132 <has_image_width width="16" />
133 </assert_contents>
134 </output>
135 </test>
136 </tests>
137 <help>
138
139 **What it does**
140
141 <![CDATA[
142 The tool will crop the images in any possible dimension.
143
144 - To crop on the width and height, you need to specify the coordinate of the top left corner of the rectangle to keep and if you want to restrict the bottom right, you need to give the width and height.
145
146 - To crop on the CZT (channel, slice, frame), you need to specify the first CZT to keep (the first one is 1) and the last CZT to keep (or leave 0 to go to the maximum).
147 ]]>
148
149 </help>
150 <expand macro="fiji_headless_citations"/>
151 </tool>