Beispiel #1
0
error_log = tempfile.NamedTemporaryFile(delete=False).name

# Build the command line.
cmd = imagej2_base_utils.get_base_command_imagej2(
    None, jython_script=args.jython_script)
if cmd is None:
    imagej2_base_utils.stop_err("ImageJ not found!")
cmd += ' %s' % error_log
cmd += ' %s' % tmp_input_path
cmd += ' %s' % args.operation
# Handle the expression, which must be enclosed in " if not None.
if args.expression in [None, 'None']:
    cmd += ' None'
else:
    cmd += ' "%s"' % args.expression
cmd += imagej2_base_utils.handle_none_type(args.bin_constant, val_type='int')
cmd += imagej2_base_utils.handle_none_type(args.float_constant)
cmd += ' %s' % tmp_output_path
cmd += ' %s' % args.output_datatype

# Run the command.
proc = subprocess.Popen(args=cmd,
                        stderr=tmp_stderr,
                        stdout=tmp_stdout,
                        shell=True)
rc = proc.wait()

# Handle execution errors.
if rc != 0:
    error_message = imagej2_base_utils.get_stderr_exception(
        tmp_err, tmp_stderr, tmp_out, tmp_stdout)
# Java writes a lot of stuff to stderr, so we'll specify a file for handling actual errors.
error_log = tempfile.NamedTemporaryFile( delete=False ).name

# Build the command line.
cmd = imagej2_base_utils.get_base_command_imagej2( None, jython_script=args.jython_script )
if cmd is None:
    imagej2_base_utils.stop_err( "ImageJ not found!" )
cmd += ' %s' % error_log
cmd += ' %s' % tmp_input_path
cmd += ' %s' % args.operation
# Handle the expression, which must be enclosed in " if not None.
if args.expression in [ None, 'None' ]:
    cmd += ' None'
else:
    cmd += ' "%s"' % args.expression
cmd += imagej2_base_utils.handle_none_type( args.bin_constant, val_type='int' )
cmd += imagej2_base_utils.handle_none_type( args.float_constant )
cmd += ' %s' % tmp_output_path
cmd += ' %s' % args.output_datatype

# Run the command.
proc = subprocess.Popen( args=cmd, stderr=tmp_stderr, stdout=tmp_stdout, shell=True )
rc = proc.wait()

# Handle execution errors.
if rc != 0:
    error_message = imagej2_base_utils.get_stderr_exception( tmp_err, tmp_stderr, tmp_out, tmp_stdout )
    imagej2_base_utils.stop_err( error_message )

# Handle processing errors.
if os.path.getsize( error_log ) > 0:
Beispiel #3
0
    # Define command response buffers.
    tmp_out = tempfile.NamedTemporaryFile().name
    tmp_stdout = open( tmp_out, 'wb' )
    tmp_err = tempfile.NamedTemporaryFile().name
    tmp_stderr = open( tmp_err, 'wb' )
    # Java writes a lot of stuff to stderr, so we'll specify a file for handling actual errors.
    error_log = tempfile.NamedTemporaryFile( delete=False ).name
    # Build the command line.
    cmd = imagej2_base_utils.get_base_command_imagej2( memory_size, jython_script=args.jython_script )
    if cmd is None:
        imagej2_base_utils.stop_err( "ImageJ not found!" )
    cmd += ' %s' % error_log
    cmd += ' %s' % tmp_input_path
    cmd += ' %s' % args.input_datatype
    cmd += ' %s ' % args.noise
    cmd += imagej2_base_utils.handle_none_type( args.standard_deviation )
    cmd += imagej2_base_utils.handle_none_type( args.radius )
    cmd += imagej2_base_utils.handle_none_type( args.threshold )
    cmd += ' %s' % args.which_outliers
    cmd += ' %s' % args.randomj
    cmd += imagej2_base_utils.handle_none_type( args.trials )
    cmd += imagej2_base_utils.handle_none_type( args.probability )
    cmd += imagej2_base_utils.handle_none_type( args.lammbda )
    cmd += imagej2_base_utils.handle_none_type( args.order, val_type='int' )
    cmd += imagej2_base_utils.handle_none_type( args.mean )
    cmd += imagej2_base_utils.handle_none_type( args.sigma )
    cmd += imagej2_base_utils.handle_none_type( args.min )
    cmd += imagej2_base_utils.handle_none_type( args.max )
    cmd += ' %s' % args.insertion
    cmd += ' %s' % tmp_output_path
