Bsoft 2.1.4
Bernard's software package
histogram.h File Reference

Header file for calculating and fitting histograms. More...

#include "simplex.h"
#include "Bplot.h"

Functions

vector< long > histogram (vector< double > data, long bins, double &scale, double &offset)
 Calculates the histogram froma data array. More...
 
Bplotplot_convert_to_histogram (Bplot *plot, long bins, long hiscol)
 
vector< double > histogram_thresholds (vector< long > h, long number)
 Calculates multiple thresholds from a histogram. More...
 
double histogram_gaussian_R (Bsimplex &simp)
 
int plot_histogram_fit (Bplot *plot, long ngauss)
 Fits a gaussian function to a histogram and plots it. More...
 

Detailed Description

Header file for calculating and fitting histograms.

Author
Bernard Heymann
Date
Created: 19990321
Modified: 20221004

Function Documentation

◆ histogram()

vector< long > histogram ( vector< double >  data,
long  bins,
double &  scale,
double &  offset 
)

Calculates the histogram froma data array.

Parameters
datavector of data.
binsnumber of bins in the histogram.
&scalescale.
&offsetoffset.
Returns
vector<long> histogram.
A histogram of an image is calculated with a given number of bins.
Multiple channels are output as successive one-dimensional arrays.
The image data is not affected.
The statistics for the input image must be correctly calculated.

◆ histogram_gaussian_R()

double histogram_gaussian_R ( Bsimplex simp)

◆ histogram_thresholds()

vector< double > histogram_thresholds ( vector< long >  h,
long  number 
)

Calculates multiple thresholds from a histogram.

Parameters
hhistogram.
numbernumber of clusters (one more than thresholds).
Returns
vector<double> thresholds.
Reference: PS.Liao, TS.Chen, and PC. Chung,
       Journal of Information Science and Engineering, vol 17, 713-727 (2001)

◆ plot_convert_to_histogram()

Bplot * plot_convert_to_histogram ( Bplot plot,
long  bins,
long  hiscol 
)

◆ plot_histogram_fit()

int plot_histogram_fit ( Bplot plot,
long  ngauss 
)

Fits a gaussian function to a histogram and plots it.

Parameters
plothistogram plot.
ngaussnumber of gaussians.
Returns
int 0.
One or more gaussians are fit to a histogram plot.
The gaussian curves are added to columns.