Module ij
Package ij.macro

Class Interpreter

  • All Implemented Interfaces:
    MacroConstants

    public class Interpreter
    extends java.lang.Object
    implements MacroConstants
    This is the recursive descent parser/interpreter for the ImageJ macro language.
    • Field Detail

      • batchMode

        public static boolean batchMode
    • Constructor Detail

      • Interpreter

        public Interpreter()
    • Method Detail

      • run

        public void run​(java.lang.String macro)
        Interprets the specified string.
      • eval

        public java.lang.String eval​(java.lang.String code)
        Evaluates 'code' and returns the output, or any error, as a String.
        See Also:
        Macro.eval(java.lang.String)
      • run

        public void run​(Program pgm)
        Interprets the specified tokenized macro file starting at location 0.
      • run

        public void run​(int location)
        Runs an existing macro starting at the specified program counter location.
      • runMacro

        public void runMacro​(Program pgm,
                             int macroLoc,
                             java.lang.String macroName)
        Interprets the specified tokenized macro starting at the specified location.
      • runBatchMacro

        public ImagePlus runBatchMacro​(java.lang.String macro,
                                       ImagePlus imp)
        Runs Process/Batch/ macros.
      • saveGlobals

        public void saveGlobals​(Program pgm)
        Saves global variables.
      • updateDebugWindow

        public TextWindow updateDebugWindow​(java.lang.String[] variables,
                                            TextWindow debugWindow)
      • abort

        public static void abort()
        Aborts currently running macro.
      • abort

        public static void abort​(Interpreter interp)
        Absolete, replaced by abortMacro().
      • abortMacro

        public void abortMacro()
        Aborts this macro.
      • abort

        public void abort​(java.lang.String message)
      • getInstance

        public static Interpreter getInstance()
      • isBatchMode

        public static boolean isBatchMode()
      • addBatchModeImage

        public static void addBatchModeImage​(ImagePlus imp)
      • removeBatchModeImage

        public static void removeBatchModeImage​(ImagePlus imp)
      • activateImage

        public static void activateImage​(ImagePlus imp)
      • getBatchModeImageIDs

        public static int[] getBatchModeImageIDs()
      • getBatchModeImageCount

        public static int getBatchModeImageCount()
      • getBatchModeImage

        public static ImagePlus getBatchModeImage​(int id)
      • getLastBatchModeImage

        public static ImagePlus getLastBatchModeImage()
      • setAdditionalFunctions

        public static void setAdditionalFunctions​(java.lang.String functions)
        The specified string, if not null, is added to strings passed to the run() method.
      • getAdditionalFunctions

        public static java.lang.String getAdditionalFunctions()
      • getBatchModeRoiManager

        public static RoiManager getBatchModeRoiManager()
        Returns the batch mode RoiManager instance.
      • isBatchModeRoiManager

        public static boolean isBatchModeRoiManager()
        Returns true if there is an internal batch mode RoiManager.
      • setDebugger

        public void setDebugger​(Debugger debugger)
      • getDebugger

        public Debugger getDebugger()
      • setDebugMode

        public void setDebugMode​(int mode)
      • getLineNumber

        public int getLineNumber()
      • getVariables

        public java.lang.String[] getVariables()
        Returns the names of all variables and functions with human-readable annotations
      • getVariableNames

        public java.lang.String[] getVariableNames()
        Returns the names of all variables, without any annotation
      • done

        public boolean done()
      • wasError

        public boolean wasError()
      • setVariable

        public void setVariable​(java.lang.String name,
                                double value)
      • setVariable

        public void setVariable​(java.lang.String name,
                                java.lang.String str)
      • getVariable

        public double getVariable​(java.lang.String name)
      • getVariable2

        public double getVariable2​(java.lang.String name)
      • getStringVariable

        public java.lang.String getStringVariable​(java.lang.String name)
      • getVariableAsString

        public java.lang.String getVariableAsString​(java.lang.String name)
      • showArrayInspector

        public void showArrayInspector​(int row)
        Shows array elements after clicking an array variable in Debug window N. Vischer
        Parameters:
        row - Debug window row of variable to be shown
      • updateArrayInspector

        public void updateArrayInspector()
        Updates Array inspector if variable exists, otherwise closes ArrayInspector
      • nonBatchMacroRunning

        public static boolean nonBatchMacroRunning()
      • setApplyMacroTable

        public void setApplyMacroTable​(ResultsTable rt)
      • setIgnoreErrors

        public void setIgnoreErrors​(boolean ignoreErrors)
      • getErrorMessage

        public java.lang.String getErrorMessage()