Mercurial > repos > imgteam > imagej2_noise
view imagej2_noise.xml @ 3:73cc4e6a741d draft default tip
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit 8f49f3c66b5a1de99ec15e65c2519a56792f1d56
author | imgteam |
---|---|
date | Wed, 25 Sep 2024 16:16:10 +0000 |
parents | 756e062741dc |
children |
line wrap: on
line source
<tool id="imagej2_noise" name="Add or remove noise" 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_noise_jython_script.py' '$input_with_ext' '$input.ext' '$noise_cond.noise' #if $noise_cond.noise == 'add_specified_noise': $noise_cond.standard_deviation #else: 'None' #end if #if $noise_cond.noise == 'remove_outliers': $noise_cond.radius $noise_cond.threshold '$noise_cond.which_outliers' #else: 'None' 'None' 'None' #end if '$output_filename' && mv '$output_filename' '$output'; ]]></command> <inputs> <expand macro="param_input"/> <conditional name="noise_cond"> <param name="noise" type="select" label="Noise"> <option value="add_noise" selected="True">Add Random Noise</option> <option value="add_specified_noise">Add Specified Noise</option> <option value="salt_and_pepper">Salt and Pepper</option> <option value="despeckle">Despeckle</option> <option value="remove_outliers">Remove Outliers</option> <option value="remove_nans">Remove NaNs</option> <option value="rof_denoise">ROF Denoise</option> </param> <when value="add_noise"/> <when value="add_specified_noise"> <param name="standard_deviation" type="float" value="25.0" label="Standard deviation" help="Floating point number"/> </when> <when value="salt_and_pepper"/> <when value="despeckle"/> <when value="remove_outliers"> <param name="radius" type="float" value="2.0" label="Radius" help="pixels"/> <param name="threshold" type="float" value="50.0" label="Threshold"/> <param name="which_outliers" type="select" label="Which Outliers"> <option value="Bright" selected="True">Bright</option> <option value="Dark">Dark</option> </param> </when> <when value="remove_nans"/> <when value="rof_denoise"/> </conditional> </inputs> <outputs> <data name="output" format_source="input"/> </outputs> <tests> <test> <param name="input" value="blobs.gif"/> <param name="noise" value="add_specified_noise"/> <param name="standard_deviation" value="5" /> <!-- Cannot use image_diff as the noise is random --> <output name="output" file="add_specified_noise.gif" compare="sim_size"/> </test> <test> <param name="input" value="blobs.gif"/> <param name="noise" value="despeckle"/> <output name="output" file="despeckle.gif" compare="image_diff"/> </test> <test> <param name="input" value="blobs.gif"/> <param name="noise" value="remove_outliers"/> <param name="radius" value="10.0"/> <param name="threshold" value="1"/> <param name="which_outliers" value="Bright"/> <output name="output" file="remove_outliers.gif" compare="image_diff"/> </test> <test expect_failure="true"> <param name="input" value="blobs.gif"/> <param name="noise" value="remove_nans"/> </test> </tests> <help> **What it does** <![CDATA[ Adds noise to or removes noise from images. - **Add Random Noise** - Adds random noise to the image. The noise is Gaussian (normally) distributed with a mean of zero and standard deviation of 25. - **Add Specified Noise** - Adds Gaussian noise with a mean of zero and a chosen standard deviation. - **Salt and Pepper** - Adds salt and pepper noise to the image by randomly replacing 2.5% of the pixels with black pixels and 2.5% with white pixels. This command only works with 8-bit images. - **Despeckle** - Replaces each pixel with the median value in its 3 × 3 neighborhood. This is a time consuming operation because for each pixel, the nine pixels in the 3 × 3 neighborhood must be sorted and the center pixel replaced with the median value (the fifth). - **Remove Outliers** - Replaces a pixel by the median of the pixels in the surrounding if it deviates from the median by more than a certain value (the threshold). - **Remove NaNs** - Replaces NaN (Not-a-Number) pixels in 32-bit images by the median of the neighbors inside the circular kernel area defined by Radius. It does not remove patches of NaNs larger than the kernel size, however. ]]> </help> <expand macro="fiji_headless_citations"/> </tool>