Run macro on objects
Run a specific ImageJ macro once per object from a specified input object collection (as opposed to the "Run macro" module, which runs once per analysis run).
Description
Run a specific ImageJ macro once per object from a specified input object collection (as opposed to the "Run macro" module, which runs once per analysis run). This module can optionally open an image into ImageJ for the macro to run on. Variables assigned during the macro can be extracted and stored as measurements associated with the current object.
Note: ImageJ can only run one macro at a time, so by using this module the "Simultaneous jobs" parameter of the "Input control" module must be set to 1.
Note: When this module runs, all windows currently open in ImageJ will be automatically hidden, then re-opened upon macro completion. This is to prevent accidental interference while the macro is running. It also allows the macro to run much faster (batch mode). To keep images open while the macro is running (for example, during debugging) start the macro with the command "setBatchMode(false)".
Parameters
Parameter | Description |
---|---|
Add variable | Pre-define variables, which will be immediately accessible within the macro. These can be used to provide user-controllable values to file-based macros or to prevent the need for editing macro code via the "Run macro on objects" panel. |
Variable type | Controls the data type of the variable that will be assigned within the macro:
|
Variable name | The variable value can be accessed from within the macro by using this variable name. |
Variable checkbox | Boolean (true/false) value assigned to this variable if "Variable type" is set to "Boolean". |
Variable numeric value | Numeric value assigned to this variable if "Variable type" is set to "Number". |
Variable text value | Text value assigned to this variable if "Variable type" is set to "Text". |
Input objects | The specified macro will be run once on each of the objects from this object collection. No information (e.g. assigned variables) is transferred between macro runs. |
Provide input image | When selected, a specified image from the workspace will be opened prior to running the macro. This image will be the "active" image the macro runs on. |
Input image | If "Provide input image" is selected, this is the image that will be loaded into the macro. A duplicate of this image is made, so the image stored in the workspace will not be affected by any processing in the macro. |
Update image after each run | When selected (and "Provide input image" is also selected), the input image will be updated to the currently-active image at the end of each iteration. This allows all object runs for a macro to alter the input image.. |
Macro mode | Select the source for the macro code:
|
Macro text | Macro code to be executed. MIA macro commands are enabled using the "run("Enable MIA Extensions");" command which is included by default. This should always be the first line of a macro if these commands are needed. |
Macro file | Select a macro file (.ijm) to be run by this module. As with the "Macro text" parameter, this macro should start with the "run("Enable MIA Extensions");" command. |
Intercept variable as measurement | This allows variables assigned in the macro to be stored as measurements associated with the current object. |
Variable | Variable assigned in the macro to be stored as a measurement associated with the current object. This name must exactly match (including case) the name as written in the macro. |