Mercurial > repos > bgruening > imagej2_crop
view 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 |
line wrap: on
line source
<tool id="imagej2_crop" name="Crop image" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="23.0"> <description>with ImageJ2</description> <macros> <import>imagej2_macros.xml</import> </macros> <edam_operations> <edam_operation>operation_3443</edam_operation> </edam_operations> <xrefs> <xref type="bio.tools">imagej</xref> <xref type="biii">imagej2</xref> </xrefs> <expand macro="fiji_requirements"/> <command detect_errors="exit_code"><![CDATA[ #import os #set input_sans_ext = $os.path.splitext($os.path.basename($input.file_name))[0] #set input_with_ext = './' + '.'.join([input_sans_ext, $input.ext]) ln -s '$input.file_name' '$input_with_ext' && #set output_filename = '.'.join(['output', $input.ext]) touch '$output_filename' && ImageJ --ij2 --headless --debug --jython '$__tool_directory__/imagej2_crop_jython_script.py' '$input_with_ext' $xleft $width $ytop $height $first_channel $last_channel $first_slice $last_slice $first_frame $last_frame '$output_filename' '$input.ext' && mv '$output_filename' '$output'; ]]></command> <inputs> <expand macro="param_input"/> <param name="xleft" type="integer" min="0" value="0" label="Left coordinate of the cropped region" /> <param name="width" type="integer" min="0" value="0" label="Final width in pixel (leave 0 to go to the maximum width)" /> <param name="ytop" type="integer" min="0" value="0" label="Top coordinate of the cropped region" /> <param name="height" type="integer" min="0" value="0" label="Final height in pixel (leave 0 to go to the maximum height)" /> <param name="first_channel" type="integer" min="1" value="1" label="First channel to keep." /> <param name="last_channel" type="integer" min="0" value="0" label="Last channel to keep (leave 0 to go to the last channel)." /> <param name="first_slice" type="integer" min="1" value="1" label="First slice to keep." /> <param name="last_slice" type="integer" min="0" value="0" label="Last slice to keep (leave 0 to the last slice)." /> <param name="first_frame" type="integer" min="1" value="1" label="First frame to keep." /> <param name="last_frame" type="integer" min="0" value="0" label="Last frame to keep (leave 0 to the last frame)." /> </inputs> <outputs> <data name="output" format_source="input"/> </outputs> <tests> <test> <param name="input" value="blobs.gif"/> <output name="output" file="blobs.gif" compare="image_diff"> <assert_contents> <has_image_height height="144" /> <has_image_width width="144" /> </assert_contents> </output> </test> <test> <param name="input" value="blobs.gif"/> <param name="width" value="50"/> <output name="output" file="blobs_crop_width50.gif" compare="image_diff"> <assert_contents> <has_image_height height="144" /> <has_image_width width="50" /> </assert_contents> </output> </test> <test> <param name="input" value="blobs.gif"/> <param name="ytop" value="50"/> <output name="output" file="blobs_crop_top50.gif" compare="image_diff"> <assert_contents> <has_image_height height="94" /> <has_image_width width="144" /> </assert_contents> </output> </test> <test> <param name="input" value="confocal-series-both-channels.tiff"/> <param name="xleft" value="17"/> <param name="width" value="16"/> <param name="ytop" value="18"/> <param name="height" value="8"/> <param name="last_channel" value="1"/> <output name="output" file="confocal-series-first-channel_cropped.tiff" compare="sim_size"> <!-- <assert_contents> --> <!-- This gives 16 (the width) <has_image_channels channels="1" /> --> <!-- This gives 25 (the slices) <has_image_height height="8" /> --> <!-- This gives 8 (the height) <has_image_width width="16" /> --> <!-- </assert_contents> --> </output> </test> <test> <param name="input" value="confocal-series-both-channels.tiff"/> <param name="xleft" value="17"/> <param name="width" value="16"/> <param name="ytop" value="18"/> <param name="height" value="8"/> <param name="last_slice" value="1"/> <output name="output" file="confocal-series-both-channels_cropped_singleZ.tiff" compare="sim_size"> <assert_contents> <!-- This gives 16 (the width) <has_image_channels channels="2" /> --> <!-- This gives 2 (the number of channels) <has_image_height height="8" /> --> <!-- This gives 8 (the height) <has_image_width width="16" /> --> </assert_contents> </output> </test> <test> <param name="input" value="confocal-series-both-channels.tiff"/> <param name="xleft" value="17"/> <param name="width" value="16"/> <param name="ytop" value="18"/> <param name="height" value="8"/> <param name="last_channel" value="1"/> <param name="last_slice" value="1"/> <output name="output" file="confocal-series-first-channel_cropped_singleZ.tiff" compare="sim_size"> <assert_contents> <has_image_channels channels="1" /> <has_image_height height="8" /> <has_image_width width="16" /> </assert_contents> </output> </test> </tests> <help> **What it does** <![CDATA[ The tool will crop the images in any possible dimension. - 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. - 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). ]]> </help> <expand macro="fiji_headless_citations"/> </tool>