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 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 a Integer1dBinMapper.
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

    Modifier and Type
    Method
    Description
    Returns a copy of this BinMapper1d<T>.
    long
    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
    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 a HistogramNd 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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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: BinMapper1d
      Returns the number of bins within this bin mapping distribution.
      Specified by:
      getBinCount in interface BinMapper1d<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 interface BinMapper1d<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 interface BinMapper1d<T extends RealType<T>>
      Parameters:
      binPos -
      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 interface BinMapper1d<T extends RealType<T>>
      Parameters:
      binPos - Bin number of interest
      value - 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 interface BinMapper1d<T extends RealType<T>>
      Parameters:
      binPos - Bin number of interest
      value - 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 interface BinMapper1d<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 interface BinMapper1d<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 interface BinMapper1d<T extends RealType<T>>
    • copy

      public Real1dBinMapper<T> copy()
      Description copied from interface: BinMapper1d
      Returns a copy of this BinMapper1d<T>.
      Specified by:
      copy in interface BinMapper1d<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 a HistogramNd 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 dimension
      maxVals - The maximum bin values for each dimension
      numBins - The total bin count for each dimension
      tailBins - Flags per dimension for whether to include tail bins
      Returns:
      An unpopulated HistogramNd