comparison imagej2_noise.xml @ 1:7a44772cc89f draft

"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit 2afb24f3c81d625312186750a714d702363012b5"
author imgteam
date Mon, 28 Sep 2020 16:45:49 +0000
parents 3f6599ec7d30
children 756e062741dc
comparison
equal deleted inserted replaced
0:3f6599ec7d30 1:7a44772cc89f
1 <?xml version='1.0' encoding='UTF-8'?>
2 <tool id="imagej2_noise" name="Add or remove noise" version="@WRAPPER_VERSION@.0"> 1 <tool id="imagej2_noise" name="Add or remove noise" version="@WRAPPER_VERSION@.0">
3 <description></description> 2 <description></description>
4 <macros> 3 <macros>
5 <import>imagej2_macros.xml</import> 4 <import>imagej2_macros.xml</import>
6 <xml name="insertion_select"> 5 <xml name="insertion_select">
8 <option value="additive" selected="True">Additive</option> 7 <option value="additive" selected="True">Additive</option>
9 <option value="multiplicative">Multiplicative</option> 8 <option value="multiplicative">Multiplicative</option>
10 </param> 9 </param>
11 </xml> 10 </xml>
12 </macros> 11 </macros>
13 <expand macro="fiji_requirements" /> 12 <expand macro="fiji_requirements"/>
14 <command> 13 <command detect_errors="exit_code"><![CDATA[
15 <![CDATA[ 14 #import os
16 python $__tool_directory__/imagej2_noise.py 15 #set error_log = 'output_log.txt'
17 --input "$input" 16 #if str($noise_cond.noise) == 'randomj':
18 --input_datatype $input.ext 17 #set randomj_value = $noise_cond.randomj_cond.randomj
19 --noise $noise_cond.noise 18 #else:
20 #if $noise_cond.noise == 'add_specified_noise': 19 #set randomj_value = None
21 --standard_deviation $noise_cond.standard_deviation 20 #end if
22 #else if $noise_cond.noise == 'remove_outliers': 21 #set input_sans_ext = $os.path.splitext($os.path.basename($input.file_name))[0]
23 --radius $noise_cond.radius 22 #set input_with_ext = '.'.join([input_sans_ext, $input.ext])
24 --threshold $noise_cond.threshold 23 ln -s '$input.file_name' '$input_with_ext' &&
25 --which_outliers $noise_cond.which_outliers 24 #set output_filename = '.'.join(['output', $input.ext])
26 #else if $noise_cond.noise == 'randomj': 25 touch '$output_filename' &&
27 --randomj $noise_cond.randomj_cond.randomj 26 touch '$error_log' &&
28 #if $noise_cond.randomj_cond.randomj == 'randomj_binomial': 27 ImageJ --ij2 --headless --debug
29 --trials $noise_cond.randomj_cond.trials 28 --jython '$__tool_directory__/imagej2_noise_jython_script.py'
30 --probability $noise_cond.randomj_cond.probability 29 '$error_log'
31 #else if $noise_cond.randomj_cond.randomj == 'randomj_exponential': 30 '$input_with_ext'
32 --lammbda $noise_cond.randomj_cond.lammbda 31 '$input.ext'
33 #else if $noise_cond.randomj_cond.randomj == 'randomj_gamma': 32 '$noise_cond.noise'
34 --order $noise_cond.randomj_cond.order 33 #if $noise_cond.noise == 'add_specified_noise':
35 #else if $noise_cond.randomj_cond.randomj == 'randomj_gaussian': 34 $noise_cond.standard_deviation
36 --mean $noise_cond.randomj_cond.mean 35 #else:
37 --sigma $noise_cond.randomj_cond.sigma 36 'None'
38 #else if $noise_cond.randomj_cond.randomj == 'randomj_poisson': 37 #end if
39 --mean $noise_cond.randomj_cond.mean 38 #if $noise_cond.noise == 'remove_outliers':
40 #else if $noise_cond.randomj_cond.randomj == 'randomj_uniform': 39 $noise_cond.radius
41 --min $noise_cond.randomj_cond.min 40 $noise_cond.threshold
42 --max $noise_cond.randomj_cond.max 41 '$noise_cond.which_outliers'
43 #end if 42 #else:
44 --insertion $noise_cond.randomj_cond.insertion 43 'None'
44 'None'
45 'None'
46 #end if
47 '$randomj_value'
48 #if $randomj_value == 'randomj_binomial':
49 $noise_cond.randomj_cond.trials
50 $noise_cond.randomj_cond.probability
51 #else:
52 'None'
53 'None'
54 #end if
55 #if $randomj_value == 'randomj_exponential':
56 $noise_cond.randomj_cond.lammbda
57 #else:
58 'None'
59 #end if
60 #if $randomj_value == 'randomj_gamma':
61 $noise_cond.randomj_cond.order
62 #else:
63 'None'
64 #end if
65 #if $randomj_value in['randomj_gaussian', 'randomj_poisson']:
66 $noise_cond.randomj_cond.mean
67 #if $randomj_value == 'randomj_gaussian':
68 $noise_cond.randomj_cond.sigma
69 #else:
70 'None'
45 #end if 71 #end if
46 --jython_script $__tool_directory__/imagej2_noise_jython_script.py 72 #else:
47 --output "$output" 73 'None'
48 ]]> 74 'None'
49 </command> 75 #end if
76 #if $randomj_value == 'randomj_uniform':
77 $noise_cond.randomj_cond.min
78 $noise_cond.randomj_cond.max
79 #else:
80 'None'
81 'None'
82 #end if
83 #if str($randomj_value) != 'None':
84 '$noise_cond.randomj_cond.insertion'
85 #else:
86 'None'
87 #end if
88 '$output_filename'
89 &>'$error_log';
90 if [[ $? -ne 0 ]]; then
91 cat '$error_log' >&2;
92 else
93 mv '$output_filename' '$output';
94 fi
95 ]]></command>
50 <inputs> 96 <inputs>
51 <param format="bmp,eps,gif,jpg,pcx,pgm,png,psd,tiff" name="input" type="data" label="Select image"/> 97 <expand macro="param_input"/>
52 <conditional name="noise_cond"> 98 <conditional name="noise_cond">
53 <param name="noise" type="select" label="Noise"> 99 <param name="noise" type="select" label="Noise">
54 <option value="add_noise" selected="True">Add Random Noise</option> 100 <option value="add_noise" selected="True">Add Random Noise</option>
55 <option value="add_specified_noise">Add Specified Noise</option> 101 <option value="add_specified_noise">Add Specified Noise</option>
56 <option value="salt_and_pepper">Salt and Pepper</option> 102 <option value="salt_and_pepper">Salt and Pepper</option>
58 <option value="remove_outliers">Remove Outliers</option> 104 <option value="remove_outliers">Remove Outliers</option>
59 <option value="remove_nans">Remove NaNs</option> 105 <option value="remove_nans">Remove NaNs</option>
60 <option value="rof_denoise">ROF Denoise</option> 106 <option value="rof_denoise">ROF Denoise</option>
61 <option value="randomj">RandomJ</option> 107 <option value="randomj">RandomJ</option>
62 </param> 108 </param>
63 <when value="add_noise" /> 109 <when value="add_noise"/>
64 <when value="add_specified_noise"> 110 <when value="add_specified_noise">
65 <param name="standard_deviation" type="float" value="25.0" label="Standard deviation" help="Floating point number"/> 111 <param name="standard_deviation" type="float" value="25.0" label="Standard deviation" help="Floating point number"/>
66 </when> 112 </when>
67 <when value="salt_and_pepper" /> 113 <when value="salt_and_pepper"/>
68 <when value="despeckle" /> 114 <when value="despeckle"/>
69 <when value="remove_outliers"> 115 <when value="remove_outliers">
70 <param name="radius" type="float" value="2.0" label="Radius" help="pixels"/> 116 <param name="radius" type="float" value="2.0" label="Radius" help="pixels"/>
71 <param name="threshold" type="float" value="50.0" label="Threshold"/> 117 <param name="threshold" type="float" value="50.0" label="Threshold"/>
72 <param name="which_outliers" type="select" label="Which Outliers"> 118 <param name="which_outliers" type="select" label="Which Outliers">
73 <option value="bright" selected="True">Bright</option> 119 <option value="bright" selected="True">Bright</option>
74 <option value="dark">Dark</option> 120 <option value="dark">Dark</option>
75 </param> 121 </param>
76 </when> 122 </when>
77 <when value="remove_nans" /> 123 <when value="remove_nans"/>
78 <when value="rof_denoise" /> 124 <when value="rof_denoise"/>
79 <when value="randomj"> 125 <when value="randomj">
80 <conditional name="randomj_cond"> 126 <conditional name="randomj_cond">
81 <param name="randomj" type="select" label="RandomJ"> 127 <param name="randomj" type="select" label="RandomJ">
82 <option value="randomj_binomial" selected="True">RandomJ Binomial</option> 128 <option value="randomj_binomial" selected="True">RandomJ Binomial</option>
83 <option value="randomj_exponential">RandomJ Exponential</option> 129 <option value="randomj_exponential">RandomJ Exponential</option>
87 <option value="randomj_uniform">RandomJ Uniform</option> 133 <option value="randomj_uniform">RandomJ Uniform</option>
88 </param> 134 </param>
89 <when value="randomj_binomial"> 135 <when value="randomj_binomial">
90 <param name="trials" type="float" value="1.0" label="Trials"/> 136 <param name="trials" type="float" value="1.0" label="Trials"/>
91 <param name="probability" type="float" value="0.5" label="Probability"/> 137 <param name="probability" type="float" value="0.5" label="Probability"/>
92 <expand macro="insertion_select" /> 138 <expand macro="insertion_select"/>
93 </when> 139 </when>
94 <when value="randomj_exponential"> 140 <when value="randomj_exponential">
95 <param name="lammbda" type="float" value="0.5" label="Lambda"/> 141 <param name="lammbda" type="float" value="0.5" label="Lambda"/>
96 <expand macro="insertion_select" /> 142 <expand macro="insertion_select"/>
97 </when> 143 </when>
98 <when value="randomj_gamma"> 144 <when value="randomj_gamma">
99 <param name="order" type="integer" value="1" label="Order"/> 145 <param name="order" type="integer" value="1" label="Order"/>
100 <expand macro="insertion_select" /> 146 <expand macro="insertion_select"/>
101 </when> 147 </when>
102 <when value="randomj_gaussian"> 148 <when value="randomj_gaussian">
103 <param name="mean" type="float" value="0.0" label="Mean"/> 149 <param name="mean" type="float" value="0.0" label="Mean"/>
104 <param name="sigma" type="float" value="1.0" label="Sigma"/> 150 <param name="sigma" type="float" value="1.0" label="Sigma"/>
105 <expand macro="insertion_select" /> 151 <expand macro="insertion_select"/>
106 </when> 152 </when>
107 <when value="randomj_poisson"> 153 <when value="randomj_poisson">
108 <param name="mean" type="float" value="1.0" label="Mean"/> 154 <param name="mean" type="float" value="1.0" label="Mean"/>
109 <expand macro="insertion_select" /> 155 <expand macro="insertion_select"/>
110 </when> 156 </when>
111 <when value="randomj_uniform"> 157 <when value="randomj_uniform">
112 <param name="min" type="float" value="0.0" label="Min"/> 158 <param name="min" type="float" value="0.0" label="Min"/>
113 <param name="max" type="float" value="1.0" label="Max"/> 159 <param name="max" type="float" value="1.0" label="Max"/>
114 <expand macro="insertion_select" /> 160 <expand macro="insertion_select"/>
115 </when> 161 </when>
116 </conditional> 162 </conditional>
117 </when> 163 </when>
118 </conditional> 164 </conditional>
119 </inputs> 165 </inputs>
120 <outputs> 166 <outputs>
121 <data name="output" format_source="input" label="${tool.name} on ${on_string}: ${noise_cond.noise.replace( '_', ' ' )}" /> 167 <data name="output" format_source="input"/>
122 </outputs> 168 </outputs>
123 <tests> 169 <tests>
124 <test> 170 <test>
125 <param name="input" value="blobs.gif" /> 171 <param name="input" value="blobs.gif"/>
126 <param name="input_datatype" value="gif" /> 172 <param name="noise" value="add_specified_noise"/>
127 <param name="noise" value="add_specified_noise" /> 173 <output name="output" file="add_specified_noise.gif"/>
128 <output name="output" file="add_specified_noise.gif" />
129 </test> 174 </test>
130 <test> 175 <test>
131 <param name="input" value="blobs.gif" /> 176 <param name="input" value="blobs.gif"/>
132 <param name="input_datatype" value="gif" /> 177 <param name="noise" value="despeckle"/>
133 <param name="noise" value="despeckle" /> 178 <output name="output" file="despeckle.gif"/>
134 <output name="output" file="despeckle.gif" />
135 </test> 179 </test>
136 <test> 180 <test>
137 <param name="input" value="blobs.gif" /> 181 <param name="input" value="blobs.gif"/>
138 <param name="input_datatype" value="gif" /> 182 <param name="noise" value="remove_outliers"/>
139 <param name="noise" value="remove_outliers" /> 183 <output name="output" file="remove_outliers.gif"/>
140 <param name="radius" value="2.0" />
141 <param name="threshold" value="50.0" />
142 <param name="which_outliers" value="bright" />
143 <output name="output" file="remove_outliers.gif" />
144 </test> 184 </test>
145 </tests> 185 </tests>
146 <help> 186 <help>
147 **What it does** 187 **What it does**
148 188
161 - **RandonJ Gaussian** - Contaminates image with random numbers generated using a Gaussian random variable. 201 - **RandonJ Gaussian** - Contaminates image with random numbers generated using a Gaussian random variable.
162 - **RandonJ Poisson** - Contaminates image with random numbers generated using a Poisson random variable. 202 - **RandonJ Poisson** - Contaminates image with random numbers generated using a Poisson random variable.
163 - **RandonJ Uniform** - Contaminates image with random numbers generated using a uniform random variable. 203 - **RandonJ Uniform** - Contaminates image with random numbers generated using a uniform random variable.
164 ]]> 204 ]]>
165 </help> 205 </help>
166 <expand macro="fiji_headless_citations" /> 206 <expand macro="fiji_headless_citations"/>
167 </tool> 207 </tool>