Package net.imglib2.histogram
Class Real1dBinMapper<T extends RealType<T>>
- java.lang.Object
-
- net.imglib2.histogram.Real1dBinMapper<T>
-
- All Implemented Interfaces:
BinMapper1d<T>
public class Real1dBinMapper<T extends RealType<T>> extends java.lang.Object implements 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 aInteger1dBinMapper
.- Author:
- Barry DeZonia
-
-
Constructor Summary
Constructors Constructor Description 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.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Real1dBinMapper<T>
copy()
Returns a copy of thisBinMapper1d<T>
.long
getBinCount()
Returns the number of bins within this bin mapping distribution.void
getCenterValue(long binPos, T value)
Gets the data value associated with the center of a bin.void
getLowerBound(long binPos, T value)
Gets the data value associated with the left edge of a bin.void
getUpperBound(long binPos, T value)
Gets the data value associated with the right edge of a bin.boolean
hasTails()
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 aHistogramNd
from inputs that describe a set of real 1-d based bin mappers.boolean
includesLowerBound(long binPos)
Returns true if values matching the left edge data value for a given bin are counted in the distribution.boolean
includesUpperBound(long binPos)
Returns true if values matching the right edge data value for a given bin are counted in the distribution.long
map(T value)
Converts a data value to a long index within the bin distribution.
-
-
-
Constructor Detail
-
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 Detail
-
getBinCount
public long getBinCount()
Description copied from interface:BinMapper1d
Returns the number of bins within this bin mapping distribution.- Specified by:
getBinCount
in interfaceBinMapper1d<T extends RealType<T>>
-
map
public long map(T value)
Description copied from interface:BinMapper1d
Converts a data value to a long index within the bin distribution.- Specified by:
map
in interfaceBinMapper1d<T extends RealType<T>>
-
getCenterValue
public void getCenterValue(long binPos, T value)
Description copied from interface:BinMapper1d
Gets the data value associated with the center of a bin.- Specified by:
getCenterValue
in interfaceBinMapper1d<T extends RealType<T>>
value
- Output to contain center data value
-
getLowerBound
public void getLowerBound(long binPos, T value)
Description copied from interface:BinMapper1d
Gets the data value associated with the left edge of a bin.- Specified by:
getLowerBound
in interfaceBinMapper1d<T extends RealType<T>>
- Parameters:
binPos
- Bin number of interestvalue
- Output to contain left edge data value
-
getUpperBound
public void getUpperBound(long binPos, T value)
Description copied from interface:BinMapper1d
Gets the data value associated with the right edge of a bin.- Specified by:
getUpperBound
in 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:BinMapper1d
Returns 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:
includesLowerBound
in interfaceBinMapper1d<T extends RealType<T>>
- Parameters:
binPos
- Bin number of interest
-
includesUpperBound
public boolean includesUpperBound(long binPos)
Description copied from interface:BinMapper1d
Returns 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:
includesUpperBound
in interfaceBinMapper1d<T extends RealType<T>>
- Parameters:
binPos
- Bin number of interest
-
hasTails
public boolean hasTails()
Description copied from interface:BinMapper1d
Returns true if this bin mapping has bins on the ends of the distribution that count out of bounds values.- Specified by:
hasTails
in interfaceBinMapper1d<T extends RealType<T>>
-
copy
public Real1dBinMapper<T> copy()
Description copied from interface:BinMapper1d
Returns a copy of thisBinMapper1d<T>
.- Specified by:
copy
in 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 aHistogramNd
from 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
-
-