> I need to get the area of FreeRois programatically (not through the
> ImageJ GUI) and have spent a few hours on this without any luck.
> I would expect that the Roi class would have a method like
> 'getArea()'...
> after all, it has getFeretsDiameter() ;-)
>
> I looked through the JavaDocs, the ImageJ forum, and googled
> around a bit with no luck.
>
> I walked through the code starting with the 'Measure' button on the
> RoiManager and soon found myself in pluging country with somebody
> calling Executer.run( "Measure");
>
> I feel there has to be simpler way that I am just missing. Can
> anybody give me a hand here?
Here a two ways to get the area of a selection in a plugin:
ImagePlus img = IJ.getImage();
double area1 = img.getStatistics().area;
ImageProcessor ip = img.getProcessor();
ip.setRoi(img.getRoi());
ImageStatistics stats = ImageStatistics.getStatistics(ip,
Measurements.MEAN, img.getCalibration());
double area2 = stats.area;
-wayne