Greetings,

I am trying to do ImageStastics on the Roi(s) found by Analyze
Particles... (see below). I am getting weird results. Since only the AREA
is being requested, I would assume that each attempt should give the same
answer; baring NaN(s) and thresholds - albeit results do not correlate.

see code/data below:
1) tmpimp is passed to Analyze particles, and is a duplicate of cimp with
a few more NaN(s) and a threshold set.
2) The roi(s) in my ResultsTable match that produced by Analyze Particles,
noted by the roi.getStastics (rS) and direct calculation of the areas
(area).
3) The ImageStastics calculated (AREA,AREAt,Areat,Area) do not seem to
follow a logical correlated pattern; note NaN(s) and Threshold shouldn't
(but might) subtract from the area.
4) pixelWidth and pixelHeight are 0.89...

I assume that I am doing something extremely stupid, as each of these
attempts seem like they should work equivalently and correctly. So, how
should I be getting the statistics for these ROI(s)? Note that the intent
is not limited to the image passed to Analyze Particles, e.g., getting
statistics from related images. Also, if the results I am getting are in
some way legit, why are they???

Thanks in advance,

Fred


First 5 lines on Analyze Particle...'s ResultsTable:
Label\tArea\tMean\tStdDev\tMin\tMax
DUP_(RIMB\d\d)|(MEMC\d\d)|(WMFTIH\d\d):b = 0,z =
-75.60  14.529  0.254   0.056   0.205   0.394
DUP_(RIMB\d\d)|(MEMC\d\d)|(WMFTIH\d\d):b = 0,z =
-75.60  3.229   0.233   0.004   0.228   0.239
DUP_(RIMB\d\d)|(MEMC\d\d)|(WMFTIH\d\d):b = 0,z =
-75.60  3.229   0.253   0.028   0.219   0.286
DUP_(RIMB\d\d)|(MEMC\d\d)|(WMFTIH\d\d):b = 0,z =
-75.60  89.598  0.404   0.080   0.206   0.579
DUP_(RIMB\d\d)|(MEMC\d\d)|(WMFTIH\d\d):b = 0,z =
-75.60  9.686   0.256   0.041   0.211   0.317

First 5 lines of my ResultsTable:
Label\tname\trS\tAREA\tAreat\tArea\tAreat\tarea
0       0003-0001-0093  14.529  25.830  0       12977.193       3311.900        
14.529
1       0003-0002-0092  3.229   4.843   0       12977.193       3311.900        
3.229
2       0003-0003-0095  3.229   4.843   0       12977.193       3311.900        
3.229
3       0003-0004-0110  89.598  199.376 0       12977.193       3311.900        
89.598
4       0003-0005-0107  9.686   11.301  0       12977.193       3311.900        
9.686

code:
      ImagePlus tmpimp = cimp.duplicate();
// set some voxels to NaN ...
      tmpimp.show();
      tmpimp.changes = false;
      IJ.setThreshold(tmpimp, 0.20, 1);

      RoiManager rm = showRM ? RoiManager.getRoiManager() : new
RoiManager(true);
      if (!showRM) ParticleAnalyzer.setRoiManager(rm);
      String size =
String.format("size=%.2f",minArea)+"-"+(Double.isInfinite(maxArea)?"Infinity":String.format("%.2f",maxArea));
      IJ.run(tmpimp, "Analyze Particles...", size+" show=Outlines display
include overlay add stack");

      Calibration cal = tmpimp.getCalibration();
      ResultsTable rt = new ResultsTable();
      Roi[] rois = rm.getRoisAsArray();
      for(int i=0; i<rois.length; i++) {
         rt.addRow();
         rt.addLabel(""+i);
         rt.addValue("name", rois[i].getName());

         cimp.setRoi(rois[i]);
         tmpimp.setRoi(rois[i]);

         ImageStatistics rS = rois[i].getStatistics();
         rt.addValue("rS", rS.area * cal.pixelWidth * cal.pixelHeight);

         ImageProcessor cip = cimp.getProcessor();
         ImageStatistics rs = ImageStatistics.getStatistics&#8203;(cip,
Measurements.AREA, cal);
         rt.addValue("AREA", rs.area);

         ImageProcessor ctip = tmpimp.getProcessor();
         ImageStatistics rst = ImageStatistics.getStatistics&#8203;(ctip,
Measurements.AREA, cal);
         rt.addValue("AREAt", rst.area);

         ImageProcessor cip2 =
cimp.getStack().getProcessor(rois[i].getPosition());
         ImageStatistics rs2 = ImageStatistics.getStatistics&#8203;(cip2,
Measurements.AREA, cal);
         rt.addValue("Area", rs2.area);

         ImageProcessor ctip2 =
tmpimp.getStack().getProcessor(rois[i].getPosition());
         ImageStatistics rst2 =
ImageStatistics.getStatistics&#8203;(ctip2, Measurements.AREA,
cal);
         rt.addValue("Areat", rst2.area);

         rt.addValue("area", rois[i].getContainedPoints().length *
cal.pixelWidth * cal.pixelHeight);
         }

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

Reply via email to