|
OpenZGY/C++ API and Internals (ALPHA)
Access seismic data stored in ZGY format.
|
Collect statistics and histogram for bulk data. More...
#include <histogrambuilder.h>
Public Types | |
| typedef int | size_type |
| typedef StatisticData::count_type | count_type |
Public Member Functions | |
| HistogramBuilder (size_type _nbins, double _min, double _max) | |
| HistogramBuilder (const count_type *bins, int nbins, double min, double max, count_type scnt, double ssum, double sssq, double smin, double smax) | |
| HistogramBuilder & | operator+= (const HistogramBuilder &other) |
| HistogramBuilder & | operator-= (const HistogramBuilder &other) |
| HistogramBuilder & | operator*= (count_type factor) |
| bool | operator== (const HistogramBuilder &other) const |
| bool | operator!= (const HistogramBuilder &other) const |
| StatisticData | gethiststats () const |
| template<typename It > | |
| void | add (It begin, It end) |
| void | scale (double oldmin, double oldmax, double newmin, double newmax) |
Collect statistics and histogram for bulk data.
Note the following caveat with histogram data. The histogram is described by number of bins and a pair of min/max values. It is not obvious whether those values describe the center value of the first and last bin, or whether they are the open ended range representing the whole histogram. I.e. the first value (inclusive) of the first bin and the last value (exclusive) of the last bin. HistogramBuilder uses the former definition.
| InternalZGY::HistogramBuilder::HistogramBuilder | ( | size_type | nbins, |
| double | min, | ||
| double | max | ||
| ) |
Create a new HistogramBuilder.
| InternalZGY::HistogramBuilder::HistogramBuilder | ( | const count_type * | bins, |
| int | nbins, | ||
| double | min, | ||
| double | max, | ||
| count_type | scnt, | ||
| double | ssum, | ||
| double | sssq, | ||
| double | smin, | ||
| double | smax | ||
| ) |
Copy constructor from a histogram passed as discrete information. Useful for converting from some other histogram type. Always create a fixed-range histogram with the same range and number of bins as the source. If this is not what you need, convert it using operator+=(). The above, below, and infinite counts are left at zero.
| void InternalZGY::HistogramBuilder::add | ( | It | begin, |
| It | end | ||
| ) |
Add samples from an iterator to a histogram. If the caller has already calculated statistics from the iterator, those can be passed it so this function doesn't need to do it again.
| StatisticData InternalZGY::HistogramBuilder::gethiststats | ( | ) | const |
Statistics calculated from bins
Calculate statistics directly from the histogram. See the overloaded StatisticData constructor for details. Here we don't know whether the histogram was built from 8-bit data, so we play it safe and assume it wasn't.
| bool InternalZGY::HistogramBuilder::operator!= | ( | const HistogramBuilder & | other | ) | const |
See operator== for a description.
| HistogramBuilder & InternalZGY::HistogramBuilder::operator*= | ( | count_type | factor | ) |
Multiply HistogramBuilder with a constant N, equivalent to creating a new instance and adding the old one to it N times. N can be negative.
| HistogramBuilder & InternalZGY::HistogramBuilder::operator+= | ( | const HistogramBuilder & | other | ) |
Add the samples found in another histogram, just as if the samples had been added one at a time using Add().
| HistogramBuilder & InternalZGY::HistogramBuilder::operator-= | ( | const HistogramBuilder & | other | ) |
Subtract the samples found in another histogram, more or less undoing the effect of Add. The min/max range in the statistics might be left showing a too wide range.
| bool InternalZGY::HistogramBuilder::operator== | ( | const HistogramBuilder & | other | ) | const |
Two histograms are considered equal if they return the same bin count for any input value. In practice there is some slop, as only the center of each bin of either histogram is checked. The statistics information need not match. Nor is there any check that the histograms have the same range or even the same number of bins.
| void InternalZGY::HistogramBuilder::scale | ( | double | oldmin, |
| double | oldmax, | ||
| double | newmin, | ||
| double | newmax | ||
| ) |
Calculate the linear transform needed to convert from one range (typically the natural data range of the integral storage type) to the data range that the application wants to see. Then update the histogram and associated statistics so they look like the transform had been done on every single data point before adding it.
1.8.17