ImageHistogram
Source: imageHistogram.js:16
Histogram of image values.
Raw (stored) values are counted in one Histogram per rescale slope and intercept (RSI). Values are rescaled when read. An image with a constant RSI only has one histogram.
Constructor
new ImageHistogram(unit?: string): ImageHistogramParameters
unit(string, optional) — The unit of the rescaled values.
Instance Methods
getUnit(): string | undefined
Get the unit of the rescaled values.
Returns
string | undefined— The unit, undefined if not known.
getHistogram(rsi: RescaleSlopeAndIntercept): Histogram
Get the raw value histogram for an RSI, creating it if needed.
Parameters
rsi(RescaleSlopeAndIntercept) — The RSI of the raw values.
Returns
Histogram— The raw value histogram.
add(rawValue: number, rsi: RescaleSlopeAndIntercept)
Add one raw value.
Parameters
rawValue(number) — The raw value.rsi(RescaleSlopeAndIntercept) — The RSI of the raw value.
getTotal(): number
Get the total number of counted values.
Returns
number— The total count.
getRange(): NumberRange | undefined
Get the value range (raw values).
Returns
NumberRange| undefined— The range, undefined if empty.
getRescaledHistogram(): Histogram
Get the histogram of the rescaled values: raw values of each RSI are rescaled and equal rescaled values merged.
Returns
Histogram— The rescaled value histogram.
getRescaledRange(): NumberRange | undefined
Get the rescaled value range.
Returns
NumberRange| undefined— The range, undefined if empty.
getIntervalPercentages(
thresholds: Array.<(number|undefined)>,
): Array.<number>
Get the percentage of counts that fall in each interval defined by consecutive rescaled thresholds, see Histogram#getIntervalPercentages.
Parameters
thresholds(Array.<(number|undefined)>) — Rescaled interval bounds in ascending order, the first and last can be undefined.
Returns
Array.<number>— The percentages in [0, 100], one per interval (thresholds.length - 1entries), all 0 if no value falls in the intervals.
getStats(): Statistics | undefined
Get the statistics of the rescaled values, see Histogram#getStats.
Returns
Statistics| undefined— The statistics, undefined if empty.