java.lang.Object
ij.macro.Interpreter
- All Implemented Interfaces:
MacroConstants
This is the recursive descent parser/interpreter for the ImageJ macro language.
-
Field Summary
FieldsFields inherited from interface ij.macro.MacroConstants
ABS, ACOS, ARRAY, ARRAY_FUNC, ARRAY_FUNCTION, arrayFunctionIDs, arrayFunctions, ASIN, ATAN, ATAN2, AUTO_UPDATE, BEEP, BIT_DEPTH, BREAK, CALCULATOR, CALIBRATE, CALL, CHANGE_VALUES, CHAR_CODE_AT, CLOSE, COLOR, CONTINUE, COS, D2S, DEBUG, DIALOG, DIV_EQUAL, DO, DO_COMMAND, DO_WAND, DRAW_LINE, DRAW_OVAL, DRAW_RECT, DRAW_STRING, DUMP, ELSE, ENDS_WITH, EOF, EQ, EVAL, EXEC, EXIT, EXP, EXT, FALSE, FILE, FILL, FILL_OVAL, FILL_RECT, FIT, FLOOD_FILL, FLOOR, FOR, FROM_CHAR_CODE, FUNCTION, functionIDs, functions, GET_ARGUMENT, GET_BOOLEAN, GET_BOUNDING_RECT, GET_BOUNDS, GET_COORDINATES, GET_COUNT, GET_CURSOR_LOC, GET_DATE_AND_TIME, GET_DIMENSIONS, GET_DIR, GET_DIRECTORY, GET_DISPLAYED_AREA, GET_FILE_LIST, GET_FONT_LIST, GET_HEIGHT, GET_HISTOGRAM, GET_ID, GET_IMAGE_INFO, GET_INFO, GET_LINE, GET_LIST, GET_LOCATION_AND_SIZE, GET_LUT, GET_METADATA, GET_MIN_AND_MAX, GET_NUMBER, GET_PIXEL, GET_PIXEL_SIZE, GET_PROFILE, GET_RAW_STATISTICS, GET_RESULT, GET_RESULT_LABEL, GET_RESULT_STRING, GET_SLICE_NUMBER, GET_STATISTICS, GET_STRING, GET_STRING_WIDTH, GET_THRESHOLD, GET_TIME, GET_TITLE, GET_VALUE, GET_VERSION, GET_VOXEL_SIZE, GET_WIDTH, GET_ZOOM, GT, GTE, IF, IJ_CALL, IMAGE, INDEX_OF, INVERT, IS, IS_ACTIVE, IS_KEY_DOWN, IS_NAN, IS_OPEN, keywordIDs, keywords, LAST_INDEX_OF, LENGTH_OF, LINE_TO, LIST, LOG, LOGICAL_AND, LOGICAL_OR, LT, LTE, MACRO, MAKE_ARROW, MAKE_ELLIPSE, MAKE_LINE, MAKE_OVAL, MAKE_POINT, MAKE_POLYGON, MAKE_RECTANGLE, MAKE_ROTATED_RECT, MAKE_SELECTION, MAKE_TEXT, MATCHES, MATH, MAX_OF, MIN_OF, MINUS_EQUAL, MINUS_MINUS, MOVE_TO, MUL_EQUAL, NaN, NEQ, NEW_ARRAY, NEW_IMAGE, NEW_MENU, NIMAGES, NOP, NRESULTS, NSLICES, NUMBER, NUMERIC_FUNCTION, numericFunctionIDs, numericFunctions, OPEN, OVERLAY, PARSE_FLOAT, PARSE_INT, PI, PLOT, PLUS_EQUAL, PLUS_PLUS, POW, PREDEFINED_FUNCTION, PRINT, PROPERTY, PUT_PIXEL, RANDOM, RENAME, REPLACE, REQUIRES, RESET, RESET_MIN_MAX, RESET_THRESHOLD, RESTORE_PREVIOUS_TOOL, RESTORE_SETTINGS, RETURN, ROI, ROI_MANAGER, ROI_MANAGER2, ROUND, RUN, RUN_MACRO, SAVE, SAVE_AS, SAVE_SETTINGS, SCREEN_HEIGHT, SCREEN_WIDTH, SELECT, SELECT_IMAGE, SELECTION_CONTAINS, SELECTION_NAME, SELECTION_TYPE, SET_AUTO_THRESHOLD, SET_BACKGROUND, SET_BATCH_MODE, SET_COLOR, SET_FONT, SET_FOREGROUND, SET_JUSTIFICATION, SET_KEY_DOWN, SET_LINE_WIDTH, SET_LOCATION, SET_LUT, SET_METADATA, SET_MIN_MAX, SET_OPTION, SET_PASTE_MODE, SET_PIXEL, SET_RESULT, SET_RGB_WEIGHTS, SET_SELECTION_LOC, SET_SELECTION_NAME, SET_SLICE, SET_THRESHOLD, SET_TOOL, SET_VOXEL_SIZE, SET_Z_COORDINATE, SETUP_UNDO, SHIFT_LEFT, SHIFT_RIGHT, SHOW_MESSAGE, SHOW_MESSAGE_WITH_CANCEL, SHOW_PROGRESS, SHOW_STATUS, SHOW_TEXT, SIN, SNAPSHOT, SPLIT, SQRT, STACK, STARTS_WITH, STRING, STRING_CONSTANT, STRING_FUNCTION, stringFunctionIDs, stringFunctions, SUBSTRING, TABLE, TAN, TO_BINARY, TO_HEX, TO_LOWER_CASE, TO_SCALED, TO_STRING, TO_UNSCALED, TO_UPPER_CASE, TOK_MASK, TOK_SHIFT, TOOL_ID, TRIM, TRUE, UPDATE_DISPLAY, UPDATE_RESULTS, USER_FUNCTION, VAR, VARIABLE_FUNCTION, variableFunctionIDs, variableFunctions, WAIT, WAIT_FOR_USER, WHILE, WORD, WRITE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
abort()
Aborts currently running macro.static void
abort
(Interpreter interp) Absolete, replaced by abortMacro().void
void
Aborts this macro.static void
activateImage
(ImagePlus imp) static void
boolean
done()
Evaluates 'code' and returns the output, or any error, as a String.static String
static ImagePlus
getBatchModeImage
(int id) static int
static int[]
static RoiManager
Returns the batch mode RoiManager instance.static Interpreter
static ImagePlus
int
getStringVariable
(String name) double
getVariable
(String name) double
getVariable2
(String name) getVariableAsString
(String name) String[]
Returns the names of all variables, without any annotationString[]
Returns the names of all variables and functions with human-readable annotationsstatic boolean
static boolean
Returns true if there is an internal batch mode RoiManager.static boolean
static void
void
run
(int location) Runs an existing macro starting at the specified program counter location.void
Interprets the specified tokenized macro file starting at location 0.void
Interprets the specified string.Runs the specified macro, passing it a string argument and returning a string value.runBatchMacro
(String macro, ImagePlus imp) Runs Process/Batch/ macros.void
Interprets the specified tokenized macro starting at the specified location.void
saveGlobals
(Program pgm) Saves global variables.static void
setAdditionalFunctions
(String functions) The specified string, if not null, is added to strings passed to the run() method.void
void
setDebugger
(Debugger debugger) void
setDebugMode
(int mode) void
setIgnoreErrors
(boolean ignoreErrors) void
setVariable
(String name, double value) void
setVariable
(String name, String str) void
showArrayInspector
(int row) Shows array elements after clicking an array variable in Debug window N.void
Updates Array inspector if variable exists, otherwise closes ArrayInspectorupdateDebugWindow
(String[] variables, TextWindow debugWindow) boolean
wasError()
-
Field Details
-
batchMode
public static boolean batchMode
-
-
Constructor Details
-
Interpreter
public Interpreter()
-
-
Method Details
-
run
Interprets the specified string. -
run
Runs the specified macro, passing it a string argument and returning a string value. -
eval
Evaluates 'code' and returns the output, or any error, as a String.- See Also:
-
run
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
Interprets the specified tokenized macro starting at the specified location. -
runBatchMacro
Runs Process/Batch/ macros. -
saveGlobals
Saves global variables. -
updateDebugWindow
-
abort
public static void abort()Aborts currently running macro. -
abort
Absolete, replaced by abortMacro(). -
abortMacro
public void abortMacro()Aborts this macro. -
abort
-
getInstance
-
isBatchMode
public static boolean isBatchMode() -
addBatchModeImage
-
removeBatchModeImage
-
activateImage
-
getBatchModeImageIDs
public static int[] getBatchModeImageIDs() -
getBatchModeImageCount
public static int getBatchModeImageCount() -
getBatchModeImage
-
getLastBatchModeImage
-
setAdditionalFunctions
The specified string, if not null, is added to strings passed to the run() method. -
getAdditionalFunctions
-
getBatchModeRoiManager
Returns the batch mode RoiManager instance. -
isBatchModeRoiManager
public static boolean isBatchModeRoiManager()Returns true if there is an internal batch mode RoiManager. -
setDebugger
-
getDebugger
-
setDebugMode
public void setDebugMode(int mode) -
getLineNumber
public int getLineNumber() -
getVariables
Returns the names of all variables and functions with human-readable annotations -
getVariableNames
Returns the names of all variables, without any annotation -
done
public boolean done() -
wasError
public boolean wasError() -
setVariable
-
setVariable
-
getVariable
-
getVariable2
-
getStringVariable
-
getVariableAsString
-
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
-
setIgnoreErrors
public void setIgnoreErrors(boolean ignoreErrors) -
getErrorMessage
-