I am writing a script in imageJ macro language to process some images that where taken in different light conditions. Some steps require require manual intervention, in particular to decide if they should be performed at all (based on the previews) and to set thresholds. I would like to document what is done with each image when they are processed and save it on a file. Namely, I would like to have something similar to the plugin Plugin>Macro>Record… when performing these operations as they are called from the macro. The probelm is that the Record… plugin seems to work only when one selects the different operations by hand, from the menus, but not when the same are called by a macro.
In the example below, e.g. I call the Brightness adjustment plugin, then I set by hand the threholds if brightness adjustment is needed, then I subtract the background and apply gamma filter (if necessary) and finally threshold. I would like to be able to do the following:
- storing/recovering the information on threshold for the Brightness/Contrast plugin, on method and threshold for Threshold, on the rolling ball radius (+ the other settings) for the Subtract background, on the value of the gamma, etc…
2 storing/recovering the information that I skipped some of those steps when that is the case (e.g. if Brightness adjustment was not required), both when a ‘cancel’ button is present in the plugin interface (in the “Subtract background” plugin) and when it is not (in the “Brightness/Contrast plugin”). I know there is a java method called wasCanceled that can be used in dialog windows, but I have no idea of how this can be accessessed from a ijm macro calling these plugins (I have no experience with java at all)
//Enhance contrast if necessary
waitForUser(“Adjust brightness. Press OK to continue”);
run(“Apply LUT”, “stack”);
//Subtract background (rolling ball) if necessary
Any suggestion is more than welcome!