Get ROI statistics in Javascript?
Posted by
lechristophe on
Jun 14, 2017; 9:24am
URL: http://imagej.273.s1.nabble.com/Get-ROI-statistics-in-Javascript-tp5018887.html
Dear ImageJers,
I'm trying to write a javascript snippet that retrieves a ROI from the ROI
manager, and returns the mean intensity but I can't seem to find out how to
do it.
Here am I so far:
- open a sample image
- draw a ROi on it, store it in the ROI manager
- run this script:
importClass(Packages.ij.IJ);
importClass(Packages.ij.plugin.frame.RoiManager);
importClass(Packages.ij.gui.Roi);
var imp = IJ.getImage();
var rm = RoiManager.getInstance();
var roi = rm.getRoi(0);
roi.setImage(imp);
var stat = roi.getStatistics();
IJ.log(stat.mean);
the "mean" property of the ImageStatistic returned by getStatistics() has a
value of NaN. How come? How to access the roi statistics in a purely
programmatic manner (ie without displaying stuff)?
Thanks for your help,
Christophe
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html