Mercurial > repos > imgteam > imagej2_noise
diff 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 diff
--- a/imagej2_noise.xml Sun Nov 05 10:57:39 2023 +0000 +++ b/imagej2_noise.xml Wed Sep 25 16:16:10 2024 +0000 @@ -1,13 +1,7 @@ -<tool id="imagej2_noise" name="Add or remove noise" version="@WRAPPER_VERSION@.1"> +<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> - <xml name="insertion_select"> - <param name="insertion" type="select" label="Insertion"> - <option value="additive" selected="True">Additive</option> - <option value="multiplicative">Multiplicative</option> - </param> - </xml> </macros> <edam_operations> <edam_operation>operation_3443</edam_operation> @@ -19,21 +13,13 @@ <expand macro="fiji_requirements"/> <command detect_errors="exit_code"><![CDATA[ #import os -#set error_log = 'output_log.txt' -#if str($noise_cond.noise) == 'randomj': - #set randomj_value = $noise_cond.randomj_cond.randomj -#else: - #set randomj_value = None -#end if #set input_sans_ext = $os.path.splitext($os.path.basename($input.file_name))[0] -#set input_with_ext = '.'.join([input_sans_ext, $input.ext]) +#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' && -touch '$error_log' && ImageJ --ij2 --headless --debug --jython '$__tool_directory__/imagej2_noise_jython_script.py' -'$error_log' '$input_with_ext' '$input.ext' '$noise_cond.noise' @@ -51,54 +37,8 @@ 'None' 'None' #end if -'$randomj_value' -#if $randomj_value == 'randomj_binomial': - $noise_cond.randomj_cond.trials - $noise_cond.randomj_cond.probability -#else: - 'None' - 'None' -#end if -#if $randomj_value == 'randomj_exponential': - $noise_cond.randomj_cond.lammbda -#else: - 'None' -#end if -#if $randomj_value == 'randomj_gamma': - $noise_cond.randomj_cond.order -#else: - 'None' -#end if -#if $randomj_value in['randomj_gaussian', 'randomj_poisson']: - $noise_cond.randomj_cond.mean - #if $randomj_value == 'randomj_gaussian': - $noise_cond.randomj_cond.sigma - #else: - 'None' - #end if -#else: - 'None' - 'None' -#end if -#if $randomj_value == 'randomj_uniform': - $noise_cond.randomj_cond.min - $noise_cond.randomj_cond.max -#else: - 'None' - 'None' -#end if -#if str($randomj_value) != 'None': - '$noise_cond.randomj_cond.insertion' -#else: - 'None' -#end if '$output_filename' -&>'$error_log'; -if [[ $? -ne 0 ]]; then - cat '$error_log' >&2; -else - mv '$output_filename' '$output'; -fi +&& mv '$output_filename' '$output'; ]]></command> <inputs> <expand macro="param_input"/> @@ -111,7 +51,6 @@ <option value="remove_outliers">Remove Outliers</option> <option value="remove_nans">Remove NaNs</option> <option value="rof_denoise">ROF Denoise</option> - <option value="randomj">RandomJ</option> </param> <when value="add_noise"/> <when value="add_specified_noise"> @@ -123,51 +62,12 @@ <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> + <option value="Bright" selected="True">Bright</option> + <option value="Dark">Dark</option> </param> </when> <when value="remove_nans"/> <when value="rof_denoise"/> - <when value="randomj"> - <conditional name="randomj_cond"> - <param name="randomj" type="select" label="RandomJ"> - <option value="randomj_binomial" selected="True">RandomJ Binomial</option> - <option value="randomj_exponential">RandomJ Exponential</option> - <option value="randomj_gamma">RandomJ Gamma</option> - <option value="randomj_gaussian">RandomJ Gaussian</option> - <option value="randomj_poisson">RandomJ Poisson</option> - <option value="randomj_uniform">RandomJ Uniform</option> - </param> - <when value="randomj_binomial"> - <param name="trials" type="float" value="1.0" label="Trials"/> - <param name="probability" type="float" value="0.5" label="Probability"/> - <expand macro="insertion_select"/> - </when> - <when value="randomj_exponential"> - <param name="lammbda" type="float" value="0.5" label="Lambda"/> - <expand macro="insertion_select"/> - </when> - <when value="randomj_gamma"> - <param name="order" type="integer" value="1" label="Order"/> - <expand macro="insertion_select"/> - </when> - <when value="randomj_gaussian"> - <param name="mean" type="float" value="0.0" label="Mean"/> - <param name="sigma" type="float" value="1.0" label="Sigma"/> - <expand macro="insertion_select"/> - </when> - <when value="randomj_poisson"> - <param name="mean" type="float" value="1.0" label="Mean"/> - <expand macro="insertion_select"/> - </when> - <when value="randomj_uniform"> - <param name="min" type="float" value="0.0" label="Min"/> - <param name="max" type="float" value="1.0" label="Max"/> - <expand macro="insertion_select"/> - </when> - </conditional> - </when> </conditional> </inputs> <outputs> @@ -177,17 +77,26 @@ <test> <param name="input" value="blobs.gif"/> <param name="noise" value="add_specified_noise"/> - <output name="output" file="add_specified_noise.gif"/> + <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"/> + <output name="output" file="despeckle.gif" compare="image_diff"/> </test> <test> <param name="input" value="blobs.gif"/> <param name="noise" value="remove_outliers"/> - <output name="output" file="remove_outliers.gif"/> + <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> @@ -202,12 +111,6 @@ - **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. -- **RandonJ Binomial** - Contaminates image with random numbers generated using a binomial random variable -- **RandonJ Exponential** - Contaminates image with random numbers generated using an exponential random variable. -- **RandonJ Gamma** - Contaminates image with random numbers generated using a gamma random variable. -- **RandonJ Gaussian** - Contaminates image with random numbers generated using a Gaussian random variable. -- **RandonJ Poisson** - Contaminates image with random numbers generated using a Poisson random variable. -- **RandonJ Uniform** - Contaminates image with random numbers generated using a uniform random variable. ]]> </help> <expand macro="fiji_headless_citations"/>