diplib/histogram.h file

Histograms and related functionality. See Histograms.

Contents

Classes

class dip::Histogram
Computes and holds histograms.

Functions

auto dip::CumulativeHistogram(dip::Histogram const& in) -> dip::Histogram
Computes a cumulative histogram from in. See dip::Histogram::Cumulative.
auto dip::Smooth(dip::Histogram const& in, dip::FloatArray const& sigma) -> dip::Histogram
Returns a smoothed version of the histogram in. See dip::Histogram::Smooth.
auto dip::Smooth(dip::Histogram const& in, dip::dfloat sigma = 1) -> dip::Histogram
Returns a smoothed version of the histogram in. See dip::Histogram::Smooth.
auto dip::Mean(dip::Histogram const& in) -> dip::FloatArray
Computes the mean value of the data represented by the histogram.
auto dip::Covariance(dip::Histogram const& in) -> dip::FloatArray
Computes the covariance matrix of the data represented by the histogram.
auto dip::MarginalPercentile(dip::Histogram const& in, dip::dfloat percentile = 50) -> dip::FloatArray
Computes the marginal percentile value of the data represented by the histogram. The marginal percentile is a percentile computed independently on each dimension, and thus is not one of the input values.
auto dip::MarginalMedian(dip::Histogram const& in) -> dip::FloatArray
Computes the marginal median value of the data represented by the histogram. The median is the 50th percentile, see dip::MarginalPercentile for details.
auto dip::Mode(dip::Histogram const& in) -> dip::FloatArray
Returns the mode, the bin with the largest count.
auto dip::PearsonCorrelation(dip::Histogram const& in) -> dip::dfloat
Computes the Pearson correlation coefficient between two images from their joint histogram in.
auto dip::Regression(dip::Histogram const& in) -> dip::RegressionParameters
Fits a line through the histogram. Returns the slope and intercept of the regression line.
auto dip::MutualInformation(dip::Histogram const& in) -> dip::dfloat
Calculates the mutual information, in bits, between two images from their joint histogram in.
auto dip::Entropy(dip::Histogram const& in) -> dip::dfloat
Calculates the entropy, in bits, of an image from its histogram in.
auto dip::IsodataThreshold(dip::Histogram const& in, dip::uint nThresholds = 1) -> dip::FloatArray
Determines a set of nThresholds thresholds using the Isodata algorithm (k-means clustering), and the image’s histogram in.
auto dip::OtsuThreshold(dip::Histogram const& in) -> dip::dfloat
Determines a threshold using the maximal inter-class variance method by Otsu, and the image’s histogram in.
auto dip::MinimumErrorThreshold(dip::Histogram const& in) -> dip::dfloat
Determines a threshold using the minimal error method method, and the image’s histogram in.
auto dip::GaussianMixtureModelThreshold(dip::Histogram const& in, dip::uint nThresholds = 1) -> dip::FloatArray
Determines a set of nThresholds thresholds by modeling the histogram with a Gaussian Mixture Model, fitting the model using the Expectation Maximization procedure, and choosing the optimal Bayes thresholds.
auto dip::TriangleThreshold(dip::Histogram const& in, dip::dfloat sigma = 4.0) -> dip::dfloat
Determines a threshold using the using the chord method (a.k.a. skewed bi-modality, maximum distance to triangle), and the image’s histogram in.
auto dip::BackgroundThreshold(dip::Histogram const& in, dip::dfloat distance = 2.0, dip::dfloat sigma = 4.0) -> dip::dfloat
Determines a threshold using the unimodal background-symmetry method, and the image’s histogram in.
auto dip::KMeansClustering(dip::Histogram const& in, dip::uint nClusters = 2) -> dip::Histogram
Partitions a (multi-dimensional) histogram into nClusters partitions using k-means clustering.
auto dip::MinimumVariancePartitioning(dip::Histogram const& in, dip::uint nClusters = 2) -> dip::Histogram
Partitions a (multi-dimensional) histogram into nClusters partitions iteratively using Otsu thresholding along individual dimensions.
auto dip::EqualizationLookupTable(dip::Histogram const& in) -> dip::LookupTable
Computes a lookup table that, when applied to an image with the histogram in, yields an image with a flat histogram (or rather a histogram that is as flat as possible).
auto dip::MatchingLookupTable(dip::Histogram const& in, dip::Histogram const& example) -> dip::LookupTable
Computes a lookup table that, when applied to an image with the histogram in, yields an image with a histogram as similar as possible to example.
auto dip::PerObjectHistogram(dip::Image const& grey, dip::Image const& label, dip::Image const& mask = {}, dip::Histogram::Configuration configuration = {}, dip::String const& mode = S::FRACTION, dip::String const& background = S::EXCLUDE) -> dip::Distribution
Computes a histogram of grey values in grey for each object in label.

Operators

auto dip::operator+(dip::Histogram const& lhs, dip::Histogram const& rhs) -> dip::Histogram
Adds two histograms.
auto dip::operator-(dip::Histogram const& lhs, dip::Histogram const& rhs) -> dip::Histogram
Subtracts two histograms.
auto dip::operator<<(std::ostream& os, dip::Histogram const& histogram) -> std::ostream&
You can output a dip::Histogram to std::cout or any other stream. Some information about the histogram is printed.

Variables

dip::DataType const dip::DT_COUNT constexpr
Data type of histogram bins. See dip::Histogram::CountType.