No plot Z profile Live button activation in a macro

I’d like to raise the plotZprofile in live mode from a macro, but the ‘Live’ button doesn’t seem to be callable from a macro. Anybody know how???


1 Like


According to an older imagej listserv exchange - it should be possible to do. What version of ImageJ 1 are you running? Just to be sure this is not the issue…

Thanks etarena

I get the button, I just can’t click it programmatically. e.g. launch in live mode. I have to click the button manually…


As a workaround you can use the IJ Robot class (from the macro) to simulate the mouse click to actvate live plotting, see:

1 Like

Thanks et

This is a great help. It solves my current problem and offers a great way to write code verification test scripts for regression QC testing. I had no idea what IJ Robot did.

Thanks a lot

OOps looks like Bio7 was the source of the recommendation to use IJRobot…I can’t find the plugin (class file) for it. I checked GitHub and the plugins at IJ. Would you please post a link.

Thanks again


I found it. Thanks again

For others interested in the topic, it might be useful to post the link here:

As an alternative to the IJ Robot workaround, you can also use a more powerful scripting language such as Groovy to enable live profiling of your plot window, as illustrated in this script:

import ij.WindowManager

plotWindow = WindowManager.getWindow("Plot of result")

… or if you want to create the plot in the same script:

#@ ImagePlus imp

import ij.gui.ProfilePlot
import ij.plugin.Profiler

profilePlot = new ProfilePlot(imp)
plot = profilePlot.getPlot()
plotMaker = new Profiler()
plotMaker.imp = imp
window =

Important note: the above works because Groovy ignores Java’s private scope when calling methods from Java objects. Since you’re calling private API here, there’s no guarantee that this script will work with a future release of ij.jar.
If you think a public access to the toggleLiveProfiling() or enableLivePlot() method would be useful for your application, it might be better to ask @Wayne directly if he wants to implement this change, or if there’s a better way to enable live plotting.