Mercurial > repos > iuc > imagej2_make_binary
comparison imagej2_make_binary.py @ 1:d26f11339f08 draft
planemo upload commit 18df9e67efd4adafcde4eb9b62cd815e4afe9733-dirty
| author | iuc |
|---|---|
| date | Wed, 26 Aug 2015 14:37:41 -0400 |
| parents | 66d9e595dff2 |
| children |
comparison
equal
deleted
inserted
replaced
| 0:66d9e595dff2 | 1:d26f11339f08 |
|---|---|
| 12 parser.add_argument( '--iterations', dest='iterations', type=int, help='Iterations' ) | 12 parser.add_argument( '--iterations', dest='iterations', type=int, help='Iterations' ) |
| 13 parser.add_argument( '--count', dest='count', type=int, help='Count' ) | 13 parser.add_argument( '--count', dest='count', type=int, help='Count' ) |
| 14 parser.add_argument( '--black_background', dest='black_background', help='Black background' ) | 14 parser.add_argument( '--black_background', dest='black_background', help='Black background' ) |
| 15 parser.add_argument( '--pad_edges_when_eroding', dest='pad_edges_when_eroding', help='Pad edges when eroding' ) | 15 parser.add_argument( '--pad_edges_when_eroding', dest='pad_edges_when_eroding', help='Pad edges when eroding' ) |
| 16 parser.add_argument( '--jython_script', dest='jython_script', help='Path to the Jython script' ) | 16 parser.add_argument( '--jython_script', dest='jython_script', help='Path to the Jython script' ) |
| 17 parser.add_argument( '--max_heap_size_type', dest='max_heap_size_type', help='Type (default or megabytes) of max_heap_size value' ) | |
| 18 parser.add_argument( '--max_heap_size', dest='max_heap_size', help='Maximum size of the memory allocation pool used by the JVM.' ) | |
| 19 parser.add_argument( '--output', dest='output', help='Path to the output file' ) | 17 parser.add_argument( '--output', dest='output', help='Path to the output file' ) |
| 20 parser.add_argument( '--output_datatype', dest='output_datatype', help='Datatype of the output image' ) | 18 parser.add_argument( '--output_datatype', dest='output_datatype', help='Datatype of the output image' ) |
| 21 args = parser.parse_args() | 19 args = parser.parse_args() |
| 22 | 20 |
| 23 tmp_dir = imagej2_base_utils.get_temp_dir() | 21 tmp_dir = imagej2_base_utils.get_temp_dir() |
| 24 # ImageJ expects valid image file extensions, so the Galaxy .dat extension does not | 22 # ImageJ expects valid image file extensions, so the Galaxy .dat extension does not |
| 25 # work for some features. The following creates a symlink with an appropriate file | 23 # work for some features. The following creates a symlink with an appropriate file |
| 26 # extension that points to the Galaxy dataset. This symlink is used by ImageJ. | 24 # extension that points to the Galaxy dataset. This symlink is used by ImageJ. |
| 27 tmp_input_path = imagej2_base_utils.get_input_image_path( tmp_dir, args.input, args.input_datatype ) | 25 tmp_input_path = imagej2_base_utils.get_input_image_path( tmp_dir, args.input, args.input_datatype ) |
| 28 tmp_output_path = imagej2_base_utils.get_temporary_image_path( tmp_dir, args.output_datatype ) | 26 tmp_output_path = imagej2_base_utils.get_temporary_image_path( tmp_dir, args.output_datatype ) |
| 29 # Set the size of the memory allocation pool used by the JVM. | |
| 30 memory_size = imagej2_base_utils.get_max_heap_size_value( args.max_heap_size_type, args.max_heap_size ) | |
| 31 # Define command response buffers. | 27 # Define command response buffers. |
| 32 tmp_out = tempfile.NamedTemporaryFile().name | 28 tmp_out = tempfile.NamedTemporaryFile().name |
| 33 tmp_stdout = open( tmp_out, 'wb' ) | 29 tmp_stdout = open( tmp_out, 'wb' ) |
| 34 tmp_err = tempfile.NamedTemporaryFile().name | 30 tmp_err = tempfile.NamedTemporaryFile().name |
| 35 tmp_stderr = open( tmp_err, 'wb' ) | 31 tmp_stderr = open( tmp_err, 'wb' ) |
| 36 # Java writes a lot of stuff to stderr, so we'll specify a file for handling actual errors. | 32 # Java writes a lot of stuff to stderr, so we'll specify a file for handling actual errors. |
| 37 error_log = tempfile.NamedTemporaryFile( delete=False ).name | 33 error_log = tempfile.NamedTemporaryFile( delete=False ).name |
| 38 # Build the command line. | 34 # Build the command line. |
| 39 cmd = imagej2_base_utils.get_base_command_imagej2( memory_size, jython_script=args.jython_script ) | 35 cmd = imagej2_base_utils.get_base_command_imagej2( None, jython_script=args.jython_script ) |
| 40 if cmd is None: | 36 if cmd is None: |
| 41 imagej2_base_utils.stop_err( "ImageJ not found!" ) | 37 imagej2_base_utils.stop_err( "ImageJ not found!" ) |
| 42 cmd += ' %s' % error_log | 38 cmd += ' %s' % error_log |
| 43 cmd += ' %s' % tmp_input_path | 39 cmd += ' %s' % tmp_input_path |
| 44 cmd += ' %d' % args.iterations | 40 cmd += ' %d' % args.iterations |
