import type { TypedArray, NumberType } from "./types.js"; /** * Builds a histogram with 256 bins from a data array. Assume data is 8 bit single channel grayscale. * @class * @param {Array.} data */ export default class Histogram { private bins; /** Min value in the original raw data. */ private min; /** Max value in the original raw data. */ private max; /** Size of each histogram bin in the scale of the original data. */ private binSize; /** Index of the first bin (other than 0) with at least 1 value. */ private dataMinBin; /** Index of the last bin (other than 0) with at least 1 value. */ private dataMaxBin; private pixelCount; maxBin: number; constructor(data: TypedArray); static findBin(dataValue: number, dataMin: number, binSize: number, numBins: number): number; findBinOfValue(value: number): number; /** * Return the min data value * @return {number} */ getDataMin(): number; /** * Return the max data value * @return {number} */ getDataMax(): number; /** * Returns the first bin index with at least 1 value, other than the 0th bin. * @return {number} */ getMin(): number; /** * Returns the last bin index with at least 1 value, other than the 0th bin. * @return {number} */ getMax(): number; getNumBins(): number; getBin(i: number): number; getBinRange(i: number): [number, number]; /** * Find the bin that contains the percentage of pixels below it * @return {number} * @param {number} pct */ findBinOfPercentile(pct: number): number; findBestFitBins(): [number, number]; findAutoIJBins(): [number, number]; findAutoMinMax(): [number, number]; private static calculateHistogram; }