public class Histogram extends Range
Histogram
class store histogram data.Modifier and Type | Field and Description |
---|---|
static float |
LEFT_AREA_SKIPPED_95 |
static float |
RIGHT_AREA_SKIPPED_95 |
Constructor and Description |
---|
Histogram(int[] binCounts,
double min,
double max)
Constructs a new instance for the given bin counts and the given value range.
|
Modifier and Type | Method and Description |
---|---|
void |
aggregate(Object values,
boolean unsigned,
IndexValidator validator,
ProgressMonitor pm) |
static Histogram |
computeHistogram(RenderedImage image,
javax.media.jai.ROI roi,
int numBins,
Range range) |
static Histogram |
computeHistogramByte(byte[] values,
IndexValidator validator,
int numBins,
Range range,
Histogram histo,
ProgressMonitor pm)
Computes the histogram for the values in the given
byte array in the given value range. |
static Histogram |
computeHistogramDouble(double[] values,
IndexValidator validator,
int numBins,
Range range,
Histogram histogram,
ProgressMonitor pm)
Computes the histogram for the values in the given
double array in the given value range. |
static Histogram |
computeHistogramDouble(DoubleList values,
IndexValidator validator,
int numBins,
Range range,
Histogram histo,
ProgressMonitor pm)
Computes the histogram for the values in the given
Histogram.DoubleList in the given value range. |
static Histogram |
computeHistogramFloat(float[] values,
IndexValidator validator,
int numBins,
Range range,
Histogram histogram,
ProgressMonitor pm)
Computes the histogram for the values in the given
float array in the given value range. |
static Histogram |
computeHistogramGeneric(Object values,
boolean unsigned,
IndexValidator validator,
int numBins,
Range range,
Histogram histogram,
ProgressMonitor pm)
Computes the histogram for the values in the given
Histogram.DoubleList in the given value range. |
static Histogram |
computeHistogramInt(int[] values,
IndexValidator validator,
int numBins,
Range range,
Histogram histogram,
ProgressMonitor pm)
Computes the histogram for the values in the given
int array in the given value range. |
static Histogram |
computeHistogramShort(short[] values,
IndexValidator validator,
int numBins,
Range range,
Histogram histo,
ProgressMonitor pm)
Computes the histogram for the values in the given
short array in the given value range. |
static Histogram |
computeHistogramUByte(byte[] values,
IndexValidator validator,
int numBins,
Range range,
Histogram histo,
ProgressMonitor pm)
Computes the histogram for the values in the given
byte array in the given value range. |
static Histogram |
computeHistogramUInt(int[] values,
IndexValidator validator,
int numBins,
Range range,
Histogram histogram,
ProgressMonitor pm)
Computes the histogram for the values in the given
int array in the given value range. |
static Histogram |
computeHistogramUShort(short[] values,
IndexValidator validator,
int numBins,
Range range,
Histogram histo,
ProgressMonitor pm)
Computes the histogram for the values in the given
short array in the given value range. |
Range |
findRange(double leftHistoAreaSkipped,
double rightHistoAreaSkipped)
Returns the value range for the case that the given ratios of the sum of all bin values are skipped from the
lower and upper bounds of this histogram.
|
Range |
findRange(double leftHistoAreaSkipped,
double rightHistoAreaSkipped,
boolean skipLeftPeek,
boolean skipRightPeek) |
Range |
findRangeFor95Percent()
Returns the value range for the case that 2.5% of the sum of all bin values are skipped from the the lower and
upper bounds of this histogram.
|
int[] |
getBinCounts()
Gets the bin values of this histogram.
|
int |
getBinCountsSum()
Gets the sum of all counts
|
int |
getBinIndex(double value)
Gets the bin index for the given value.
|
int |
getMaxBinCount()
Gets the maximum bin value found this histogram.
|
int |
getNumBins()
Gets the number of bins in this histogram.
|
Range |
getRange(int binIndex)
Gets the data value range for the given bin index.
|
Range |
getRange(int binIndex1,
int binIndex2)
Gets the data value range for the given bin index range.
|
void |
setBinCounts(int[] binCounts)
Sets the bin values of this histogram.
|
void |
setBinCounts(int[] binValues,
double min,
double max)
Sets the bin values and range of this histogram.
|
computeRangeByte, computeRangeDouble, computeRangeDouble, computeRangeFloat, computeRangeGeneric, computeRangeInt, computeRangeShort, computeRangeUByte, computeRangeUInt, computeRangeUShort, getMax, getMin, isValid, setMax, setMin, setMinMax, toString
public static final float LEFT_AREA_SKIPPED_95
public static final float RIGHT_AREA_SKIPPED_95
public Histogram(int[] binCounts, double min, double max)
binCounts
- the bin countsmin
- the minimum valuemax
- the maximum valuepublic int getNumBins()
public int[] getBinCounts()
public void setBinCounts(int[] binValues, double min, double max)
binValues
- the bin valuesmin
- the minimum value of the rangemax
- the maximum value of the rangepublic void setBinCounts(int[] binCounts)
binCounts
- the bin valuespublic int getMaxBinCount()
public int getBinCountsSum()
public Range findRangeFor95Percent()
public Range findRange(double leftHistoAreaSkipped, double rightHistoAreaSkipped)
leftHistoAreaSkipped
- the normalized area (a ratio of the entire area) of samples skipped from the left
end of the histogram, must be greater than or equal to 0.0
and less
than 1.0 - rightHistoAreaSkipped
rightHistoAreaSkipped
- the normalized area (a ratio of the entire area) of samples skipped from the upper
end of the histogram must be greater than or equal to 0.0
and less than
1.0 - leftHistoAreaSkipped
public Range findRange(double leftHistoAreaSkipped, double rightHistoAreaSkipped, boolean skipLeftPeek, boolean skipRightPeek)
public Range getRange(int binIndex)
binIndex
- the bin indexpublic Range getRange(int binIndex1, int binIndex2)
binIndex1
- the first bin indexbinIndex2
- the second bin indexpublic int getBinIndex(double value)
value
- the value-1
if the value is not covered by this histogram.public void aggregate(Object values, boolean unsigned, IndexValidator validator, ProgressMonitor pm)
public static Histogram computeHistogramByte(byte[] values, IndexValidator validator, int numBins, Range range, Histogram histo, ProgressMonitor pm)
byte
array in the given value range. The array
elements are interpreted as signed byte values. Values at a given index i
for which
validator.validate(i)
returns false
are excluded from the computation.values
- the array whose histogram to computevalidator
- used to validate the array indexes, must not be null
. Use IndexValidator.TRUE
instead.numBins
- the number of bins for the histogramrange
- the value range, if null
the range is automatically computedpm
- a monitor to inform the user about progresscomputeHistogramUByte(byte[], org.esa.snap.core.util.math.IndexValidator, int, org.esa.snap.core.util.math.Range, org.esa.snap.core.util.math.Histogram, com.bc.ceres.core.ProgressMonitor)
public static Histogram computeHistogramUByte(byte[] values, IndexValidator validator, int numBins, Range range, Histogram histo, ProgressMonitor pm)
byte
array in the given value range. The array
elements are interpreted as unsigned byte values. Values at a given index i
for which
validator.validate(i)
returns false
are excluded from the computation.values
- the array whose histogram to computevalidator
- used to validate the array indexes, must not be null
. Use IndexValidator.TRUE
instead.numBins
- the number of bins for the histogramrange
- the value range, if null
the range is automatically computedpm
- a monitor to inform the user about progresscomputeHistogramByte(byte[], org.esa.snap.core.util.math.IndexValidator, int, org.esa.snap.core.util.math.Range, org.esa.snap.core.util.math.Histogram, com.bc.ceres.core.ProgressMonitor)
public static Histogram computeHistogramShort(short[] values, IndexValidator validator, int numBins, Range range, Histogram histo, ProgressMonitor pm)
short
array in the given value range. The array
elements are interpreted as signed short values. Values at a given index i
for which
validator.validate(i)
returns false
are excluded from the computation.values
- the array whose histogram to computevalidator
- used to validate the array indexes, must not be null
. Use IndexValidator.TRUE
instead.numBins
- the number of bins for the histogramrange
- the value range, if null
the range is automatically computedcomputeHistogramUShort(short[], org.esa.snap.core.util.math.IndexValidator, int, org.esa.snap.core.util.math.Range, org.esa.snap.core.util.math.Histogram, com.bc.ceres.core.ProgressMonitor)
public static Histogram computeHistogramUShort(short[] values, IndexValidator validator, int numBins, Range range, Histogram histo, ProgressMonitor pm)
short
array in the given value range. The array
elements are interpreted as unsigned short values. Values at a given index i
for which
validator.validate(i)
returns false
are excluded from the computation.values
- the array whose histogram to computevalidator
- used to validate the array indexes, must not be null
. Use IndexValidator.TRUE
instead.numBins
- the number of bins for the histogramrange
- the value range, if null
the range is automatically computedpm
- a monitor to inform the user about progresscomputeHistogramShort(short[], org.esa.snap.core.util.math.IndexValidator, int, org.esa.snap.core.util.math.Range, org.esa.snap.core.util.math.Histogram, com.bc.ceres.core.ProgressMonitor)
public static Histogram computeHistogramInt(int[] values, IndexValidator validator, int numBins, Range range, Histogram histogram, ProgressMonitor pm)
int
array in the given value range. The array
elements are interpreted as signed byte values. Values at a given index i
for which
validator.validate(i)
returns false
are excluded from the computation.values
- the array whose histogram to computevalidator
- used to validate the array indexes, must not be null
. Use IndexValidator.TRUE
instead.numBins
- the number of bins for the histogramrange
- the value range, if null
the range is automatically computedhistogram
- a histogram instance to be reused, can be null
pm
- a monitor to inform the user about progresscomputeHistogramUInt(int[], org.esa.snap.core.util.math.IndexValidator, int, org.esa.snap.core.util.math.Range, org.esa.snap.core.util.math.Histogram, com.bc.ceres.core.ProgressMonitor)
public static Histogram computeHistogramUInt(int[] values, IndexValidator validator, int numBins, Range range, Histogram histogram, ProgressMonitor pm)
int
array in the given value range. The array
elements are interpreted as unsigned byte values. Values at a given index i
for which
validator.validate(i)
returns false
are excluded from the computation.values
- the array whose histogram to computevalidator
- used to validate the array indexes, must not be null
. Use IndexValidator.TRUE
instead.range
- the value range, if null
the range is automatically computedhistogram
- a histogram instance to be reused, can be null
pm
- a monitor to inform the user about progresscomputeHistogramInt(int[], org.esa.snap.core.util.math.IndexValidator, int, org.esa.snap.core.util.math.Range, org.esa.snap.core.util.math.Histogram, com.bc.ceres.core.ProgressMonitor)
public static Histogram computeHistogramFloat(float[] values, IndexValidator validator, int numBins, Range range, Histogram histogram, ProgressMonitor pm)
float
array in the given value range. Values at a
given index i
for which validator.validate(i)
returns false
are excluded
from the computation.values
- the array whose histogram to computevalidator
- used to validate the array indexes, must not be null
. Use IndexValidator.TRUE
instead.numBins
- the number of bins for the histogramrange
- the value range, if null
the range is automatically computedhistogram
- a histogram instance to be reused, can be null
pm
- a monitor to inform the user about progresscomputeHistogramDouble(double[], org.esa.snap.core.util.math.IndexValidator, int, org.esa.snap.core.util.math.Range, org.esa.snap.core.util.math.Histogram, com.bc.ceres.core.ProgressMonitor)
public static Histogram computeHistogramDouble(double[] values, IndexValidator validator, int numBins, Range range, Histogram histogram, ProgressMonitor pm)
double
array in the given value range. Values at
a given index i
for which validator.validate(i)
returns false
are excluded
from the computation.values
- the array whose histogram to computevalidator
- used to validate the array indexes, must not be null
. Use IndexValidator.TRUE
instead.numBins
- the number of bins for the histogramrange
- the value range, if null
the range is automatically computedhistogram
- a histogram instance to be reused, can be null
pm
- a monitor to inform the user about progresscomputeHistogramFloat(float[], org.esa.snap.core.util.math.IndexValidator, int, org.esa.snap.core.util.math.Range, org.esa.snap.core.util.math.Histogram, com.bc.ceres.core.ProgressMonitor)
public static Histogram computeHistogramDouble(DoubleList values, IndexValidator validator, int numBins, Range range, Histogram histo, ProgressMonitor pm)
Histogram.DoubleList
in the given value range.
Values at a given index i
for which validator.validate(i)
returns false
are excluded from the computation.values
- the Histogram.DoubleList
whose histogram to computevalidator
- used to validate the indexes, must not be null
. Use IndexValidator.TRUE
instead.numBins
- the number of bins for the histogramrange
- the value range, if null
the range is automatically computedpm
- a monitor to inform the user about progresscomputeHistogramByte(byte[], org.esa.snap.core.util.math.IndexValidator, int, org.esa.snap.core.util.math.Range, org.esa.snap.core.util.math.Histogram, com.bc.ceres.core.ProgressMonitor)
public static Histogram computeHistogramGeneric(Object values, boolean unsigned, IndexValidator validator, int numBins, Range range, Histogram histogram, ProgressMonitor pm)
Histogram.DoubleList
in the given value range.
Values at a given index i
for which validator.validate(i)
returns false
are excluded from the computation.values
- the Histogram.DoubleList
whose histogram to computevalidator
- used to validate the indexes, must not be null
. Use IndexValidator.TRUE
instead.numBins
- the number of bins for the histogramrange
- the value range, if null
the range is automatically computedpm
- a monitor to inform the user about progresscomputeHistogramByte(byte[], org.esa.snap.core.util.math.IndexValidator, int, org.esa.snap.core.util.math.Range, org.esa.snap.core.util.math.Histogram, com.bc.ceres.core.ProgressMonitor)
public static Histogram computeHistogram(RenderedImage image, javax.media.jai.ROI roi, int numBins, Range range)
Copyright © 2014–2017 European Space Agency (ESA). All rights reserved.