comparison imagej2_make_binary_jython_script.py @ 2:6c47d8a43207 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:48:29 +0000
parents 8c0ace7ae77c
children f068e9171af2
comparison
equal deleted inserted replaced
1:8c0ace7ae77c 2:6c47d8a43207
6 # provide support for argparse. 6 # provide support for argparse.
7 error_log = sys.argv[-8] 7 error_log = sys.argv[-8]
8 input = sys.argv[-7] 8 input = sys.argv[-7]
9 iterations = int(sys.argv[-6]) 9 iterations = int(sys.argv[-6])
10 count = int(sys.argv[-5]) 10 count = int(sys.argv[-5])
11 black_background = sys.argv[-4] == 'yes' 11 black_background = sys.argv[-4] == "yes"
12 pad_edges_when_eroding = sys.argv[-3] == 'yes' 12 pad_edges_when_eroding = sys.argv[-3] == "yes"
13 tmp_output_path = sys.argv[-2] 13 tmp_output_path = sys.argv[-2]
14 output_datatype = sys.argv[-1] 14 output_datatype = sys.argv[-1]
15 15
16 # Open the input image file. 16 # Open the input image file.
17 input_image_plus = IJ.openImage(input) 17 input_image_plus = IJ.openImage(input)
19 # Create a copy of the image. 19 # Create a copy of the image.
20 input_image_plus_copy = input_image_plus.duplicate() 20 input_image_plus_copy = input_image_plus.duplicate()
21 image_processor_copy = input_image_plus_copy.getProcessor() 21 image_processor_copy = input_image_plus_copy.getProcessor()
22 22
23 # Set binary options. 23 # Set binary options.
24 options = ['edm=Overwrite', 'iterations=%d' % iterations, 'count=%d' % count] 24 options = ["edm=Overwrite", "iterations=%d" % iterations, "count=%d" % count]
25 if pad_edges_when_eroding: 25 if pad_edges_when_eroding:
26 options.append('pad') 26 options.append("pad")
27 if black_background: 27 if black_background:
28 options.append('black') 28 options.append("black")
29 options = ' '.join(options) 29 options = " ".join(options)
30 IJ.run(input_image_plus_copy, "Options...", options) 30 IJ.run(input_image_plus_copy, "Options...", options)
31 31
32 # Run the command. 32 # Run the command.
33 IJ.run(input_image_plus_copy, "Make Binary", "") 33 IJ.run(input_image_plus_copy, "Make Binary", "")
34 34