Mercurial > repos > imgteam > imagej2_noise
comparison 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 |
comparison
equal
deleted
inserted
replaced
2:756e062741dc | 3:73cc4e6a741d |
---|---|
1 <tool id="imagej2_noise" name="Add or remove noise" version="@WRAPPER_VERSION@.1"> | 1 <tool id="imagej2_noise" name="Add or remove noise" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="23.0"> |
2 <description>with ImageJ2</description> | 2 <description>with ImageJ2</description> |
3 <macros> | 3 <macros> |
4 <import>imagej2_macros.xml</import> | 4 <import>imagej2_macros.xml</import> |
5 <xml name="insertion_select"> | |
6 <param name="insertion" type="select" label="Insertion"> | |
7 <option value="additive" selected="True">Additive</option> | |
8 <option value="multiplicative">Multiplicative</option> | |
9 </param> | |
10 </xml> | |
11 </macros> | 5 </macros> |
12 <edam_operations> | 6 <edam_operations> |
13 <edam_operation>operation_3443</edam_operation> | 7 <edam_operation>operation_3443</edam_operation> |
14 </edam_operations> | 8 </edam_operations> |
15 <xrefs> | 9 <xrefs> |
17 <xref type="biii">imagej2</xref> | 11 <xref type="biii">imagej2</xref> |
18 </xrefs> | 12 </xrefs> |
19 <expand macro="fiji_requirements"/> | 13 <expand macro="fiji_requirements"/> |
20 <command detect_errors="exit_code"><![CDATA[ | 14 <command detect_errors="exit_code"><![CDATA[ |
21 #import os | 15 #import os |
22 #set error_log = 'output_log.txt' | |
23 #if str($noise_cond.noise) == 'randomj': | |
24 #set randomj_value = $noise_cond.randomj_cond.randomj | |
25 #else: | |
26 #set randomj_value = None | |
27 #end if | |
28 #set input_sans_ext = $os.path.splitext($os.path.basename($input.file_name))[0] | 16 #set input_sans_ext = $os.path.splitext($os.path.basename($input.file_name))[0] |
29 #set input_with_ext = '.'.join([input_sans_ext, $input.ext]) | 17 #set input_with_ext = './' + '.'.join([input_sans_ext, $input.ext]) |
30 ln -s '$input.file_name' '$input_with_ext' && | 18 ln -s '$input.file_name' '$input_with_ext' && |
31 #set output_filename = '.'.join(['output', $input.ext]) | 19 #set output_filename = '.'.join(['output', $input.ext]) |
32 touch '$output_filename' && | 20 touch '$output_filename' && |
33 touch '$error_log' && | |
34 ImageJ --ij2 --headless --debug | 21 ImageJ --ij2 --headless --debug |
35 --jython '$__tool_directory__/imagej2_noise_jython_script.py' | 22 --jython '$__tool_directory__/imagej2_noise_jython_script.py' |
36 '$error_log' | |
37 '$input_with_ext' | 23 '$input_with_ext' |
38 '$input.ext' | 24 '$input.ext' |
39 '$noise_cond.noise' | 25 '$noise_cond.noise' |
40 #if $noise_cond.noise == 'add_specified_noise': | 26 #if $noise_cond.noise == 'add_specified_noise': |
41 $noise_cond.standard_deviation | 27 $noise_cond.standard_deviation |
49 #else: | 35 #else: |
50 'None' | 36 'None' |
51 'None' | 37 'None' |
52 'None' | 38 'None' |
53 #end if | 39 #end if |
54 '$randomj_value' | |
55 #if $randomj_value == 'randomj_binomial': | |
56 $noise_cond.randomj_cond.trials | |
57 $noise_cond.randomj_cond.probability | |
58 #else: | |
59 'None' | |
60 'None' | |
61 #end if | |
62 #if $randomj_value == 'randomj_exponential': | |
63 $noise_cond.randomj_cond.lammbda | |
64 #else: | |
65 'None' | |
66 #end if | |
67 #if $randomj_value == 'randomj_gamma': | |
68 $noise_cond.randomj_cond.order | |
69 #else: | |
70 'None' | |
71 #end if | |
72 #if $randomj_value in['randomj_gaussian', 'randomj_poisson']: | |
73 $noise_cond.randomj_cond.mean | |
74 #if $randomj_value == 'randomj_gaussian': | |
75 $noise_cond.randomj_cond.sigma | |
76 #else: | |
77 'None' | |
78 #end if | |
79 #else: | |
80 'None' | |
81 'None' | |
82 #end if | |
83 #if $randomj_value == 'randomj_uniform': | |
84 $noise_cond.randomj_cond.min | |
85 $noise_cond.randomj_cond.max | |
86 #else: | |
87 'None' | |
88 'None' | |
89 #end if | |
90 #if str($randomj_value) != 'None': | |
91 '$noise_cond.randomj_cond.insertion' | |
92 #else: | |
93 'None' | |
94 #end if | |
95 '$output_filename' | 40 '$output_filename' |
96 &>'$error_log'; | 41 && mv '$output_filename' '$output'; |
97 if [[ $? -ne 0 ]]; then | |
98 cat '$error_log' >&2; | |
99 else | |
100 mv '$output_filename' '$output'; | |
101 fi | |
102 ]]></command> | 42 ]]></command> |
103 <inputs> | 43 <inputs> |
104 <expand macro="param_input"/> | 44 <expand macro="param_input"/> |
105 <conditional name="noise_cond"> | 45 <conditional name="noise_cond"> |
106 <param name="noise" type="select" label="Noise"> | 46 <param name="noise" type="select" label="Noise"> |
109 <option value="salt_and_pepper">Salt and Pepper</option> | 49 <option value="salt_and_pepper">Salt and Pepper</option> |
110 <option value="despeckle">Despeckle</option> | 50 <option value="despeckle">Despeckle</option> |
111 <option value="remove_outliers">Remove Outliers</option> | 51 <option value="remove_outliers">Remove Outliers</option> |
112 <option value="remove_nans">Remove NaNs</option> | 52 <option value="remove_nans">Remove NaNs</option> |
113 <option value="rof_denoise">ROF Denoise</option> | 53 <option value="rof_denoise">ROF Denoise</option> |
114 <option value="randomj">RandomJ</option> | |
115 </param> | 54 </param> |
116 <when value="add_noise"/> | 55 <when value="add_noise"/> |
117 <when value="add_specified_noise"> | 56 <when value="add_specified_noise"> |
118 <param name="standard_deviation" type="float" value="25.0" label="Standard deviation" help="Floating point number"/> | 57 <param name="standard_deviation" type="float" value="25.0" label="Standard deviation" help="Floating point number"/> |
119 </when> | 58 </when> |
121 <when value="despeckle"/> | 60 <when value="despeckle"/> |
122 <when value="remove_outliers"> | 61 <when value="remove_outliers"> |
123 <param name="radius" type="float" value="2.0" label="Radius" help="pixels"/> | 62 <param name="radius" type="float" value="2.0" label="Radius" help="pixels"/> |
124 <param name="threshold" type="float" value="50.0" label="Threshold"/> | 63 <param name="threshold" type="float" value="50.0" label="Threshold"/> |
125 <param name="which_outliers" type="select" label="Which Outliers"> | 64 <param name="which_outliers" type="select" label="Which Outliers"> |
126 <option value="bright" selected="True">Bright</option> | 65 <option value="Bright" selected="True">Bright</option> |
127 <option value="dark">Dark</option> | 66 <option value="Dark">Dark</option> |
128 </param> | 67 </param> |
129 </when> | 68 </when> |
130 <when value="remove_nans"/> | 69 <when value="remove_nans"/> |
131 <when value="rof_denoise"/> | 70 <when value="rof_denoise"/> |
132 <when value="randomj"> | |
133 <conditional name="randomj_cond"> | |
134 <param name="randomj" type="select" label="RandomJ"> | |
135 <option value="randomj_binomial" selected="True">RandomJ Binomial</option> | |
136 <option value="randomj_exponential">RandomJ Exponential</option> | |
137 <option value="randomj_gamma">RandomJ Gamma</option> | |
138 <option value="randomj_gaussian">RandomJ Gaussian</option> | |
139 <option value="randomj_poisson">RandomJ Poisson</option> | |
140 <option value="randomj_uniform">RandomJ Uniform</option> | |
141 </param> | |
142 <when value="randomj_binomial"> | |
143 <param name="trials" type="float" value="1.0" label="Trials"/> | |
144 <param name="probability" type="float" value="0.5" label="Probability"/> | |
145 <expand macro="insertion_select"/> | |
146 </when> | |
147 <when value="randomj_exponential"> | |
148 <param name="lammbda" type="float" value="0.5" label="Lambda"/> | |
149 <expand macro="insertion_select"/> | |
150 </when> | |
151 <when value="randomj_gamma"> | |
152 <param name="order" type="integer" value="1" label="Order"/> | |
153 <expand macro="insertion_select"/> | |
154 </when> | |
155 <when value="randomj_gaussian"> | |
156 <param name="mean" type="float" value="0.0" label="Mean"/> | |
157 <param name="sigma" type="float" value="1.0" label="Sigma"/> | |
158 <expand macro="insertion_select"/> | |
159 </when> | |
160 <when value="randomj_poisson"> | |
161 <param name="mean" type="float" value="1.0" label="Mean"/> | |
162 <expand macro="insertion_select"/> | |
163 </when> | |
164 <when value="randomj_uniform"> | |
165 <param name="min" type="float" value="0.0" label="Min"/> | |
166 <param name="max" type="float" value="1.0" label="Max"/> | |
167 <expand macro="insertion_select"/> | |
168 </when> | |
169 </conditional> | |
170 </when> | |
171 </conditional> | 71 </conditional> |
172 </inputs> | 72 </inputs> |
173 <outputs> | 73 <outputs> |
174 <data name="output" format_source="input"/> | 74 <data name="output" format_source="input"/> |
175 </outputs> | 75 </outputs> |
176 <tests> | 76 <tests> |
177 <test> | 77 <test> |
178 <param name="input" value="blobs.gif"/> | 78 <param name="input" value="blobs.gif"/> |
179 <param name="noise" value="add_specified_noise"/> | 79 <param name="noise" value="add_specified_noise"/> |
180 <output name="output" file="add_specified_noise.gif"/> | 80 <param name="standard_deviation" value="5" /> |
81 <!-- Cannot use image_diff as the noise is random --> | |
82 <output name="output" file="add_specified_noise.gif" compare="sim_size"/> | |
181 </test> | 83 </test> |
182 <test> | 84 <test> |
183 <param name="input" value="blobs.gif"/> | 85 <param name="input" value="blobs.gif"/> |
184 <param name="noise" value="despeckle"/> | 86 <param name="noise" value="despeckle"/> |
185 <output name="output" file="despeckle.gif"/> | 87 <output name="output" file="despeckle.gif" compare="image_diff"/> |
186 </test> | 88 </test> |
187 <test> | 89 <test> |
188 <param name="input" value="blobs.gif"/> | 90 <param name="input" value="blobs.gif"/> |
189 <param name="noise" value="remove_outliers"/> | 91 <param name="noise" value="remove_outliers"/> |
190 <output name="output" file="remove_outliers.gif"/> | 92 <param name="radius" value="10.0"/> |
93 <param name="threshold" value="1"/> | |
94 <param name="which_outliers" value="Bright"/> | |
95 <output name="output" file="remove_outliers.gif" compare="image_diff"/> | |
96 </test> | |
97 <test expect_failure="true"> | |
98 <param name="input" value="blobs.gif"/> | |
99 <param name="noise" value="remove_nans"/> | |
191 </test> | 100 </test> |
192 </tests> | 101 </tests> |
193 <help> | 102 <help> |
194 **What it does** | 103 **What it does** |
195 | 104 |
200 - **Add Specified Noise** - Adds Gaussian noise with a mean of zero and a chosen standard deviation. | 109 - **Add Specified Noise** - Adds Gaussian noise with a mean of zero and a chosen standard deviation. |
201 - **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. | 110 - **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. |
202 - **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). | 111 - **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). |
203 - **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). | 112 - **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). |
204 - **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. | 113 - **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. |
205 - **RandonJ Binomial** - Contaminates image with random numbers generated using a binomial random variable | |
206 - **RandonJ Exponential** - Contaminates image with random numbers generated using an exponential random variable. | |
207 - **RandonJ Gamma** - Contaminates image with random numbers generated using a gamma random variable. | |
208 - **RandonJ Gaussian** - Contaminates image with random numbers generated using a Gaussian random variable. | |
209 - **RandonJ Poisson** - Contaminates image with random numbers generated using a Poisson random variable. | |
210 - **RandonJ Uniform** - Contaminates image with random numbers generated using a uniform random variable. | |
211 ]]> | 114 ]]> |
212 </help> | 115 </help> |
213 <expand macro="fiji_headless_citations"/> | 116 <expand macro="fiji_headless_citations"/> |
214 </tool> | 117 </tool> |