Headless execution of RoiManager(true) gives exception

Posted by Paul van Schayck on
URL: http://imagej.273.s1.nabble.com/Headless-execution-of-RoiManager-true-gives-exception-tp5008274.html

Dear all,

I'll continue sending in some reports regarding headless execution if
that's all right with you?

I'm trying to get the ROIs directly out of the ParticleAnalyzer
results. Consider the following script:

imp = IJ.openImage(path);
IJ.run(imp, "8-bit", "");
IJ.setThreshold(imp, 50, 150);

var table = ResultsTable()
var pa = ParticleAnalyzer(ParticleAnalyzer.ADD_TO_MANAGER,Measurements.CENTER_OF_MASS,
table, 100, Number.POSITIVE_INFINITY,0.1, 1.0)

var manager = new RoiManager(true)
pa.setRoiManager(manager)
pa.analyze()

return manager.getRoisAsArray()

This will give the following exception:
sun.org.mozilla.javascript.internal.WrappedException: Wrapped
java.awt.HeadlessException (<Unknown source>#24) in <Unknown source>at
line number 24

The true in the constructor of RoiManager should keep the window
hidden, but nevertheless throws this HeadlessException. A workaround
is to use doWand() on the center of mass results of the
ParticleAnalyzer, but that's less than optimal.

Thank you,

Paul

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html