Skip to content

Commit ed07178

Browse files
committed
fix(vtkimagedata.computehistogram): incorrect value of variance/sigma
Corrected the equation for variance which also leads to correct value of standard deviation (sigma).
1 parent 328af12 commit ed07178

File tree

1 file changed

+3
-1
lines changed
  • Sources/Common/DataModel/ImageData

1 file changed

+3
-1
lines changed

Sources/Common/DataModel/ImageData/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,9 @@ function vtkImageData(publicAPI, model) {
410410
}
411411

412412
const average = inum > 0 ? isum / inum : 0;
413-
const variance = sumOfSquares - average * average;
413+
const variance = inum
414+
? Math.abs(sumOfSquares / inum - average * average)
415+
: 0;
414416
const sigma = Math.sqrt(variance);
415417

416418
return {

0 commit comments

Comments
 (0)