tmp_stderr = open( tmp_err, 'wb' )
# Java writes a lot of stuff to stderr, so we'll specify a file for handling actual errors.
error_log = tempfile.NamedTemporaryFile( delete=False ).name

# Build the command line.
cmd = imagej2_base_utils.get_base_command_imagej2( None, jython_script=args.jython_script )
if cmd is None:
    imagej2_base_utils.stop_err( "ImageJ not found!" )
cmd += ' %s' % error_log
cmd += ' %s' % tmp_input_path
cmd += ' %s' % args.size
cmd += ' %.3f' % args.circularity_min
cmd += ' %.3f' % args.circularity_max
cmd += ' %s' % args.show
cmd += ' %s' % args.display_results
cmd += '%s' % imagej2_base_utils.handle_none_type( args.all_results, val_type='str' )
cmd += ' %s' % args.exclude_edges
cmd += ' %s' % args.include_holes
cmd += '%s' % imagej2_base_utils.handle_none_type( tmp_output_path, val_type='str' )
cmd += ' %s' % args.output_datatype
cmd += '%s' % imagej2_base_utils.handle_none_type( args.results, val_type='str' )

# Run the command.
proc = subprocess.Popen( args=cmd, stderr=tmp_stderr, stdout=tmp_stdout, shell=True )
rc = proc.wait()

# Handle execution errors.
if rc != 0:
    error_message = imagej2_base_utils.get_stderr_exception( tmp_err, tmp_stderr, tmp_out, tmp_stdout )
    imagej2_base_utils.stop_err( error_message )
# Java writes a lot of stuff to stderr, so we'll specify a file for handling actual errors.
error_log = tempfile.NamedTemporaryFile(delete=False).name

# Build the command line.
cmd = imagej2_base_utils.get_base_command_imagej2(None, jython_script=args.jython_script)
if cmd is None:
    imagej2_base_utils.stop_err("ImageJ not found!")
cmd += " %s" % error_log
cmd += " %s" % tmp_input_path
cmd += " %s" % args.black_background
cmd += " %s" % args.size
cmd += " %.3f" % args.circularity_min
cmd += " %.3f" % args.circularity_max
cmd += " %s" % args.show
cmd += " %s" % args.display_results
cmd += "%s" % imagej2_base_utils.handle_none_type(args.all_results, val_type="str")
cmd += " %s" % args.exclude_edges
cmd += " %s" % args.include_holes
cmd += "%s" % imagej2_base_utils.handle_none_type(tmp_output_path, val_type="str")
cmd += " %s" % args.output_datatype
cmd += "%s" % imagej2_base_utils.handle_none_type(args.results, val_type="str")

# Run the command.
proc = subprocess.Popen(args=cmd, stderr=tmp_stderr, stdout=tmp_stdout, shell=True)
rc = proc.wait()

# Handle execution errors.
if rc != 0:
    error_message = imagej2_base_utils.get_stderr_exception(tmp_err, tmp_stderr, tmp_out, tmp_stdout)
    imagej2_base_utils.stop_err(error_message)
error_log = tempfile.NamedTemporaryFile(delete=False).name

# Build the command line.
cmd = imagej2_base_utils.get_base_command_imagej2(
    None, jython_script=args.jython_script)
if cmd is None:
    imagej2_base_utils.stop_err("ImageJ not found!")
cmd += ' %s' % error_log
cmd += ' %s' % tmp_input_path
cmd += ' %s' % args.black_background
cmd += ' %s' % args.size
cmd += ' %.3f' % args.circularity_min
cmd += ' %.3f' % args.circularity_max
cmd += ' %s' % args.show
cmd += ' %s' % args.display_results
cmd += '%s' % imagej2_base_utils.handle_none_type(args.all_results,
                                                  val_type='str')
cmd += ' %s' % args.exclude_edges
cmd += ' %s' % args.include_holes
cmd += '%s' % imagej2_base_utils.handle_none_type(tmp_output_path,
                                                  val_type='str')
cmd += ' %s' % args.output_datatype
cmd += '%s' % imagej2_base_utils.handle_none_type(args.results, val_type='str')

# Run the command.
proc = subprocess.Popen(args=cmd,
                        stderr=tmp_stderr,
                        stdout=tmp_stdout,
                        shell=True)
rc = proc.wait()

