Mercurial > repos > bgruening > imagej2_enhance_contrast
comparison imagej2_sharpen_jython_script.py @ 0:5c1467b54342 draft default tip
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b'7e5cd452018ae9507c2d1cd13dd688a747550393\n'
| author | bgruening |
|---|---|
| date | Sat, 18 Mar 2017 09:42:41 -0400 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:5c1467b54342 |
|---|---|
| 1 import jython_utils | |
| 2 import sys | |
| 3 from ij import IJ | |
| 4 | |
| 5 # Fiji Jython interpreter implements Python 2.5 which does not | |
| 6 # provide support for argparse. | |
| 7 error_log = sys.argv[ -4 ] | |
| 8 input = sys.argv[ -3 ] | |
| 9 tmp_output_path = sys.argv[ -2 ] | |
| 10 output_datatype = sys.argv[ -1 ] | |
| 11 | |
| 12 # Open the input image file. | |
| 13 input_image_plus = IJ.openImage( input ) | |
| 14 | |
| 15 # Create a copy of the image. | |
| 16 input_image_plus_copy = input_image_plus.duplicate() | |
| 17 image_processor_copy = input_image_plus_copy.getProcessor() | |
| 18 | |
| 19 try: | |
| 20 # Run the command. | |
| 21 IJ.run( input_image_plus_copy, "Sharpen", "" ) | |
| 22 # Save the ImagePlus object as a new image. | |
| 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 ) ) |
