How to get rid of popup screens when plugins are running

Is it possible to open a table without seeing the pop up window for the table? To clarify–when running a plugin I wrote, everything the plugin does flashes across the screen in a series of popups. What can I do to stop this from happening?

Can you post here the code you wrote or pointing out to your code repository?

1 Like

Link to the code repository below. Thanks!

1 Like

Your program is a macro and not a plugin. This makes a great difference. The batch mode prevents all the images from showing up, but there is no way to hide result tables (as far as I know). When using run("Measure"), you can switch to getStatistics(area, mean, min, max, std, histogram) if you are interested in one of the evaluated properties.

In your macro run("Analyze Particles...", ...) needs the results table to present its results. There is no Build-in Macro Function to replace the plugin call. Switching to a script language (e.g. JavaScript) will not help, as ParticleAnalyzer can only save results to a result table.


I disagree here, switching to any full-fledged scripting language would allow you to create a new ResultsTable() that does not interfere with ImageJ’s main results table and can be used in parallel without ever showing it.

1 Like

Thx for correcting my mistake.

Then a possible workflow could be this one (in Python):

from ij import IJ, Prefs
from ij.measure import ResultsTable
from ij.plugin.filter import ParticleAnalyzer

rt = ResultsTable()

imp = IJ.openImage("")
IJ.setAutoThreshold(imp, "Default"), "Convert to Mask", ""), "Analyze Particles...", "exclude")

from ij.gui import WaitForUserDialog
dialog = WaitForUserDialog('Click to show the ResultsTable (Press Esc to cancel).')
if not dialog.escPressed():'Rsult of Analyze Particles on blobs.gif')
1 Like

Did you try calling setBatchMode(true) at the start of your macro? This prevents all the UI elements from updating until the macro is complete.

EDIT: I just saw the following discussion from above:

I never realized that limitation. Maybe @Wayne has an idea to improve matters.

Otherwise, I agree with @imagejan that switching to a script language—while requiring quite a bit of learning—would ultimately alleviate the problem.

@Helen_Zhao As a way to get your toes wet, you can start by using the eval("script", ...) macro function, to execute JavaScript snippets from within your existing macro.

This is a small macro to reproduce the limitation:

run("T1 Head (2.4M, 16-bits)");
for (i = 1; i<nSlices; i++) {

After loading the Stack, the Results window will show up and is updated for each one of the 128 slices.