class UIService(object): def __init__(self): self.o = ui_service def createUI(self): '''Create the ImageJ UI''' # # This has to be done via a future in order # for CP to run the Mac event loop. # r = J.run_script( """new java.lang.Runnable() { run:function() { uiService.showUI(); } }; """, dict(uiService=self.o)) J.execute_runnable_in_main_thread(r, True) def createUIS(self, arg): '''Create the ImageJ UI with a string argument''' r = J.run_script( """new java.lang.Runnable() { run:function() { uiService.showUI(arg); } }; """, dict(uiService=self.o, arg=arg)) J.execute_runnable_in_main_thread(r, True) isVisible = J.make_method("isVisible", "()Z") getDefaultUI = J.make_method( "getDefaultUI", "()Limagej/ui/UserInterface;", fn_post_process=wrap_user_interface) getUI = J.make_method( "getUI", "(Ljava/lang/String;)Limagej/ui/UserInterface;", fn_post_process=wrap_user_interface)
class CommandService(object): def __init__(self): self.o = command_service run = J.make_method("run", "(Limagej/module/ModuleInfo;Ljava/util/Map;)" "Ljava/util/concurrent/Future;", doc="""Run the command associated with a ModuleInfo Runs the command with pre and post processing plugins. module_info - the ModuleInfo that defines a command inputs - a java.util.map of parameter name to value returns a java.util.concurrent.Future that can be redeemed for the module after the module has been run. """, fn_post_process=J.get_future_wrapper) getCommandS = J.make_method( "getCommand", "(Ljava/lang/String;)Limagej/command/CommandInfo;", doc="""Get command by class name className - dotted class name, e.g. imagej.core.commands.app.AboutImageJ """, fn_post_process=wrap_module_info)
class ModuleInfo(object): def __init__(self, instance): self.o = instance def getInput(self, name): "Gets the input item with the given name." return ModuleItem( J.call(self.o, "getInput", "(Ljava/lang/String;)Limagej/ext/module/ModuleItem;", name)) def getOutput(self, name): "Gets the output item with the given name." return ModuleItem( J.call(self.o, "getOutput", "(Ljava/lang/String;)Limagej/ext/module/ModuleItem;", name)) def getInputs(self): inputs = J.call(self.o, "inputs", "()Ljava/lang/Iterable;") input_iterator = J.call(inputs, "iterator", "()Ljava/util/Iterator;") return [ModuleItem(o) for o in J.iterate_java(input_iterator)] def getOutputs(self): outputs = J.call(self.o, "outputs", "()Ljava/lang/Iterable;") output_iterator = J.call(outputs, "iterator", "()Ljava/util/Iterator;") return [ModuleItem(o) for o in J.iterate_java(output_iterator)] getTitle = J.make_method("getTitle", "()Ljava/lang/String;") createModule = J.make_method("createModule", "()Limagej/ext/module/Module;") getMenuPath = J.make_method("getMenuPath", "()Limagej/ext/MenuPath;")
class Dataset(object): def __init__(self, o=dataset): self.o = o getImgPlus = J.make_method("getImgPlus", "()Lnet/imglib2/img/ImgPlus;") setImgPlus = J.make_method("setImgPlus", "(Lnet/imglib2/img/ImgPlus;)V") getAxes = J.make_method("getAxes", "()[Lnet/imglib2/img/AxisType;") getType = J.make_method("getType", "()Lnet/imglib2/type/numeric/RealType;") isSigned = J.make_method("isSigned", "()Z") isInteger = J.make_method("isInteger", "()Z") getName = J.make_method("getName", "()Ljava/lang/String;") setName = J.make_method("setName", "(Ljava/lang/String;)V") calibration = J.make_method("calibration", "(I)D") setCalibration = J.make_method("setCalibration", "(DI)V") def get_pixel_data(self, axes=None): imgplus = self.getImgPlus() pixel_data = get_pixel_data(imgplus) script = """ var result = java.util.ArrayList(); for (i=0;i<imgplus.numDimensions();i++) result.add(imgplus.axis(i)); result""" inv_axes = J.run_script(script, dict(imgplus=imgplus)) inv_axes = list(J.iterate_collection(inv_axes)) transpose = calculate_transpose(inv_axes, axes) return pixel_data.transpose(transpose)
class ClassList(object): remove_class = jutil.make_method( 'removeClass', '(Ljava/lang/Class;)V', 'Remove the given class from the class list') add_class = jutil.make_method( 'addClass', '(Ljava/lang/Class;)V', 'Add the given class to the back of the class list') get_classes = jutil.make_method( 'getClasses', '()[Ljava/lang/Class;', 'Get the classes in the list as an array') def __init__(self): env = jutil.get_env() class_name = 'loci/formats/ImageReader' klass = env.find_class(class_name) base_klass = env.find_class('loci/formats/IFormatReader') self.o = jutil.make_instance("loci/formats/ClassList", "(Ljava/lang/String;" "Ljava/lang/Class;" # base "Ljava/lang/Class;)V", # location in jar "readers.txt", base_klass, klass) problem_classes = [ # BDReader will read all .tif files in an experiment if it's # called to load a .tif. # 'loci.formats.in.BDReader' ] for problem_class in problem_classes: # Move to back klass = jutil.class_for_name(problem_class) self.remove_class(klass) self.add_class(klass)
class UserInterface(object): def __init__(self): self.o = o show = make_invoke_method("show") isVisible = J.make_method("isVisible", "()Z") getApplicationFrame = J.make_method("getApplicationFrame", "()Limagej/ui/ApplicationFrame;")
class ModuleItem(object): def __init__(self, instance): self.o = instance IV_NORMAL = J.get_static_field("imagej/ext/module/ItemVisibility", "NORMAL", "Limagej/ext/module/ItemVisibility;") IV_TRANSIENT = J.get_static_field( "imagej/ext/module/ItemVisibility", "TRANSIENT", "Limagej/ext/module/ItemVisibility;") IV_INVISIBLE = J.get_static_field( "imagej/ext/module/ItemVisibility", "INVISIBLE", "Limagej/ext/module/ItemVisibility;") IV_MESSAGE = J.get_static_field("imagej/ext/module/ItemVisibility", "MESSAGE", "Limagej/ext/module/ItemVisibility;") WS_DEFAULT = J.get_static_field("imagej/ext/module/ui/WidgetStyle", "DEFAULT", "Limagej/ext/module/ui/WidgetStyle;") WS_NUMBER_SPINNER = J.get_static_field( "imagej/ext/module/ui/WidgetStyle", "NUMBER_SPINNER", "Limagej/ext/module/ui/WidgetStyle;") WS_NUMBER_SLIDER = J.get_static_field( "imagej/ext/module/ui/WidgetStyle", "NUMBER_SLIDER", "Limagej/ext/module/ui/WidgetStyle;") WS_NUMBER_SCROLL_BAR = J.get_static_field( "imagej/ext/module/ui/WidgetStyle", "NUMBER_SCROLL_BAR", "Limagej/ext/module/ui/WidgetStyle;") def getType(self): jtype = J.call(self.o, "getType", "()Ljava/lang/Class;") type_name = J.call(jtype, "getCanonicalName", "()Ljava/lang/String;") if field_mapping.has_key(type_name): return field_mapping[type_name] for class_instance, result in field_class_mapping: if J.call(class_instance, "isAssignableFrom", "(Ljava/lang/Class;)Z", jtype): return result return None getWidgetStyle = J.make_method("getWidgetStyle", "()Limagej/ext/module/ui/WidgetStyle;") getMinimumValue = J.make_method("getMinimumValue", "()Ljava/lang/Object;") getMaximumValue = J.make_method("getMaximumValue", "()Ljava/lang/Object;") getStepSize = J.make_method("getStepSize", "()Ljava/lang/Number;") getColumnCount = J.make_method("getColumnCount", "()I") getChoices = J.make_method("getChoices", "()Ljava/util/List;") getValue = J.make_method( "getValue", "(Limagej/ext/module/Module;)Ljava/lang/Object;") getName = J.make_method("getName", "()Ljava/lang/String;") getLabel = J.make_method("getLabel", "()Ljava/lang/String;") getDescription = J.make_method("getDescription", "()Ljava/lang/String;")
class UIService(object): def __init__(self): self.o = ui_service createUI = make_invoke_method("showUI", doc='''Create the ImageJ UI''') isVisible = J.make_method("isVisible", "()Z") getDefaultUI = J.make_method("getDefaultUI", "()Limagej/ui/UserInterface;", fn_post_process=wrap_user_interface) getUI = J.make_method("getUI", "(Ljava/lang/String;)Limagej/ui/UserInterface;", fn_post_process=wrap_user_interface)
class OverlayService(object): def __init__(self, o=o): self.o = o getOverlays = J.make_method("getOverlays", "()Ljava/util/List;") getDisplayOverlays = J.make_method( "getOverlays", "(Limagej/display/ImageDisplay;)Ljava/util/List;") addOverlays = J.make_method( "addOverlays", "(Limagej/display/ImageDisplay;Ljava/util/List;)V") removeOverlay = J.make_method( "removeOverlay", "(Limagej/display/ImageDisplay;Limagej/data/roi/Overlay;)V") getSelectionBounds = J.make_method( "getSelectionBounds", "(Limagej/display/ImageDisplay;)Limagej/util/RealRect;")
class MyInteger: new_fn = J.make_new("java/lang/Integer", '(I)V') def __init__(self, value): self.new_fn(value) intValue = J.make_method("intValue", '()I')
class OverlayService(object): def __init__(self, o=o): self.o = o getOverlays = J.make_method("getOverlays", "()Ljava/util/List;", fn_post_process=J.get_collection_wrapper) getDisplayOverlays = J.make_method( "getOverlays", "(Limagej/data/display/ImageDisplay;)Ljava/util/List;", fn_post_process=J.get_collection_wrapper) addOverlays = make_invoke_method("addOverlays") removeOverlay = make_invoke_method("removeOverlay") getSelectionBounds = J.make_method( "getSelectionBounds", "(Limagej/data/display/ImageDisplay;)Limagej/util/RealRect;")
class ImageReader(IFormatReader): new_fn = jutil.make_new(class_name, '(Lloci/formats/ClassList;)V') def __init__(self): self.new_fn(class_list.o) getFormat = jutil.make_method( 'getFormat', '()Ljava/lang/String;', 'Get a string describing the format of this file') getReader = jutil.make_method('getReader', '()Lloci/formats/IFormatReader;') def allowOpenToCheckType(self, allow): '''Allow the "isThisType" function to open files For the cluster, you want to tell potential file formats not to open the image file to test if it's their format. ''' if not hasattr(self, "allowOpenToCheckType_method"): self.allowOpenToCheckType_method = None class_wrapper = jutil.get_class_wrapper(self.o) methods = class_wrapper.getMethods() for method in jutil.get_env().get_object_array_elements( methods): m = jutil.get_method_wrapper(method) if m.getName() in ('allowOpenToCheckType', 'setAllowOpenFiles'): self.allowOpenToCheckType_method = m if self.allowOpenToCheckType_method is not None: object_class = env.find_class('java/lang/Object') jexception = jutil.get_env().exception_occurred() if jexception is not None: raise jutil.JavaException(jexception) boolean_value = jutil.make_instance('java/lang/Boolean', '(Z)V', allow) args = jutil.get_env().make_object_array(1, object_class) jexception = jutil.get_env().exception_occurred() if jexception is not None: raise jutil.JavaException(jexception) jutil.get_env().set_object_array_element( args, 0, boolean_value) jexception = jutil.get_env().exception_occurred() if jexception is not None: raise jutil.JavaException(jexception) self.allowOpenToCheckType_method.invoke(self.o, args)
class OMETiffWriter(IFormatWriter): new_fn = jutil.make_new(class_name, '()V') def __init__(self): self.new_fn() setId = jutil.make_method('setId', '(Ljava/lang/String;)V', 'Sets the current file name.') close = jutil.make_method( 'close','()V', 'Closes currently open file(s) and frees allocated memory.') saveBytesIFD = jutil.make_method( 'saveBytes', '(I[BLloci/formats/tiff/IFD;)V', '''save a byte array to an image channel index - image index bytes - byte array to save ifd - a loci.formats.tiff.IFD instance that gives all of the IFD values associated with the channel''')
class Interval(object): def __init__(self, o=interval): self.o = o numDimensions = J.make_method("numDimensions", "()I") min1D = J.make_method( "min", "(I)J", "Retrieve the minimum coordinate for a single dimension") max1D = J.make_method( "max", "(I)J", "Retrieve the maximum coordinate for a single dimension") dimension = J.make_method( "dimension", "(I)J", "Retrieve the number of pixels in the given dimension") def minND(self): return [self.min1D(i) for i in range(self.numDimensions())] def maxND(self): return [self.max1D(i) for i in range(self.numDimensions())] def dimensions(self): return [self.dimension(i) for i in range(self.numDimensions())] # # # # # # # # # # # # # # # # # # Calibrated interval methods # getAxes = J.make_method("getAxes", "()L[net.imglib2.meta.AxisType;") # # minimum and maximum by axis # def minAx(self, axis): '''Get the minimum of the interval along the given axis''' axes = self.getAxes() idx = axes.index(axis) return self.min1D(idx) def maxAx(self, axis): '''Get the maximum of the interval along the given axis''' axes = self.getAxes() idx = axes.index(axis) return self.max1D(idx)
class ObjectService(object): def __init__(self): self.o = o getObjects = J.make_method( "getObjects", "(Ljava/lang/Class;)Ljava/util/List;", doc="""Get all objects of the given class""", fn_post_process=J.get_collection_wrapper)
class ReaderWrapper(IFormatReader): __doc__ = '''A wrapper for %s See http://hudson.openmicroscopy.org.uk/job/LOCI/javadoc/loci/formats/ImageReader.html '''%class_name new_fn = jutil.make_new(class_name, '(Lloci/formats/IFormatReader;)V') def __init__(self, rdr): self.new_fn(rdr) setId = jutil.make_method('setId', '(Ljava/lang/String;)V', 'Set the name of the data file')
class DisplayPanel(object): def __init__(self, o=display_panel): self.o = o getDisplay = J.make_method("getDisplay", "()Limagej/display/Display;") addEventDispatcher = J.make_method( "addEventDispatcher", "(Limagej/display/EventDispatcher;)V") close = J.make_method("close", "()V") makeActive = J.make_method("makeActive", "()V") redoLayout = J.make_method("redoLayout", "()V") setLabel = J.make_method("setLabel", "(Ljava/lang/String;)V") setTitle = J.make_method("setTitle", "(Ljava/lang/String;)V") update = J.make_method("update", "()V")
class WriterWrapper(IFormatWriter): __doc__ = '''A wrapper for %s See http://hudson.openmicroscopy.org.uk/job/LOCI/javadoc/loci/formats/ImageWriter.html '''%class_name new_fn = jutil.make_new(class_name, '(Lloci/formats/IFormatWriter;)V') def __init__(self, writer): self.new_fn(writer) setId = jutil.make_method('setId', '(Ljava/lang/String;)V', 'Sets the current file name.')
class ModuleInfo(object): def __init__(self): self.o = instance getInput = J.make_method( "getInput", "(Ljava/lang/String;)Limagej/module/ModuleItem;", doc = "Gets the input item with the given name.", fn_post_process=wrap_module_item) getOutput = J.make_method( "getOutput", "(Ljava/lang/String;)Limagej/module/ModuleItem;", doc = "Gets the output item with the given name.", fn_post_process=wrap_module_item) getInputs = J.make_method( "inputs", "()Ljava/lang/Iterable;", """Get the module info's input module items""", fn_post_process=lambda iterator: map(wrap_module_item, J.iterate_collection(iterator))) getOutputs = J.make_method( "outputs", "()Ljava/lang/Iterable;", """Get the module info's output module items""", fn_post_process=lambda iterator: map(wrap_module_item, J.iterate_collection(iterator))) getTitle = J.make_method( "getTitle", "()Ljava/lang/String;") createModule = J.make_method( "createModule", "()Limagej/module/Module;", fn_post_process=wrap_module) getMenuPath = J.make_method( "getMenuPath", "()Limagej/MenuPath;") getMenuRoot = J.make_method( "getMenuRoot", "()Ljava/lang/String;") getName = J.make_method("getName", "()Ljava/lang/String;") getClassName = J.make_method("getClassName", "()Ljava/lang/String;")
class Module(object): def __init__(self, o=module): self.o = o getInfo = J.make_method("getInfo", "()Limagej/module/ModuleInfo;") getInput = J.make_method("getInput", "(Ljava/lang/String;)Ljava/lang/Object;") getOutput = J.make_method("getOutput", "(Ljava/lang/String;)Ljava/lang/Object;") setInput = J.make_method("setInput", "(Ljava/lang/String;Ljava/lang/Object;)V") setOutput = J.make_method("setOutput", "(Ljava/lang/String;Ljava/lang/Object;)V") isResolved = J.make_method("isResolved", "(Ljava/lang/String;)Z") setResolved = J.make_method("setResolved", "(Ljava/lang/String;Z)V") setContext = J.make_method("setContext", "(Lorg/scijava/Context;)V") initialize = J.make_method("initialize", "()V")
class ScriptService(object): def __init__(self, o=o): self.o = o getPluginService = J.make_method( "getPluginService", "()Lorg/scijava/plugin/PluginService;") getLogService = J.make_method("getLogService", "()Lorg/scijava/log/LogService;") getIndex = J.make_method("getIndex", "()Limagej/script/ScriptLanguageIndex;") getLanguages = J.make_method( "getLanguages", "()Ljava/util/List;", doc="Return the script engine factories supported by this service", fn_post_process=lambda jlangs: [ wrap_script_engine_factory(o) for o in J.iterate_collection(jlangs) ]) getByFileExtension = J.make_method( "getByFileExtension", "(Ljava/lang/String;)Ljavax/script/ScriptEngineFactory;", fn_post_process=wrap_script_engine_factory) getByName = J.make_method( "getByName", "(Ljava/lang/String;)Ljavax/script/ScriptEngineFactory;", fn_post_process=wrap_script_engine_factory)
class Context(object): def __init__(self): if service_classes is None: classes = None ctxt_fn = J.run_script("""new java.util.concurrent.Callable() { call: function() { return new Packages.imagej.ImageJ(false); } }""") else: classes = [ J.class_for_name(x) for x in service_classes or REQUIRED_SERVICES ] classes = J.make_list(classes) ctxt_fn = J.run_script( """new java.util.concurrent.Callable() { call: function() { return new Packages.imagej.ImageJ(classes); } }""", dict(classes=classes.o)) self.o = J.execute_future_in_main_thread( J.make_future_task(ctxt_fn)) def getService(self, class_name): '''Get a service with the given class name class_name - class name in dotted form returns the class or None if no implementor loaded. ''' klass = J.class_for_name(class_name) return J.call(self.o, 'get', '(Ljava/lang/Class;)Lorg/scijava/service/Service;', klass) getContext = J.make_method("getContext", "()Lorg/scijava/Context;") getVersion = J.make_method("getVersion", "()Ljava/lang/String;") dispose = make_invoke_method("dispose")
class DatasetService(object): def __init__(self, o=o): self.o = o getAllDatasets = J.make_method( "getDatasets", "()Ljava/util/List;", doc = "Get all dataset objects in the context") getDatasets = J.make_method( "getDatasets", "(Limagej/data/display/ImageDisplay)Ljava/util/List;", doc = """Get the datasets linked to a particular image display""") create1 = J.make_method( "create", "([JLjava/lang/String;[Lnet/imglib2/meta/AxisType;IZZ)" "Limagej/data/Dataset;", doc = """Create a dataset with a given bitdepth dims - # of dimensions name - name of dataset axes - the dataset's axis labels bitsPerPixel - dataset's bit depth / precision signed - whether the native type is signed or unsigned floating - whether the native type is floating or integer""", fn_post_process=wrap_dataset) create2 = J.make_method( "create", "(Lnet/imglib2/type/numeric/RealType;[JLjava/lang/String;[Lnet/imglib2/meta/AxisType;)" "Limagej/data/Dataset;", doc = """Create a dataset based on an IMGLIB type type - The type of the dataset. dims - The dataset's dimensional extents. name - The dataset's name. axes - The dataset's dimensional axis labels.""", fn_post_process=wrap_dataset) create3 = J.make_method( "create", "(Lnet/imglib2/img/ImgFactory;" "Lnet/imglib2/type/numeric/RealType;" "[JLjava/lang/String;[Lnet/imglib2/meta/AxisType)" "Limagej/data/Dataset;", doc = """Create a dataset from an IMGLIB image factory factory - The ImgFactory to use to create the data. type - The type of the dataset. dims - The dataset's dimensional extents. name - The dataset's name. axes - The dataset's dimensional axis labels.""", fn_post_process=wrap_dataset) create4 = J.make_method( "create", "Lnet/imglib2/img/ImgPlus;", doc = """Create a dataset wrapped around an ImgPlus""", fn_post_process=wrap_dataset)
class DataView(object): def __init__(self, o=view): self.o = o isCompatible = J.make_method("isCompatible", "(Limagej/data/Data;)Z") initialize = J.make_method("initialize", "(Limagej/data/Data;)V") getData = J.make_method("getData", "()Limagej/data/Data;") getPlanePosition = J.make_method("getPlanePosition", "()Limagej/data/Position;") setSelected = J.make_method("setSelected", "(Z)V") isSelected = J.make_method("isSelected", "()Z") getPreferredWidth = J.make_method("getPreferredWidth", "()I") getPreferredHeight = J.make_method("getPreferredHeight", "()I") update = make_invoke_method("update") rebuild = make_invoke_method("rebuild") dispose = make_invoke_method("dispose")
class Interval(object): def __init__(self, o=interval): self.o = o numDimensions = J.make_method("numDimensions", "()I") min1D = J.make_method( "min", "(I)J", "Retrieve the minimum coordinate for a single dimension") max1D = J.make_method( "max", "(I)J", "Retrieve the maximum coordinate for a single dimension") dimension = J.make_method( "dimension", "(I)J", "Retrieve the number of pixels in the given dimension") def minND(self): return [self.min1D(i) for i in range(self.numDimensions())] def maxND(self): return [self.max1D(i) for i in range(self.numDimensions())] def dimensions(self): return [self.dimension(i) for i in range(self.numDimensions())]
class Dataset(object): def __init__(self, o=dataset): self.o = o getImgPlus = J.make_method("getImgPlus", "()Lnet/imglib2/img/ImgPlus;") setImgPlus = J.make_method("setImgPlus", "(Lnet/imglib2/img/ImgPlus;)V") getAxes = J.make_method("getAxes", "()[Lnet/imglib2/img/Axis;") getType = J.make_method("getType", "()Lnet/imglib2/type/numeric/RealType;") isSigned = J.make_method("isSigned", "()Z") isInteger = J.make_method("isInteger", "()Z") getName = J.make_method("getName", "()Ljava/lang/String;") setName = J.make_method("setName", "(Ljava/lang/String;)V") calibration = J.make_method("calibration", "(I)D") setCalibration = J.make_method("setCalibration", "(DI)V") def get_pixel_data(self, axes=None): imgplus = self.getImgPlus() pixel_data = get_pixel_data(imgplus) inv_axes = J.get_env().get_object_array_elements(self.getAxes()) if axes is None: axes = [Axes().Y, Axes().X] if len(inv_axes) > 2: axes.append(Axes().CHANNEL) transpose = [] for axis in axes: matches = [ i for i, inv_axis in enumerate(inv_axes) if J.call( inv_axis, "equals", "(Ljava/lang/Object;)Z", axis) ] if len(matches) != 1: raise ValueError("No match for %s axis" % J.to_string(axis)) transpose.append(matches[0]) return pixel_data.transpose(transpose)
class DisplayService(object): def __init__(self): self.o = o def createDisplay(self, dataset): '''Create a display that contains the given dataset''' display = J.call( self.o, "createDisplay", "(Limagej/data/Dataset;)Limagej/display/ImageDisplay;", dataset.o) return wrap_display(display) def getActiveDataset(self, display): ds = J.call( self.o, "getActiveDataset", "(Limagej/display/ImageDisplay;)Limagej/data/Dataset;", display.o) return wrap_dataset(ds) def getActiveDisplay(self): return wrap_display( J.call(self.o, "getActiveDisplay", "()Limagej/display/Display;")) def getActiveImageDisplay(self): return wrap_display( J.call(self.o, "getActiveImageDisplay", "()Limagej/display/ImageDisplay;")) setActiveDisplay = J.make_method("setActiveDisplay", "(Limagej/display/Display;)V") getGlobalActiveDatasetView = J.make_method( "getActiveDatasetView", "()Limagej/display/DatasetView;", "Get the active display's active dataset view") getActiveDatasetView = J.make_method( "getActiveDatasetView", "(Limagej/display/ImageDisplay;)Limagej/display/DatasetView;") getDisplays = J.make_method("getDisplays", "()Ljava/util/List;") getImageDisplays = J.make_method("getImageDisplays", "()Ljava/util/List;") getDisplay = J.make_method( "getDisplay", "(Ljava/lang/String;)Limagej/display/Display;") getObjectDisplays = J.make_method( "getDisplays", "(Limagej/data/DataObject;)Ljava/util/List;", "Get all displays attached to a given data object") isUniqueName = J.make_method("isUniqueName", "(Ljava/lang/String;)Z")
class Parameter(object): def __init__(self): self.o = parameter label = J.make_method('label', '()Ljava/lang/String;', 'Label to display in editor') digits = J.make_method( 'digits', '()I', 'Number of digits to display to right of decimal point') columns = J.make_method('columns', '()I', 'Number of columns in edit box') units = J.make_method('units', '()Ljava/lang/String;', 'Units to display to right of edit box') widget = J.make_method('widget', '()Ljava/lang/String;', 'Name of display widget') required = J.make_method( 'required', '()Z', 'True if required, False if default available') persist = J.make_method('persist', '()Ljava/lang/String;', 'Key to use when persisting field value') output = J.make_method( 'output', '()Z', 'True if field is an output parameter, ' 'False if field is an input parameter')
class ImagePlus(object): def __init__(self): self.o = imageplus_obj lockSilently = J.make_method( 'lockSilently', '()Z', '''Locks the image so other threads can test to see if it is in use. Returns true if the image was successfully locked. Beeps, displays a message in the status bar, and returns false if the image is already locked.''') unlock = J.make_method('unlock', '()V', 'Unlocks the image') getBitDepth = J.make_method('getBitDepth', '()I', 'Returns the bit depth: 8, 16, 24 or 32') getBytesPerPixel = J.make_method('getBytesPerPixel', '()I', 'Returns the number of bytes per pixel') getChannel = J.make_method('getChannel', '()I') getChannelProcessor = J.make_method( 'getChannelProcessor', '()Lij/process/ImageProcessor;', 'Returns a reference to the current ImageProcessor.') getCurrentSlice = J.make_method( 'getCurrentSlice', '()I', 'Returns the current stack slice number') def getDimensions(self): 'Returns the dimensions of this image: (width, height, nChannels, nSlices, nFrames)' jresult = J.call(self.o, 'getDimensions', '()[I') return J.get_env().get_int_array_elements(jresult) getFrame = J.make_method('getFrame', '()I') getHeight = J.make_method('getHeight', '()I') getID = J.make_method('getID', '()I') getImageStackSize = J.make_method('getImageStackSize', '()I') getNChannels = J.make_method('getNChannels', '()I', 'Returns the number of channels') getNDimensions = J.make_method('getNDimensions', '()I', 'Returns the number of dimensions') getNFrames = J.make_method('getNFrames', '()I', 'Returns the number of frames (time-points)') getNSlices = J.make_method('getNSlices', '()I', 'Returns the image depth (# of z-slices)') getProcessor = J.make_method('getProcessor', '()Lij/process/ImageProcessor;', 'Returns a reference to the current image processor') getTitle = J.make_method('getTitle', '()Ljava/lang/String;') getWidth = J.make_method('getWidth', '()I') setPosition = J.make_method('setPosition', '(III)V', 'setPosition(channel, slice, frame)') setSlice = J.make_method('setSlice', '(I)V') setTitle = J.make_method('setTitle', '(Ljava/lang/String;)V') show = J.make_method('show', '()V', 'Show the image in an ImageWindow.') show_with_message = J.make_method( 'show', '(Ljava/lang/String;)V', 'Show the image in an ImageWindow. Display the message in the status bar') hide = J.make_method('hide', '()V', 'Hide the ImageWindow associated with this image') getWindow = J.make_method('getWindow', '()Lij/gui/ImageWindow;', 'Get the ImageWindow associated with this image. getWindow() will return null unless you have previously called show()')
class ScriptEngineFactory(object): def __init__(self, o=o): self.o = o getEngineName = J.make_method( "getEngineName", "()Ljava/lang/String;", doc="""Returns the full name of the ScriptEngine. For instance an implementation based on the Mozilla Rhino Javascript engine might return Rhino Mozilla Javascript Engine.""") getEngineVersion = J.make_method("getEngineVersion", "()Ljava/lang/String;") getExtensions = J.make_method( "getExtensions", "()Ljava/util/List;", doc="Get the list of supported filename extensions") getMimeTypes = J.make_method("getMimeTypes", "()Ljava/util/List;") getNames = J.make_method("getNames", "()Ljava/util/List;") getLanguageName = J.make_method("getLanguageName", "()Ljava/lang/String;") getLanguageVersion = J.make_method("getLanguageVersion", "()Ljava/lang/String;") getParameter = J.make_method("getParameter", "(Ljava/lang/String;)Ljava/lang/Object;") getMethodCallSyntax = J.make_method( "getMethodCallSyntax", "(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)" "Ljava/lang/String;") getOutputStatement = J.make_method( "getOutputStatement", "(Ljava/lang/String;)Ljava/lang/String;") getProgram = J.make_method("getProgram", "([Ljava/lang/String;)Ljava/lang/String;") getScriptEngine = J.make_method("getScriptEngine", "()Ljavax/script/ScriptEngine;", fn_post_process=wrap_script_engine)