Module ij
Package ij.macro

Class Interpreter

java.lang.Object
ij.macro.Interpreter
All Implemented Interfaces:
MacroConstants

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

    • batchMode

      public static boolean batchMode
  • Constructor Details

    • Interpreter

      public Interpreter()
  • Method Details

    • run

      public void run(String macro)
      Interprets the specified string.
    • run

      public String run(String macro, String arg)
      Runs the specified macro, passing it a string argument and returning a string value.
      See Also:
    • eval

      public String eval(String code)
      Evaluates 'code' and returns the output, or any error, as a String.
      See Also:
    • 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, String macroName)
      Interprets the specified tokenized macro starting at the specified location.
    • runBatchMacro

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

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

      public TextWindow updateDebugWindow(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(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(String functions)
      The specified string, if not null, is added to strings passed to the run() method.
    • getAdditionalFunctions

      public static 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 String[] getVariables()
      Returns the names of all variables and functions with human-readable annotations
    • getVariableNames

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

      public boolean done()
    • wasError

      public boolean wasError()
    • setVariable

      public void setVariable(String name, double value)
    • setVariable

      public void setVariable(String name, String str)
    • getVariable

      public double getVariable(String name)
    • getVariable2

      public double getVariable2(String name)
    • getStringVariable

      public String getStringVariable(String name)
    • getVariableAsString

      public String getVariableAsString(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 String getErrorMessage()