Why are these measurement values different?
Programmatically: name: 0114-0114 area: 2590.0 mean: 15.083397683397683 stdDev: 17.46720135718284 mode: 3 min: 1.0 max: 71.0 xCentroid: 114.0 yCentroid: 796.5 xCenterOfMass: 114.1301131418625 yCenterOfMass: 803.6518711923411 --------------------------------------- Using Menu (Results Table): Label : 0114-0114 Area : 1855 Mean : 20.41 StdDev: 18.054 Mode : 3 Min: 2 Max: 71 X: 113.961 Y: 799.574 XM: 114.087 YM: 804.086 --------------------------------------- The following is the code I used. I obtained the Results Table measurements (using the imageJ menu) by using the Roi's generated by the program. int measurements = AREA+MEAN+STD_DEV+MODE+MIN_MAX+ CENTROID+CENTER_OF_MASS+PERIMETER+RECT+ ELLIPSE+SHAPE_DESCRIPTORS+FERET+INTEGRATED_DENSITY+ MEDIAN+SKEWNESS+KURTOSIS+AREA_FRACTION; RoiManager rm = RoiManager.getInstance(); if(rm == null) rm = new RoiManager(); for(int j = 0; j < dapiRois.size(); j++) { o.add(dapiRois.get(j)); rm.addRoi(dapiRois.get(j)); imp.setRoi(dapiRois.get(j)); ImageStatistics stats = ImageStatistics.getStatistics(imp.getProcessor(), measurements, imp.getCalibration()); IJ.log("name: " + rm.getList().getItem(j)); IJ.log("area: " + stats.area); IJ.log("mean: " + stats.mean); IJ.log("stdDev: " + stats.stdDev); IJ.log("mode: " + stats.mode); IJ.log("min: " + stats.min); IJ.log("max: " + stats.max); IJ.log("xCentroid: " + stats.xCentroid); IJ.log("yCentroid: " + stats.yCentroid); IJ.log("xCenterOfMass: " + stats.xCenterOfMass); IJ.log("yCenterOfMass: " + stats.yCenterOfMass); IJ.log("---------------------------------------"); } imp.setOverlay(o); |
Just in case anyone wants to know, the imageJ Measure Button uses a pipeline like this:
1) Analyzer class 2) ImagePlus.getStatistics(int mOptions) 3) ImageStatistics The 2nd step of the pipeline modifies the image processor and its histogram; thus, if you try to only use the 3rd step of the pipeline like this "ImageStatistics stats = ImageStatistics.getStatistics(imp.getProcessor(), measurements, imp.getCalibration());" you will possibly get DIFFERENT results than from what you would get if you had pushed the imageJ Measure Button. If you want to simulate the imageJ Measure Button in a custom plugin, ONLY use this command: "ImageStatistics stats = imp.getStatistics(measurements);"
|
Free forum by Nabble | Edit this page |