コード例 #1
0
import jython_utils
import sys
from ij import IJ

# Fiji Jython interpreter implements Python 2.5 which does not
# provide support for argparse.
error_log = sys.argv[-7]
input = sys.argv[-6]
equalize_histogram = jython_utils.asbool(sys.argv[-5])
saturated_pixels = sys.argv[-4]
normalize = jython_utils.asbool(sys.argv[-3])
tmp_output_path = sys.argv[-2]
output_datatype = sys.argv[-1]

# Open the input image file.
input_image_plus = IJ.openImage(input)

# Create a copy of the image.
input_image_plus_copy = input_image_plus.duplicate()
image_processor_copy = input_image_plus_copy.getProcessor()
bit_depth = image_processor_copy.getBitDepth()

# Set the options
options = []
# If equalize_histogram, saturated_pixels and normalize are ignored.
if equalize_histogram:
    options.append('equalize')
else:
    if saturated_pixels not in [None, 'None']:
        # Fiji allows only a single decimal place for this value.
        options.append('saturated=%.3f' % float(saturated_pixels))
コード例 #2
0
import jython_utils
import sys
from ij import IJ

# Fiji Jython interpreter implements Python 2.5 which does not
# provide support for argparse.
error_log = sys.argv[-5]
input = sys.argv[-4]
black_background = jython_utils.asbool(sys.argv[-3])
tmp_output_path = sys.argv[-2]
output_datatype = sys.argv[-1]

# Open the input image file.
input_image_plus = IJ.openImage(input)

# Create a copy of the image.
input_image_plus_copy = input_image_plus.duplicate()
image_processor_copy = input_image_plus_copy.getProcessor()

try:
    # Set binary options.
    options = jython_utils.get_binary_options(
        black_background=black_background)
    IJ.run(input_image_plus_copy, "Options...", options)

    # Convert image to binary if necessary.
    if not image_processor_copy.isBinary():
        # Convert the image to binary grayscale.
        IJ.run(input_image_plus_copy, "Make Binary", "")

    # Run the command.
コード例 #3
0
output_datatype = sys.argv[ -1 ]

# Open the input image file.
input_image_plus = IJ.openImage( input )

# Create a copy of the image.
input_image_plus_copy = input_image_plus.duplicate()
image_processor_copy = input_image_plus_copy.getProcessor()

try:
    # Convert image to binary if necessary.
    if not image_processor_copy.isBinary():
        # Convert the image to binary grayscale.
        IJ.run( input_image_plus_copy, "Make Binary","iterations=1 count=1 edm=Overwrite do=Nothing" )
    # Set the options.
    if jython_utils.asbool( dark_background ):
        method_str = "%s dark" % method
    else:
        method_str = method
    IJ.setAutoThreshold( input_image_plus_copy, method_str )
    if display == "red":
        display_mode = "Red"
    elif display == "bw":
        display_mode = "Black & White"
    elif display == "over_under":
        display_mode = "Over/Under"
    IJ.setThreshold( input_image_plus_copy, threshold_min, threshold_max, display_mode )
    # Run the command.
    IJ.run( input_image_plus_copy, "threshold", "" )
    # Save the ImagePlus object as a new image.
    IJ.saveAs( input_image_plus_copy, output_datatype, tmp_output_path )
コード例 #4
0
import jython_utils
import sys
from ij import IJ

# Fiji Jython interpreter implements Python 2.5 which does not
# provide support for argparse.
error_log = sys.argv[ -8 ]
input = sys.argv[ -7 ]
iterations = int( sys.argv[ -6 ] )
count = int( sys.argv[ -5 ] )
black_background = jython_utils.asbool( sys.argv[ -4 ] )
pad_edges_when_eroding = jython_utils.asbool( sys.argv[ -3 ] )
tmp_output_path = sys.argv[ -2 ]
output_datatype = sys.argv[ -1 ]

# Open the input image file.
input_image_plus = IJ.openImage( input )

# Create a copy of the image.
input_image_plus_copy = input_image_plus.duplicate()
image_processor_copy = input_image_plus_copy.getProcessor()

try:
    # Set binary options.
    options = jython_utils.get_binary_options( black_background=black_background,
                                               iterations=iterations,
                                               count=count,
                                               pad_edges_when_eroding=pad_edges_when_eroding )
    IJ.run( input_image_plus_copy, "Options...", options )

    # Run the command.
import jython_utils
import sys
from ij import IJ

# Fiji Jython interpreter implements Python 2.5 which does not
# provide support for argparse.
error_log = sys.argv[ -5 ]
input = sys.argv[ -4 ]
black_background = jython_utils.asbool( sys.argv[ -3 ] )
tmp_output_path = sys.argv[ -2 ]
output_datatype = sys.argv[ -1 ]

