Login  Register

Re: Measurements Error?

Posted by Nathaniel Ryckman on Jun 13, 2011; 6:52pm
URL: http://imagej.273.s1.nabble.com/Measurements-Error-tp3684281p3684282.html

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);"

Nathaniel Ryckman wrote
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
---------------------------------------