comparison imagej2_bunwarpj_align_jython_script.py @ 0:1bf7e70e67f9 draft

"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
author imgteam
date Tue, 17 Sep 2019 16:56:02 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:1bf7e70e67f9
1 import sys
2 import jython_utils
3 from ij import IJ
4
5 # Fiji Jython interpreter implements Python 2.5 which does not
6 # provide support for argparse.
7
8 if sys.argv[ -1 ].lower() in [ 'true' ]:
9 mono = True
10 else:
11 mono = False
12
13 if mono:
14 # bUnwarpJ has been called with the -mono param.
15 source_tiff_path = sys.argv[ -4 ]
16 source_datatype = sys.argv[ -3 ]
17 source_path = sys.argv[ -2 ]
18 else:
19 source_tiff_path = sys.argv[ -7 ]
20 source_datatype = sys.argv[ -6 ]
21 source_path = sys.argv[ -5 ]
22 target_tiff_path = sys.argv[ -4 ]
23 target_datatype = sys.argv[ -3 ]
24 target_path = sys.argv[ -2 ]
25
26 # Save the Registered Source Image.
27 registered_source_image = IJ.openImage( source_tiff_path )
28 if source_datatype == 'tiff':
29 registered_source_image = jython_utils.convert_before_saving_as_tiff( registered_source_image )
30 IJ.saveAs( registered_source_image, source_datatype, source_path )
31
32 if not mono:
33 # Save the Registered Target Image.
34 registered_target_image = IJ.openImage( target_tiff_path )
35 if target_datatype == 'tiff':
36 registered_target_image = jython_utils.convert_before_saving_as_tiff( registered_target_image )
37 IJ.saveAs( registered_target_image, target_datatype, target_path )