# Open the input image file.
input_image_plus = IJ.openImage( input )

# Create a copy of the image.
input_image_plus_copy = input_image_plus.duplicate()
image_processor_copy = input_image_plus_copy.getProcessor()

try:
    # Set binary options.
    options = jython_utils.get_binary_options( black_background=black_background )
    IJ.run( input_image_plus_copy, "Options...", options )

    # Convert image to binary if necessary.
    if not image_processor_copy.isBinary():
        # Convert the image to binary grayscale.
        IJ.run( input_image_plus_copy, "Make Binary", "" )

    # Run the command.
    IJ.run( input_image_plus_copy, "Watershed", "" )
コード例 #6
0
import sys
import jython_utils
from ij import ImagePlus, IJ
from ij.plugin.filter import Analyzer, MaximumFinder
from ij.process import ImageProcessor
from jarray import array

# Fiji Jython interpreter implements Python 2.5 which does not
# provide support for argparse.
error_log = sys.argv[ -10 ]
input = sys.argv[ -9 ]
scale_when_converting = jython_utils.asbool( sys.argv[ -8 ] )
weighted_rgb_conversions = jython_utils.asbool( sys.argv[ -7 ] )
noise_tolerance = int( sys.argv[ -6 ] )
output_type = sys.argv[ -5 ]
exclude_edge_maxima = jython_utils.asbool( sys.argv[ -4 ] )
light_background = jython_utils.asbool( sys.argv[ -3 ] )
tmp_output_path = sys.argv[ -2 ]
output_datatype = sys.argv[ -1 ]

# Open the input image file.
input_image_plus = IJ.openImage( input )

# Create a copy of the image.
input_image_plus_copy = input_image_plus.duplicate()
image_processor_copy = input_image_plus_copy.getProcessor()
bit_depth = image_processor_copy.getBitDepth()
analyzer = Analyzer( input_image_plus_copy )

try:
    # Set the conversion options.
コード例 #7
0
import jython_utils
import sys
from ij import IJ
from ij.plugin.filter import Analyzer

# Fiji Jython interpreter implements Python 2.5 which does not
# provide support for argparse.
error_log = sys.argv[ -14 ]
input = sys.argv[ -13 ]
black_background = jython_utils.asbool( sys.argv[ -12 ] )
size = sys.argv[ -11 ]
circularity_min = float( sys.argv[ -10 ] )
circularity_max = float( sys.argv[ -9 ] )
show = sys.argv[ -8 ]
display_results = jython_utils.asbool( sys.argv[ -7 ] )
all_results = jython_utils.asbool( sys.argv[ -6 ] )
exclude_edges = jython_utils.asbool( sys.argv[ -5 ] )
include_holes = jython_utils.asbool( sys.argv[ -4 ] )
tmp_output_path = sys.argv[ -3 ]
output_datatype = sys.argv[ -2 ]
results_path = sys.argv[ -1 ]

# Open the input image file.
input_image_plus = IJ.openImage( input )

# Create a copy of the image.
input_image_plus_copy = input_image_plus.duplicate()
image_processor_copy = input_image_plus_copy.getProcessor()
analyzer = Analyzer( input_image_plus_copy )

try:
                outf.write( '%.3f' % get_euclidean_distance( vertex1, vertex2 ) )
                if calculate_largest_shortest_path:
                    # Keep number of separated items the same for each line.
                    outf.write( '%s %s' % ( sep, sep ) )
                    outf.write( ' %s' % sep )
                    outf.write( ' %s' % sep )
                    outf.write( ' \n' )
                else:
                    outf.write( '\n' )
    outf.close()

# Fiji Jython interpreter implements Python 2.5 which does not
# provide support for argparse.
error_log = sys.argv[ -8 ]
input = sys.argv[ -7 ]
black_background = jython_utils.asbool( sys.argv[ -6 ] )
prune_cycle_method = sys.argv[ -5 ]
prune_ends = jython_utils.asbool( sys.argv[ -4 ] )
calculate_largest_shortest_path = jython_utils.asbool( sys.argv[ -3 ] )
if calculate_largest_shortest_path:
    BASIC_NAMES.extend( [ 'Longest Shortest Path', 'spx', 'spy', 'spz' ] )
    DETAIL_NAMES.extend( [ ' ', ' ', ' ', ' ' ] )
show_detailed_info = jython_utils.asbool( sys.argv[ -2 ] )
output = sys.argv[ -1 ]

# Open the input image file.
input_image_plus = IJ.openImage( input )

