Class Binning

java.lang.Object
net.imglib2.util.Binning

public class Binning extends Object
Static utility methods to convert from a value to a bin, useful for dealing with histograms and LUTs.
Author:
Aivar Grislis
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static double[]
    centerValuesPerBin(int bins, double min, double max)
    Returns array of center values for each bin.
    static double[]
    edgeValuesPerBin(int bins, double min, double max)
    Returns array of left edge values for each bin.
    static int
    exclusiveValueToBin(int bins, double min, double max, double value)
    Convert value to bin number.
    static int
    valueToBin(int bins, double min, double max, double value)
    Convert value to bin number.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Binning

      public Binning()
  • Method Details

    • valueToBin

      public static int valueToBin(int bins, double min, double max, double value)
      Convert value to bin number.

      This variant is inclusive, it assigns all values to the range 0..(bins-1).

      Parameters:
      bins -
      min -
      max -
      value -
      Returns:
      bin number 0...(bins-1)
    • exclusiveValueToBin

      public static int exclusiveValueToBin(int bins, double min, double max, double value)
      Convert value to bin number.

      This variant is exclusive, not all values map to the range 0...(bins-1).

    • edgeValuesPerBin

      public static double[] edgeValuesPerBin(int bins, double min, double max)
      Returns array of left edge values for each bin.
    • centerValuesPerBin

      public static double[] centerValuesPerBin(int bins, double min, double max)
      Returns array of center values for each bin.