Package qupath.lib.analysis.stats
Class StatisticsHelper
java.lang.Object
qupath.lib.analysis.stats.StatisticsHelper
Static methods for computing statistics from images, with or without a corresponding labeled image.
- Author:
- Pete Bankhead
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic RunningStatistics
computeRunningStatistics
(double[] values) Create a RunningStatistics object using all the values from a specified array.static RunningStatistics
Compute running statistics using all pixels from a SimpleImage.static void
computeRunningStatistics
(SimpleImage img, SimpleImage imgLabels, List<RunningStatistics> statsList) Calculate RunningStatistics for each label > 0 in an image, up to a maximum ofstatsList.size()
.static List
<RunningStatistics> createRunningStatisticsList
(int n) Create a list of n (empty) RunningStatistics objects.static double[]
getQuartiles
(double[] scores) Determine thresholds for dividing an array of double values into quartiles.static double[]
getTertiles
(double[] scores) Determine thresholds for dividing an array of double values into tertiles.static void
updateRunningStatistics
(RunningStatistics stats, SimpleImage img) Add all pixels from a SimpleImage to an existing RunningStatistics object.
-
Constructor Details
-
StatisticsHelper
public StatisticsHelper()
-
-
Method Details
-
computeRunningStatistics
Compute running statistics using all pixels from a SimpleImage.- Parameters:
img
-- Returns:
-
updateRunningStatistics
Add all pixels from a SimpleImage to an existing RunningStatistics object.- Parameters:
stats
-img
-
-
createRunningStatisticsList
Create a list of n (empty) RunningStatistics objects.- Parameters:
n
-- Returns:
-
computeRunningStatistics
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 ofstatsList.size()
.The statistics for pixels in
img
corresponding to integer valuelabel
inimgLabels
are stored withinstatsList.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.
-