Suppressing Dialog Box

I basically want a method to suppress the dialog boxes asking for confirmation before performing an operation. (Working on a PlugIn)

A few lines that result in the formation of a dialog box are:

// rm is ROI Manager. temparr is an array of some indexs.
//rm.setSelectedIndexes(temparr);
rm.runCommand("Set Fill Color", "white");
rm.runCommand("Set Color", "black");
rm.runCommand("Set Line Width", "5");

The dialog box asks if I want to apply this to all x selections.

Thanks!

Dear @geekSiddharth,
indeed this behaviour it’s a little annoying also for me.
this is a workaround that I’ve sometimes used: use a for cycle to select roi one by one instead of select multiple indexes:
Something like that:

from ij import IJ
from ij.plugin.frame import RoiManager

rm = RoiManager.getInstance()
if rm != None :
	rm.close();
rm = RoiManager();
imp = IJ.openImage("http://imagej.nih.gov/ij/images/blobs.gif")
imp.show()
imp.setRoi(65,41,55,72)
rm.addRoi(imp.getRoi())
imp.setRoi(55,36,33,31)
rm.addRoi(imp.getRoi())
imp.setRoi(71,118,31,45)
rm.addRoi(imp.getRoi())
imp.setRoi(163,36,27,53)
rm.addRoi(imp.getRoi())

rm.runCommand(imp,"Show None")
rm.runCommand(imp,"Show All")	
for i in range(0,rm.getCount()):
	rm.select(i)
	rm.runCommand("Set Fill Color", "green");
	rm.runCommand(imp,"Deselect");

rm.runCommand(imp,"Show All");

hoping to being helpful,
Emanuele Martini

1 Like