diff imagej2_noise.xml @ 0:3f6599ec7d30 draft

"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
author imgteam
date Tue, 17 Sep 2019 16:58:28 -0400
parents
children 7a44772cc89f
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imagej2_noise.xml	Tue Sep 17 16:58:28 2019 -0400
@@ -0,0 +1,167 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<tool id="imagej2_noise" name="Add or remove noise" version="@WRAPPER_VERSION@.0">
+    <description></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>
+    <expand macro="fiji_requirements" />
+    <command>
+<![CDATA[
+    python $__tool_directory__/imagej2_noise.py
+    --input "$input"
+    --input_datatype $input.ext
+    --noise $noise_cond.noise
+    #if $noise_cond.noise == 'add_specified_noise':
+        --standard_deviation $noise_cond.standard_deviation
+    #else if $noise_cond.noise == 'remove_outliers':
+        --radius $noise_cond.radius
+        --threshold $noise_cond.threshold
+        --which_outliers $noise_cond.which_outliers
+    #else if $noise_cond.noise == 'randomj':
+        --randomj $noise_cond.randomj_cond.randomj
+        #if $noise_cond.randomj_cond.randomj == 'randomj_binomial':
+            --trials $noise_cond.randomj_cond.trials
+            --probability $noise_cond.randomj_cond.probability
+        #else if $noise_cond.randomj_cond.randomj == 'randomj_exponential':
+            --lammbda $noise_cond.randomj_cond.lammbda
+        #else if $noise_cond.randomj_cond.randomj == 'randomj_gamma':
+            --order $noise_cond.randomj_cond.order
+        #else if $noise_cond.randomj_cond.randomj == 'randomj_gaussian':
+            --mean $noise_cond.randomj_cond.mean
+            --sigma $noise_cond.randomj_cond.sigma
+         #else if $noise_cond.randomj_cond.randomj == 'randomj_poisson':
+            --mean $noise_cond.randomj_cond.mean
+         #else if $noise_cond.randomj_cond.randomj == 'randomj_uniform':
+            --min $noise_cond.randomj_cond.min
+            --max $noise_cond.randomj_cond.max
+        #end if
+        --insertion $noise_cond.randomj_cond.insertion
+    #end if
+    --jython_script $__tool_directory__/imagej2_noise_jython_script.py
+    --output "$output"
+]]>
+    </command>
+    <inputs>
+        <param format="bmp,eps,gif,jpg,pcx,pgm,png,psd,tiff" name="input" type="data" label="Select image"/>
+        <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>
+                <option value="randomj">RandomJ</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" />
+            <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>
+        <data name="output" format_source="input" label="${tool.name} on ${on_string}: ${noise_cond.noise.replace( '_', ' ' )}" />
+    </outputs>
+    <tests>
+        <test>
+            <param name="input" value="blobs.gif" />
+            <param name="input_datatype" value="gif" />
+            <param name="noise" value="add_specified_noise" />
+            <output name="output" file="add_specified_noise.gif" />
+        </test>
+        <test>
+            <param name="input" value="blobs.gif" />
+            <param name="input_datatype" value="gif" />
+            <param name="noise" value="despeckle" />
+            <output name="output" file="despeckle.gif" />
+        </test>
+        <test>
+            <param name="input" value="blobs.gif" />
+            <param name="input_datatype" value="gif" />
+            <param name="noise" value="remove_outliers" />
+            <param name="radius" value="2.0" />
+            <param name="threshold" value="50.0" />
+            <param name="which_outliers" value="bright" />
+            <output name="output" file="remove_outliers.gif" />
+        </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.
+- **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" />
+</tool>