7 #include "GaussianStretch.h"
8 #include "GaussianDistribution.h"
25 GaussianStretch::GaussianStretch(
Histogram &histogram,
const double mean,
const double standardDeviation) {
28 p_stretch.ClearPairs();
30 double lastvalue = histogram.
Minimum();
31 for(
int i = 1; i <= histogram.
Bins() - 1; i++) {
32 double percent = 100.0 * (double)i / (
double)histogram.
Bins();
33 double input = histogram.
Percent(percent);
35 if(lastvalue + DBL_EPSILON > input)
continue;
36 if(fabs(input - lastvalue) < 100.0 * DBL_EPSILON)
continue;
38 p_stretch.AddPair(input, output);
42 if(histogram.
Maximum() > lastvalue) {
43 if(abs(histogram.
Maximum() - lastvalue) > 100 * DBL_EPSILON) {
57 double GaussianStretch::Map(
const double value)
const {
58 return p_stretch.Map(value);