Skip to main content

Spline

Namespace: DISPLIB  ·  Library: Display Library  ·  Source: disp/plots/spline.h

#include <disp/spline.h>

class DISPLIB::Spline

Histogram QWidget with cubic-spline overlay and interactive threshold markers.

Click-drag drops left / middle / right threshold lines that are emitted as data-space coordinates; otherwise the API mirrors Bar (setData / updatePlot templates).

src/examples/ex_disp_plots/main.cpp
Spline spline(nullptr, "Amplitude spline");
spline.setData(classLimits, counts);
spline.setThreshold(QVector3D(1.0f, 2.0f, 3.0f)); // three vertical marker lines
spline.setXLabel("Amplitude");
spline.setYLabel("Count");

Inheritance​


Public Methods​

Spline(parent, title)​

The constructor for Spline.

Parameters:

  • parent : *QWidget ** sets the behaviour of Spline as an object, defaults to no parent QWidget.

  • title : const QString & title drawn above the histogram, defaults to "Spline Histogram".


setData(matClassLimitData, matClassFrequencyData)​

creates a spline histogram from 2 vectors: class limits and class frequency

Parameters:

  • matClassLimitData : const Eigen::Matrix< T, Eigen::Dynamic, 1 > & vector input filled with class limits.

  • matClassFrequencyData : const Eigen::Matrix< int, Eigen::Dynamic, 1 > & vector input filled with class frequency to the corresponding class.


setData(matClassLimitData, matClassFrequencyData)​


updatePlot(matClassLimitData, matClassFrequencyData)​

Updates the spline with new data.

Parameters:

  • matClassLimitData : const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > & vector input filled with class limits.

  • matClassFrequencyData : const Eigen::VectorXi & vector input filled with class frequency to the corresponding class.


mousePressEvent(event)​

constructor for mouse press event behaviour to create threshold lines and signal emit

Parameters:

  • event : *QMouseEvent ** mouse press input.

setThreshold(vecThresholdValues)​

setThreshold takes in QVector3D value and creates the corresponding lines in the histogram

Parameters:

  • vecThresholdValues : const QVector3D & QVector3D consisting of 3 values corresponding to the threshold lines.

getThreshold()​

getThreshold retrieves the current threshold values

Returns:

  • const QVector3D & — returns QVector3D corresponding to the x-axis value of the threshold lines.

setColorMap(colorMap)​

setColorMap sets the color mapping on the histogram background

Parameters:

  • colorMap : const QString & qstring of the color gradient from user input.

setXLabel(label)​

Sets the label of the x axis, e.g.

the quantity and unit of the class limits.

Parameters:

  • label : const QString & The x axis label.

setYLabel(label)​

Sets the label of the y axis.

Parameters:

  • label : const QString & The y axis label.

Example​

Used in examples​

ex_disp_plots​

Disp plots: colour maps, bar and spline histograms, line plots, image and time-frequency maps.

src/examples/ex_disp_plots/main.cpp, line 140
Spline spline(nullptr, "Amplitude spline");
spline.setData(classLimits, counts);
spline.setThreshold(QVector3D(1.0f, 2.0f, 3.0f)); // three vertical marker lines
spline.setXLabel("Amplitude");
spline.setYLabel("Count");
ok &= expect(countColor(render(spline), steelBlue, 30) > 50, "Spline draws its curve");

ex_histogram​

Histogram of the source amplitudes of a clustered MNE, dSPM or sLORETA estimate of the sample evoked response.

src/examples/ex_histogram/main.cpp, line 218
//displayObj can be in either Bar or Spline form; uncomment the preferred one and comment the other
Spline* displayObj = new Spline(0, QString("%1 of %2 clustered sources at 100 ms").arg(method).arg(sourceEstimateData.size()));
//Bar* displayObj = new Bar("MNE-CPP Histogram Example (Bar)");

Authors of this file​