comparison jython_script.py @ 0:42e645a20a6e draft

planemo upload commit 18df9e67efd4adafcde4eb9b62cd815e4afe9733-dirty
author iuc
date Wed, 26 Aug 2015 14:36:27 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:42e645a20a6e
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[ -5 ]
8 input = sys.argv[ -4 ]
9 direction = sys.argv[ -3 ]
10 tmp_output_path = sys.argv[ -2 ]
11 output_datatype = sys.argv[ -1 ]
12
13 # Open the input image file.
14 input_image_plus = IJ.openImage( input )
15
16 # Create a copy of the image.
17 input_image_plus_copy = input_image_plus.duplicate()
18 image_processor_copy = input_image_plus_copy.getProcessor()
19
20 try:
21 # Run the command.
22 IJ.run( input_image_plus_copy, direction, "" )
23 # Save the ImagePlus object as a new image.
24 IJ.saveAs( input_image_plus_copy, output_datatype, tmp_output_path )
25 except Exception, e:
26 jython_utils.handle_error( error_log, str( e ) )