# Create a copy of the image.
input_image_plus_copy = input_image_plus.duplicate()
image_processor_copy = input_image_plus_copy.getProcessor()
コード例 #9
0
                if calculate_largest_shortest_path:
                    # Keep number of separated items the same for each line.
                    outf.write('%s %s' % (sep, sep))
                    outf.write(' %s' % sep)
                    outf.write(' %s' % sep)
                    outf.write(' \n')
                else:
                    outf.write('\n')
    outf.close()


# Fiji Jython interpreter implements Python 2.5 which does not
# provide support for argparse.
error_log = sys.argv[-8]
input = sys.argv[-7]
black_background = jython_utils.asbool(sys.argv[-6])
prune_cycle_method = sys.argv[-5]
prune_ends = jython_utils.asbool(sys.argv[-4])
calculate_largest_shortest_path = jython_utils.asbool(sys.argv[-3])
if calculate_largest_shortest_path:
    BASIC_NAMES.extend(['Longest Shortest Path', 'spx', 'spy', 'spz'])
    DETAIL_NAMES.extend([' ', ' ', ' ', ' '])
show_detailed_info = jython_utils.asbool(sys.argv[-2])
output = sys.argv[-1]

# Open the input image file.
input_image_plus = IJ.openImage(input)

# Create a copy of the image.
input_image_plus_copy = input_image_plus.duplicate()
image_processor_copy = input_image_plus_copy.getProcessor()
コード例 #10
0
import sys
import jython_utils
from ij import ImagePlus, IJ
from ij.plugin.filter import Analyzer, MaximumFinder
from ij.process import ImageProcessor
from jarray import array

# Fiji Jython interpreter implements Python 2.5 which does not
# provide support for argparse.
error_log = sys.argv[-10]
input = sys.argv[-9]
scale_when_converting = jython_utils.asbool(sys.argv[-8])
weighted_rgb_conversions = jython_utils.asbool(sys.argv[-7])
noise_tolerance = int(sys.argv[-6])
output_type = sys.argv[-5]
exclude_edge_maxima = jython_utils.asbool(sys.argv[-4])
light_background = jython_utils.asbool(sys.argv[-3])
tmp_output_path = sys.argv[-2]
output_datatype = sys.argv[-1]

# Open the input image file.
input_image_plus = IJ.openImage(input)

# Create a copy of the image.
input_image_plus_copy = input_image_plus.duplicate()
image_processor_copy = input_image_plus_copy.getProcessor()
bit_depth = image_processor_copy.getBitDepth()
analyzer = Analyzer(input_image_plus_copy)

try:
    # Set the conversion options.
import jython_utils
import sys
from ij import IJ

# Fiji Jython interpreter implements Python 2.5 which does not
# provide support for argparse.
error_log = sys.argv[ -7 ]
input = sys.argv[ -6 ]
equalize_histogram = jython_utils.asbool( sys.argv[ -5 ] )
saturated_pixels = sys.argv[ -4 ]
normalize = jython_utils.asbool( sys.argv[ -3 ] )
tmp_output_path = sys.argv[ -2 ]
output_datatype = sys.argv[ -1 ]

# Open the input image file.
input_image_plus = IJ.openImage( input )

# Create a copy of the image.
input_image_plus_copy = input_image_plus.duplicate()
image_processor_copy = input_image_plus_copy.getProcessor()
bit_depth = image_processor_copy.getBitDepth()

# Set the options
options = []
# If equalize_histogram, saturated_pixels and normalize are ignored.
if equalize_histogram:
    options.append( 'equalize' )
else:
    if saturated_pixels not in [ None, 'None' ]:
        # Fiji allows only a single decimal place for this value.
        options.append( 'saturated=%.3f' % float( saturated_pixels ) )
コード例 #12
0
import jython_utils
import sys
from ij import IJ

# Fiji Jython interpreter implements Python 2.5 which does not
# provide support for argparse.
error_log = sys.argv[-10]
input = sys.argv[-9]
threshold_min = float(sys.argv[-8])
threshold_max = float(sys.argv[-7])
method = sys.argv[-6]
display = sys.argv[-5]
black_background = jython_utils.asbool(sys.argv[-4])
# TODO: this is not being used.
stack_histogram = jython_utils.asbool(sys.argv[-3])
tmp_output_path = sys.argv[-2]
output_datatype = sys.argv[-1]

# Open the input image file.
input_image_plus = IJ.openImage(input)

# Create a copy of the image.
input_image_plus_copy = input_image_plus.duplicate()
image_processor_copy = input_image_plus_copy.getProcessor()

try:
    # Convert image to binary if necessary.
    if not image_processor_copy.isBinary():
        # Convert the image to binary grayscale.
        IJ.run(input_image_plus_copy, "Make Binary",
               "iterations=1 count=1 edm=Overwrite do=Nothing")