Package net.imglib2.histogram
Class Real1dBinMapper<T extends RealType<T>>
java.lang.Object
net.imglib2.histogram.Real1dBinMapper<T>
- All Implemented Interfaces:
BinMapper1d<T>
Maps real values into a 1-d set of bins. Though this class will work with
integral data types it is really more appropriate to do so using a
Integer1dBinMapper.- Author:
- Barry DeZonia
-
Constructor Summary
ConstructorsConstructorDescriptionReal1dBinMapper(double minVal, double maxVal, long numBins, boolean tailBins) Specify a mapping of real data from a user defined range into a specified number of bins. -
Method Summary
Modifier and TypeMethodDescriptioncopy()Returns a copy of thisBinMapper1d<T>.longReturns the number of bins within this bin mapping distribution.voidgetCenterValue(long binPos, T value) Gets the data value associated with the center of a bin.voidgetLowerBound(long binPos, T value) Gets the data value associated with the left edge of a bin.voidgetUpperBound(long binPos, T value) Gets the data value associated with the right edge of a bin.booleanhasTails()Returns true if this bin mapping has bins on the ends of the distribution that count out of bounds values.static <K extends RealType<K>>
HistogramNd<K> histogramNd(double[] minVals, double[] maxVals, long[] numBins, boolean[] tailBins) This is a convenience method for creating aHistogramNdfrom inputs that describe a set of real 1-d based bin mappers.booleanincludesLowerBound(long binPos) Returns true if values matching the left edge data value for a given bin are counted in the distribution.booleanincludesUpperBound(long binPos) Returns true if values matching the right edge data value for a given bin are counted in the distribution.longConverts a data value to a long index within the bin distribution.
-
Constructor Details
-
Real1dBinMapper
public Real1dBinMapper(double minVal, double maxVal, long numBins, boolean tailBins) Specify a mapping of real data from a user defined range into a specified number of bins. If tailBins is true then there will be two bins that count values outside the user specified ranges. If false then values outside the range fail to map to any bin.- Parameters:
minVal- The first data value of interest.maxVal- The last data value of interest.numBins- The total number of bins to create.tailBins- A boolean specifying whether to have a bin in each tail to count values outside the user defined range.
-
-
Method Details
-
getBinCount
public long getBinCount()Description copied from interface:BinMapper1dReturns the number of bins within this bin mapping distribution.- Specified by:
getBinCountin interfaceBinMapper1d<T extends RealType<T>>
-
map
Description copied from interface:BinMapper1dConverts a data value to a long index within the bin distribution.- Specified by:
mapin interfaceBinMapper1d<T extends RealType<T>>
-
getCenterValue
Description copied from interface:BinMapper1dGets the data value associated with the center of a bin.- Specified by:
getCenterValuein interfaceBinMapper1d<T extends RealType<T>>- Parameters:
binPos-value- Output to contain center data value
-
getLowerBound
Description copied from interface:BinMapper1dGets the data value associated with the left edge of a bin.- Specified by:
getLowerBoundin interfaceBinMapper1d<T extends RealType<T>>- Parameters:
binPos- Bin number of interestvalue- Output to contain left edge data value
-
getUpperBound
Description copied from interface:BinMapper1dGets the data value associated with the right edge of a bin.- Specified by:
getUpperBoundin interfaceBinMapper1d<T extends RealType<T>>- Parameters:
binPos- Bin number of interestvalue- Output to contain right edge data value
-
includesLowerBound
public boolean includesLowerBound(long binPos) Description copied from interface:BinMapper1dReturns true if values matching the left edge data value for a given bin are counted in the distribution. Basically is this bin interval closed on the left or not.- Specified by:
includesLowerBoundin interfaceBinMapper1d<T extends RealType<T>>- Parameters:
binPos- Bin number of interest
-
includesUpperBound
public boolean includesUpperBound(long binPos) Description copied from interface:BinMapper1dReturns true if values matching the right edge data value for a given bin are counted in the distribution. Basically is this bin interval closed on the right or not.- Specified by:
includesUpperBoundin interfaceBinMapper1d<T extends RealType<T>>- Parameters:
binPos- Bin number of interest
-
hasTails
public boolean hasTails()Description copied from interface:BinMapper1dReturns true if this bin mapping has bins on the ends of the distribution that count out of bounds values.- Specified by:
hasTailsin interfaceBinMapper1d<T extends RealType<T>>
-
copy
Description copied from interface:BinMapper1dReturns a copy of thisBinMapper1d<T>.- Specified by:
copyin interfaceBinMapper1d<T extends RealType<T>>
-
histogramNd
public static <K extends RealType<K>> HistogramNd<K> histogramNd(double[] minVals, double[] maxVals, long[] numBins, boolean[] tailBins) This is a convenience method for creating aHistogramNdfrom inputs that describe a set of real 1-d based bin mappers. The inputs should all have n entries for an n-d set of mappers.- Parameters:
minVals- The minimum bin values for each dimensionmaxVals- The maximum bin values for each dimensionnumBins- The total bin count for each dimensiontailBins- Flags per dimension for whether to include tail bins- Returns:
- An unpopulated HistogramNd
-