calculateMoments() is not limited by histMin & histMax

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

calculateMoments() is not limited by histMin & histMax

Hidenao IWAI
Dear all,

I found discrepancy codes between getStatistics() and calculateMoments() in FloatStatistics.java
In getStatistics function, mean (also called the first-order moment) is calculated in the range of histMin/Max and min/maxTreshold. On the other hand, in cacluateMoments function other higher order moments (variance,  skewness, kurtosis) are calculated in the range of max/minThreshold. In addtion, those higher order-moments are calculated based on mean value which is limited by histMin/Max.

Is there any reason why you coded the source codes for two functions in this way?

Best regards,
Hidenao Yamada

calculateMoments()
> double mean2 = mean*mean;
> double variance = sum2/pixelCount - mean2;
> double sDeviation = Math.sqrt(variance);
> skewness = ((sum3 - 3.0*mean*sum2)/pixelCount + 2.0*mean*mean2)/(variance*sDeviation);
> kurtosis = (((sum4 - 4.0*mean*sum3 + 6.0*mean2*sum2)/pixelCount - 3.0*mean2*mean2)/(variance*variance)-3.0);

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