comparison imagej2_noise_jython_script.py @ 2:0a0d2dfd17e0 draft

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
author imgteam
date Sun, 05 Nov 2023 10:51:33 +0000
parents e9243cad1d67
children 711adedc5bb8
comparison
equal deleted inserted replaced
1:e9243cad1d67 2:0a0d2dfd17e0
33 image_plus_copy = image_plus.duplicate() 33 image_plus_copy = image_plus.duplicate()
34 # Make a copy of the image. 34 # Make a copy of the image.
35 image_processor_copy = image_plus_copy.getProcessor() 35 image_processor_copy = image_plus_copy.getProcessor()
36 36
37 # Perform the analysis on the ImagePlus object. 37 # Perform the analysis on the ImagePlus object.
38 if noise == 'add_noise': 38 if noise == "add_noise":
39 IJ.run(image_plus_copy, "Add Noise", "") 39 IJ.run(image_plus_copy, "Add Noise", "")
40 elif noise == 'add_specified_noise': 40 elif noise == "add_specified_noise":
41 IJ.run(image_plus_copy, "Add Specified Noise", "standard=&standard_deviation") 41 IJ.run(image_plus_copy, "Add Specified Noise", "standard=&standard_deviation")
42 elif noise == 'salt_and_pepper': 42 elif noise == "salt_and_pepper":
43 IJ.run(image_plus_copy, "Salt and Pepper", "") 43 IJ.run(image_plus_copy, "Salt and Pepper", "")
44 elif noise == 'despeckle': 44 elif noise == "despeckle":
45 IJ.run(image_plus_copy, "Despeckle", "") 45 IJ.run(image_plus_copy, "Despeckle", "")
46 elif noise == 'remove_outliers': 46 elif noise == "remove_outliers":
47 IJ.run(image_plus_copy, "Remove Outliers", "radius=&radius threshold=&threshold which=&which_outliers") 47 IJ.run(
48 elif noise == 'remove_nans': 48 image_plus_copy,
49 "Remove Outliers",
50 "radius=&radius threshold=&threshold which=&which_outliers",
51 )
52 elif noise == "remove_nans":
49 IJ.run(image_plus_copy, "Remove NaNs", "") 53 IJ.run(image_plus_copy, "Remove NaNs", "")
50 elif noise == 'rof_denoise': 54 elif noise == "rof_denoise":
51 IJ.run(image_plus_copy, "ROF Denoise", "") 55 IJ.run(image_plus_copy, "ROF Denoise", "")
52 elif noise == 'randomj': 56 elif noise == "randomj":
53 if randomj == 'randomj_binomial': 57 if randomj == "randomj_binomial":
54 IJ.run(image_plus_copy, "RandomJ Binomial", "trials=&trials probability=&probability insertion=&insertion") 58 IJ.run(
55 elif randomj == 'randomj_exponential': 59 image_plus_copy,
56 IJ.run(image_plus_copy, "RandomJ Exponential", "lambda=&lammbda insertion=&insertion") 60 "RandomJ Binomial",
57 elif randomj == 'randomj_gamma': 61 "trials=&trials probability=&probability insertion=&insertion",
62 )
63 elif randomj == "randomj_exponential":
64 IJ.run(
65 image_plus_copy,
66 "RandomJ Exponential",
67 "lambda=&lammbda insertion=&insertion",
68 )
69 elif randomj == "randomj_gamma":
58 IJ.run(image_plus_copy, "RandomJ Gamma", "order=&order insertion=&insertion") 70 IJ.run(image_plus_copy, "RandomJ Gamma", "order=&order insertion=&insertion")
59 elif randomj == 'randomj_gaussian': 71 elif randomj == "randomj_gaussian":
60 IJ.run(image_plus_copy, "RandomJ Gaussian", "mean=&mean sigma=&sigma insertion=&insertion") 72 IJ.run(
61 elif randomj == 'randomj_poisson': 73 image_plus_copy,
74 "RandomJ Gaussian",
75 "mean=&mean sigma=&sigma insertion=&insertion",
76 )
77 elif randomj == "randomj_poisson":
62 IJ.run(image_plus_copy, "RandomJ Poisson", "mean=&mean insertion=&insertion") 78 IJ.run(image_plus_copy, "RandomJ Poisson", "mean=&mean insertion=&insertion")
63 elif randomj == 'randomj_uniform': 79 elif randomj == "randomj_uniform":
64 IJ.run(image_plus_copy, "RandomJ Uniform", "min=&min max=&max insertion=&insertion") 80 IJ.run(
81 image_plus_copy, "RandomJ Uniform", "min=&min max=&max insertion=&insertion"
82 )
65 83
66 # Save the ImagePlus object as a new image. 84 # Save the ImagePlus object as a new image.
67 IJ.saveAs(image_plus_copy, image_datatype, tmp_output_path) 85 IJ.saveAs(image_plus_copy, image_datatype, tmp_output_path)