http://imagej.273.s1.nabble.com/A-problem-with-area-measurements-tp5017237p5017239.html
> > On Sep 25, 2016, at 12:39 PM, Avital Steinberg <
>
[hidden email]> wrote:
> >
> > Hi,
> > I'm having trouble measuring areas of composite Rois in Javascript. When
> I
> > run the following code, I get a strange answer for the area of the
> > composite:
>
> Hi Avital,
>
> This bug is fixed in the latest ImageJ daily build (1.51h2). Here is a
> simpler version of your JavaScript that also reproduces the bug:
>
> ip = new ByteProcessor(2000,2048);
> roi1 = new Roi(324,366,231,120);
> roi2 = new Roi(231,261,549,354);
> shpRoi1 = new ShapeRoi(roi1);
> shpRoi2 = new ShapeRoi(roi2);
> ip.setRoi(shpRoi1);
> IJ.log("The area for shpRo1 is: " + ip.getStatistics().area);
> ip.setRoi(shpRoi2);
> IJ.log("The area for shpRo2 is: " + ip.getStatistics().area);
> shpRoi3 = shpRoi2.not(shpRoi1);
> ip.setRoi(shpRoi3);
> IJ.log("The area for shpRo3 is: " + ip.getStatistics().area);
>
> -wayne
>
>
> > importClass(Packages.ij.IJ);
> > importClass(Packages.ij.plugin.frame.RoiManager);
> > importClass(Packages.ij.ImagePlus);
> > importClass(Packages.ij.process.ImageProcessor);
> > importClass(Packages.ij.gui.Roi);
> > importClass(Packages.ij.gui.ShapeRoi);
> > importPackage(java.awt);
> >
> > rm = RoiManager.getInstance();
> > if (rm==null) rm = new RoiManager();
> > imp = IJ.createImage("Untitled", "8-bit ramp", 2000, 2048, 1);
> > ip = imp.getProcessor();
> > imp.setRoi(324,366,231,120);
> > IJ.run("ROI Manager...", "");
> > rm.addRoi(imp.getRoi());
> > roi1 = imp.getRoi();
> > imp.setRoi(231,261,549,354);
> > rm.addRoi(imp.getRoi());
> > roi2 = imp.getRoi();
> >
> > shpRoi1 = ShapeRoi(roi1);
> > shpRoi2 = ShapeRoi(roi2);
> > rm.addRoi(shpRoi1);
> > rm.addRoi(shpRoi2);
> >
> > imp.show();
> >
> > ip.setRoi(shpRoi1);
> > stats = ip.getStatistics();
> > area = stats.area;
> > IJ.log("The area for shpRo1 is: " + area);
> >
> > ip.setRoi(shpRoi2);
> > stats = ip.getStatistics();
> > area = stats.area;
> > IJ.log("The area for shpRo2 is: " + area);
> >
> > shpRoi3 = shpRoi2.not(shpRoi1);
> > rm.addRoi(shpRoi3);
> > ip.setRoi(shpRoi3);
> > stats = ip.getStatistics();
> > area = stats.area;
> > IJ.log("The area for shpRo3 is: " + area);
> >
> > Selecting the area and using Analyze, measure from the gui gives the
> > results I would expect, but when I try to get the area from the
> > ImageStatistics object, I get the wrong result.
> >
> > When you try to run the code, do you also get a strange result?
> >
> > Thanks,
> > Avital
> >
> > --
> > ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>