Class StatisticsHelper

java.lang.Object
qupath.lib.analysis.stats.StatisticsHelper

public class StatisticsHelper extends Object
Static methods for computing statistics from images, with or without a corresponding labeled image.
Author:
Pete Bankhead
  • Constructor Details

    • StatisticsHelper

      public StatisticsHelper()
  • Method Details

    • computeRunningStatistics

      public static RunningStatistics computeRunningStatistics(SimpleImage img)
      Compute running statistics using all pixels from a SimpleImage.
      Parameters:
      img -
      Returns:
    • updateRunningStatistics

      public static void updateRunningStatistics(RunningStatistics stats, SimpleImage img)
      Add all pixels from a SimpleImage to an existing RunningStatistics object.
      Parameters:
      stats -
      img -
    • createRunningStatisticsList

      public static List<RunningStatistics> createRunningStatisticsList(int n)
      Create a list of n (empty) RunningStatistics objects.
      Parameters:
      n -
      Returns:
    • computeRunningStatistics

      public static RunningStatistics computeRunningStatistics(double[] values)
      Create a RunningStatistics object using all the values from a specified array.
      Parameters:
      values -
      Returns:
    • computeRunningStatistics

      public static void computeRunningStatistics(SimpleImage img, SimpleImage imgLabels, List<RunningStatistics> statsList)
      Calculate RunningStatistics for each label > 0 in an image, up to a maximum of statsList.size().

      The statistics for pixels in img corresponding to integer value label in imgLabels are stored within statsList.get(label-1).

      Parameters:
      img -
      imgLabels -
      statsList -
    • getQuartiles

      public static double[] getQuartiles(double[] scores)
      Determine thresholds for dividing an array of double values into quartiles.

      NaNs are effectively removed first, however the input array is left unchanged so there is no need to duplicate it first (i.e. it is duplicated within this method anyway).

      Depending upon the number of non-NaN values in the input array, linear interpolation may be used to obtain the split points.

      Parameters:
      scores -
      Returns:
      Array containing three values, corresponding to the split points.
    • getTertiles

      public static double[] getTertiles(double[] scores)
      Determine thresholds for dividing an array of double values into tertiles.

      NaNs are effectively removed first, however the input array is left unchanged so there is no need to duplicate it in advance (i.e. it is duplicated within this method anyway).

      Depending upon the number of non-NaN values in the input array, linear interpolation may be used to obtain the split points.

      Parameters:
      scores -
      Returns:
      Array containing two values, corresponding to the split points.