CTL
0.6.1
Computed Tomography Library
|
The XYDataSeries class is container for a series of data points, each representing x and y value pairs. More...
#include <xydataseries.h>
Public Types | |
enum | Sampling { Linear, Exponential } |
Public Member Functions | |
XYDataSeries (QList< QPointF > &&dataSeries) | |
XYDataSeries (const QList< QPointF > &dataSeries) | |
XYDataSeries (const QVector< float > &x, const QVector< float > &y) | |
XYDataSeries (const std::vector< float > &x, const std::vector< float > &y) | |
void | append (const QPointF &sample) |
void | append (float x, float y) |
void | append (const QList< QPointF > &series) |
void | remove (uint idx) |
void | remove (const QPointF &sample) |
QList< QPointF > & | data () |
void | normalizeByMaxAbsVal () |
void | normalizeByMaxVal () |
void | scaleValues (float factor) |
const QList< QPointF > & | data () const |
![]() | |
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 |
Static Public Member Functions | |
static XYDataSeries | sampledFromModel (const AbstractDataModel &dataModel, const QVector< float > &samplingPoints) |
static XYDataSeries | sampledFromModel (std::shared_ptr< AbstractDataModel > dataModel, const QVector< float > &samplingPoints) |
static XYDataSeries | sampledFromModel (const AbstractDataModel &dataModel, const std::vector< float > &samplingPoints) |
static XYDataSeries | sampledFromModel (std::shared_ptr< AbstractDataModel > dataModel, const std::vector< float > &samplingPoints) |
static XYDataSeries | sampledFromModel (const AbstractDataModel &dataModel, SamplingRange samplingRange, uint nbSamples, Sampling samplingPattern=Linear) |
static XYDataSeries | sampledFromModel (std::shared_ptr< AbstractDataModel > dataModel, SamplingRange samplingRange, uint nbSamples, Sampling samplingPattern=Linear) |
static XYDataSeries | sampledFromModel (const AbstractDataModel &dataModel, float from, float to, uint nbSamples, Sampling samplingPattern=Linear) |
static XYDataSeries | sampledFromModel (std::shared_ptr< AbstractDataModel > dataModel, float from, float to, uint nbSamples, Sampling samplingPattern=Linear) |
Additional Inherited Members | |
![]() | |
PointSeriesBase (const QList< QPointF > &pointSeries) | |
PointSeriesBase (QList< QPointF > &&pointSeries) | |
void | normalizeByMaxAbsVal () |
void | normalizeByMaxVal () |
void | scaleValues (float factor) |
![]() | |
QList< QPointF > | _data |
The XYDataSeries class is container for a series of data points, each representing x and y value pairs.
This class is a sub-class of PointSeriesBase that provides full manipulation possibilities on the managed data. Data points can be added to the series using append() and removed from it through remove(). Data can also be scaled and normalized.
An XYDataSeries can also be generated by sampling data from an AbstractDataModel sub-class using one of various factory methods sampledFromModel().
Examples:
If the gui_widgets_charts.pri module is available, data from XYDataSeries objects can easily be visualized with a gui::LineSeriesView.
Example:
CTL::XYDataSeries::XYDataSeries | ( | QList< QPointF > && | dataSeries | ) |
Constructs an XYDataSeries object and sets its data to dataSeries.
CTL::XYDataSeries::XYDataSeries | ( | const QList< QPointF > & | dataSeries | ) |
Constructs an XYDataSeries object and sets its data to dataSeries.
CTL::XYDataSeries::XYDataSeries | ( | const QVector< float > & | x, |
const QVector< float > & | y | ||
) |
Constructs an XYDataSeries object and sets its data to the (x,y)-tuples formed by x and y. x and y must have the same size; throws an exception otherwise.
Example:
CTL::XYDataSeries::XYDataSeries | ( | const std::vector< float > & | x, |
const std::vector< float > & | y | ||
) |
Constructs an XYDataSeries object and sets its data to the (x,y)-tuples formed by x and y. x and y must have the same size; throws an exception otherwise.
Example:
void CTL::XYDataSeries::append | ( | const QPointF & | sample | ) |
Appends the (x,y)-tuple sample to this series.
void CTL::XYDataSeries::append | ( | float | x, |
float | y | ||
) |
Appends the (x,y)-tuple to this series.
void CTL::XYDataSeries::append | ( | const QList< QPointF > & | series | ) |
Appends all points from series to this series.
const QList< QPointF > & CTL::PointSeriesBase::data |
Returns a reference-to-const to the data managed by this instance.
QList< QPointF > & CTL::XYDataSeries::data | ( | ) |
Returns a (modifiable) reference to the data of this series.
void CTL::XYDataSeries::remove | ( | uint | idx | ) |
Removes the data point at index position idx. \ idx must be a valid index position in the series.
void CTL::XYDataSeries::remove | ( | const QPointF & | sample | ) |
Removes the data point sample from the series. Does nothing if this series contains no such point. If sample is contained multiple times, all occurrences are removed.
|
static |
Creates an XYDataSeries by sampling values from dataModel at each position specified in samplingPoints.
Example:
|
static |
Creates an XYDataSeries by sampling values from dataModel at each position specified in samplingPoints.
Example:
|
static |
Creates an XYDataSeries by sampling values from dataModel at each position specified in samplingPoints.
Example:
|
static |
Creates an XYDataSeries by sampling values from dataModel at each position specified in samplingPoints.
Example:
|
static |
Creates an XYDataSeries by sampling values from dataModel at nbSamples points covering the range specified by samplingRange. Sampling points will be distributed across the range according to the flag specified by samplingPattern. This can be either Linear or Exponential, resulting in a linear (i.e. equidistant samples) pattern or sampling points with exponentially increasing distances, respectively.
Example:
|
static |
Creates an XYDataSeries by sampling values from dataModel at nbSamples points covering the range specified by samplingRange. Sampling points will be distributed across the range according to the flag specified by samplingPattern. This can be either Linear or Exponential, resulting in a linear (i.e. equidistant samples) pattern or sampling points with exponentially increasing distances, respectively.
Example:
|
static |
Creates an XYDataSeries by sampling values from dataModel at nbSamples points covering the range [from, to]. Sampling points will be distributed across the range according to the flag specified by samplingPattern. This can be either Linear or Exponential, resulting in a linear (i.e. equidistant samples) pattern or sampling points with exponentially increasing distances, respectively.
Example:
|
static |
Creates an XYDataSeries by sampling values from dataModel at nbSamples points covering the range [from, to]. Sampling points will be distributed across the range according to the flag specified by samplingPattern. This can be either Linear or Exponential, resulting in a linear (i.e. equidistant samples) pattern or sampling points with exponentially increasing distances, respectively.
Example:
void CTL::PointSeriesBase::scaleValues |
Normalizes the series by dividing all values (i.e. 'y' part) by the maximum absolute value.
Example:
.
Example: