comparison imagej2_make_binary_jython_script.py @ 2:aeae7e29d525 draft default tip

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:47:25 +0000
parents 5b154339fd90
children
comparison
equal deleted inserted replaced
1:5b154339fd90 2:aeae7e29d525
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