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

Library routines to calculate histograms for images. More...

#include "histogram.h"
#include "ps_plot.h"
#include "cluster.h"
#include "moving_average.h"
#include "matrix_linear.h"
#include "qsort_functions.h"
#include "string_util.h"
#include "utilities.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)
 
double find_maximum_sigma (Matrix &H, long i, long level, long depth, double sum, double &maxsum, vector< double > &t)
 
vector< double > histogram_thresholds (vector< long > h, long number)
 Calculates multiple thresholds from a histogram. More...
 
double histogram_gaussian_R (Bsimplex &simp)
 
vector< double > plot_histogram_fit_gaussian (Bplot *plot, long ngauss)
 Fits a gaussian function to a histogram of an image. More...
 
int plot_histogram_fit (Bplot *plot, long ngauss)
 Fits a gaussian function to a histogram and plots it. More...
 

Variables

int verbose
 

Detailed Description

Library routines to calculate histograms for images.

Author
Bernard Heymann
Date
Created: 19990321
Modified: 20221004

Function Documentation

◆ find_maximum_sigma()

double find_maximum_sigma ( Matrix H,
long  i,
long  level,
long  depth,
double  sum,
double &  maxsum,
vector< double > &  t 
)

◆ 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.

◆ plot_histogram_fit_gaussian()

vector< double > plot_histogram_fit_gaussian ( Bplot plot,
long  ngauss 
)

Fits a gaussian function to a histogram of an image.

Parameters
plotplot with histogram.
ngaussnumber of gaussians.
Returns
vector<double> array with 3 values for each gaussian, final value R.
The return has (in order) the amplitude, offset,
and sigma value for each gaussian.
The last value is the RMSD, scaled as:
    RMSD*bins/sum

Variable Documentation

◆ verbose

int verbose
extern