Mercurial > repos > imgteam > imagej2_create_image
comparison imagej2_sharpen_jython_script.py @ 1:1a7c29d5fc11 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:43:06 +0000 |
parents | dc3935a0165a |
children | 69e28b06e027 |
comparison
equal
deleted
inserted
replaced
0:dc3935a0165a | 1:1a7c29d5fc11 |
---|---|
1 import jython_utils | |
2 import sys | 1 import sys |
2 | |
3 from ij import IJ | 3 from ij import IJ |
4 | 4 |
5 # Fiji Jython interpreter implements Python 2.5 which does not | 5 # Fiji Jython interpreter implements Python 2.5 which does not |
6 # provide support for argparse. | 6 # provide support for argparse. |
7 error_log = sys.argv[ -4 ] | 7 error_log = sys.argv[-4] |
8 input = sys.argv[ -3 ] | 8 input_file = sys.argv[-3] |
9 tmp_output_path = sys.argv[ -2 ] | 9 tmp_output_path = sys.argv[-2] |
10 output_datatype = sys.argv[ -1 ] | 10 output_datatype = sys.argv[-1] |
11 | 11 |
12 # Open the input image file. | 12 # Open the input image file. |
13 input_image_plus = IJ.openImage( input ) | 13 input_image_plus = IJ.openImage(input_file) |
14 | 14 |
15 # Create a copy of the image. | 15 # Create a copy of the image. |
16 input_image_plus_copy = input_image_plus.duplicate() | 16 input_image_plus_copy = input_image_plus.duplicate() |
17 image_processor_copy = input_image_plus_copy.getProcessor() | 17 image_processor_copy = input_image_plus_copy.getProcessor() |
18 | 18 |
19 try: | 19 # Run the command. |
20 # Run the command. | 20 IJ.run(input_image_plus_copy, "Sharpen", "") |
21 IJ.run( input_image_plus_copy, "Sharpen", "" ) | 21 # Save the ImagePlus object as a new image. |
22 # Save the ImagePlus object as a new image. | 22 IJ.saveAs(input_image_plus_copy, output_datatype, tmp_output_path) |
23 IJ.saveAs( input_image_plus_copy, output_datatype, tmp_output_path ) | |
24 except Exception, e: | |
25 jython_utils.handle_error( error_log, str( e ) ) |