I would expect that VTK statistics classes (e.g., vtkDescriptiveStatistics) can compute these values.