CTL
0.6.1
Computed Tomography Library
|
The PointSeriesBase class is the base class used to represent a series of data tuples. More...
#include <pointseriesbase.h>
Public Member Functions | |
const QList< QPointF > & | data () const |
float | max () const |
float | min () const |
uint | nbSamples () const |
uint | size () const |
float | sum () const |
float | sum (const std::vector< float > &weights) const |
float | weightedSum (const std::vector< float > &weights) const |
float | samplingPoint (uint sampleNb) const |
std::vector< float > | samplingPoints () const |
Range< float > | samplingRange () const |
float | value (uint sampleNb) const |
std::vector< float > | values () const |
Range< float > | valueRange () const |
Protected Member Functions | |
PointSeriesBase (const QList< QPointF > &pointSeries) | |
PointSeriesBase (QList< QPointF > &&pointSeries) | |
void | normalizeByMaxAbsVal () |
void | normalizeByMaxVal () |
void | scaleValues (float factor) |
Protected Attributes | |
QList< QPointF > | _data |
The PointSeriesBase class is the base class used to represent a series of data tuples.
This class stores data tuples (sampling point and the corresponding value) as a QList<QPointF>. This is done to achieve straightforward compatability with QCharts for visualization purposes.
Data managed by this class cannot be modified through its public interface. Manipulation options, e.g. the possibility to add/remove data points, needs to be provided by dedicated sub-classes.
A number of typical 'inspection' methods is provided. These methods operate on the values (i.e. 'y' part) stored int the tuples. The collection includes min() / max() queries and computation of sum() and weightedSum(), as well as individual queries for the full range covered by either the sampling points (i.e. 'x' part) or the values in the series, see samplingRange() / valueRange().
Protected member methods are available to scale and normalize values in the series. Consider turning them public in sub-classes if appropriate.
Currently, the CTL contains two dedicated sub-classes: XYDataSeries and IntervalDataSeries. Please refer to the individual documentation for their specific purpose.
|
explicitprotected |
Constructs a PointSeriesBase and sets the data to pointSeries (by copying).
Note that, once created, data cannot be modified through the public interface of this class.
|
explicitprotected |
Constructs a PointSeriesBase and sets the data to pointSeries (by moving).
Note that, once created, data cannot be modified through the public interface of this class.
const QList< QPointF > & CTL::PointSeriesBase::data | ( | ) | const |
Returns a reference-to-const to the data managed by this instance.
float CTL::PointSeriesBase::max | ( | ) | const |
Returns the maximum of the values (i.e. 'y' part of the tuples) in this series.
float CTL::PointSeriesBase::min | ( | ) | const |
Returns the minimum of the values (i.e. 'y' part of the tuples) in this series.
uint CTL::PointSeriesBase::nbSamples | ( | ) | const |
Returns the number of samples (i.e. sampling point / value pairs) in this series.
float CTL::PointSeriesBase::samplingPoint | ( | uint | sampleNb | ) | const |
Returns the sampling point (i.e. 'x' part) of the sample with index sampleNb in this series.
std::vector< float > CTL::PointSeriesBase::samplingPoints | ( | ) | const |
Returns all sampling points (i.e. 'x' part) in this series as an std::vector.
Preserves the original order of the points.
Range< float > CTL::PointSeriesBase::samplingRange | ( | ) | const |
Returns the range (smallest to highest sampling point) covered by the sampling points (i.e. 'x' part) in this series.
|
protected |
Normalizes the series by dividing all values (i.e. 'y' part) by the maximum absolute value.
Example:
.
Example:
uint CTL::PointSeriesBase::size | ( | ) | const |
Returns the number of samples (i.e. sampling point / value pairs) in this series.
Same as nbSamples().
float CTL::PointSeriesBase::sum | ( | ) | const |
Returns the sum over all values in the series.
float CTL::PointSeriesBase::sum | ( | const std::vector< float > & | weights | ) | const |
Returns the weighted sum of all values in the series. Each value in the series is multiplied by the corresponding weight factor from weights within summation. The weight vector must contain at least as many elements as there are samples in the series.
float CTL::PointSeriesBase::value | ( | uint | sampleNb | ) | const |
Returns the value (i.e. 'y' part) of the sample with index sampleNb in this series.
Range< float > CTL::PointSeriesBase::valueRange | ( | ) | const |
std::vector< float > CTL::PointSeriesBase::values | ( | ) | const |
Returns all values (i.e. 'y' part) in this series as an std::vector.
Preserves the original order of the points.
float CTL::PointSeriesBase::weightedSum | ( | const std::vector< float > & | weights | ) | const |