# Handle execution errors.
# Define command response buffers.
tmp_out = tempfile.NamedTemporaryFile().name
tmp_stdout = open( tmp_out, 'wb' )
tmp_err = tempfile.NamedTemporaryFile().name
tmp_stderr = open( tmp_err, 'wb' )
# Java writes a lot of stuff to stderr, so we'll specify a file for handling actual errors.
error_log = tempfile.NamedTemporaryFile( delete=False ).name

# Build the command line.
cmd = imagej2_base_utils.get_base_command_imagej2( None, jython_script=args.jython_script )
if cmd is None:
    imagej2_base_utils.stop_err( "ImageJ not found!" )
cmd += ' %s' % error_log
cmd += ' %s' % tmp_input_path
cmd += ' %s' % args.equalize_histogram
cmd += imagej2_base_utils.handle_none_type( args.saturated_pixels )
cmd += ' %s' % args.normalize
cmd += ' %s' % tmp_output_path
cmd += ' %s' % args.output_datatype

# Run the command.
proc = subprocess.Popen( args=cmd, stderr=tmp_stderr, stdout=tmp_stdout, shell=True )
rc = proc.wait()

# Handle execution errors.
if rc != 0:
    error_message = imagej2_base_utils.get_stderr_exception( tmp_err, tmp_stderr, tmp_out, tmp_stdout )
    imagej2_base_utils.stop_err( error_message )

# Handle processing errors.
if os.path.getsize( error_log ) > 0:
Beispiel #8
0
    # Define command response buffers.
    tmp_out = tempfile.NamedTemporaryFile().name
    tmp_stdout = open( tmp_out, 'wb' )
    tmp_err = tempfile.NamedTemporaryFile().name
    tmp_stderr = open( tmp_err, 'wb' )
    # Java writes a lot of stuff to stderr, so we'll specify a file for handling actual errors.
    error_log = tempfile.NamedTemporaryFile( delete=False ).name
    # Build the command line.
    cmd = imagej2_base_utils.get_base_command_imagej2( None, jython_script=args.jython_script )
    if cmd is None:
        imagej2_base_utils.stop_err( "ImageJ not found!" )
    cmd += ' %s' % error_log
    cmd += ' %s' % tmp_input_path
    cmd += ' %s' % args.input_datatype
    cmd += ' %s ' % args.noise
    cmd += imagej2_base_utils.handle_none_type( args.standard_deviation )
    cmd += imagej2_base_utils.handle_none_type( args.radius )
    cmd += imagej2_base_utils.handle_none_type( args.threshold )
    cmd += ' %s' % args.which_outliers
    cmd += ' %s' % args.randomj
    cmd += imagej2_base_utils.handle_none_type( args.trials )
    cmd += imagej2_base_utils.handle_none_type( args.probability )
    cmd += imagej2_base_utils.handle_none_type( args.lammbda )
    cmd += imagej2_base_utils.handle_none_type( args.order, val_type='int' )
    cmd += imagej2_base_utils.handle_none_type( args.mean )
    cmd += imagej2_base_utils.handle_none_type( args.sigma )
    cmd += imagej2_base_utils.handle_none_type( args.min )
    cmd += imagej2_base_utils.handle_none_type( args.max )
    cmd += ' %s' % args.insertion
    cmd += ' %s' % tmp_output_path
tmp_out = tempfile.NamedTemporaryFile().name
tmp_stdout = open(tmp_out, 'wb')
tmp_err = tempfile.NamedTemporaryFile().name
tmp_stderr = open(tmp_err, 'wb')
# Java writes a lot of stuff to stderr, so we'll specify a file for handling actual errors.
error_log = tempfile.NamedTemporaryFile(delete=False).name

# Build the command line.
cmd = imagej2_base_utils.get_base_command_imagej2(
    None, jython_script=args.jython_script)
if cmd is None:
    imagej2_base_utils.stop_err("ImageJ not found!")
cmd += ' %s' % error_log
cmd += ' %s' % tmp_input_path
cmd += ' %s' % args.equalize_histogram
cmd += imagej2_base_utils.handle_none_type(args.saturated_pixels)
cmd += ' %s' % args.normalize
cmd += ' %s' % tmp_output_path
cmd += ' %s' % args.output_datatype

# Run the command.
proc = subprocess.Popen(args=cmd,
                        stderr=tmp_stderr,
                        stdout=tmp_stdout,
                        shell=True)
rc = proc.wait()

# Handle execution errors.
if rc != 0:
    error_message = imagej2_base_utils.get_stderr_exception(
        tmp_err, tmp_stderr, tmp_out, tmp_stdout)