Skip to main content

TFplot

Namespace: DISPLIB  ·  Library: Display Library

#include <disp/tfplot.h>

class DISPLIB::TFplot

Time-frequency spectrogram QWidget rendering an Eigen matrix as a colour image.

Two constructors accept either a full or a frequency-cropped MatrixXd spectrogram together with a sample rate and a DISPLIB::ColorMaps "ColorMaps" enum entry; calc_plot() builds the cached QImage that subsequent paintEvents draw.

src/examples/ex_disp_plots/main.cpp
MatrixXd tf = MatrixXd::Zero(50, 40); // frequency rows x time columns
tf.middleRows(20, 10).setConstant(1.0); // 20-30 Hz band at 100 Hz sampling
TFplot tfPlot(tf, 100.0, 0.0, 50.0, Jet);

Inheritance​


Public Methods​

TFplot(tf_matrix, sample_rate, lower_frq, upper_frq, cmap)​

Constructs TFplot class.

Parameters:

  • tf_matrix : Eigen::MatrixXd given spectrogram.

  • sample_rate : qreal given sample rate of signal related to th spectrogram.

  • lower_frq : qreal lower bound frequency, that should be plotted.

  • upper_frq : qreal upper bound frequency, that should be plotted.

  • cmap : ColorMaps colormap used to plot the spectrogram.


TFplot(tf_matrix, sample_rate, cmap)​

Constructs TFplot class.

Parameters:

  • tf_matrix : Eigen::MatrixXd given spectrogram.

  • sample_rate : qreal given sample rate of signal related to th spectrogram.

  • cmap : ColorMaps colormap used to plot the spectrogram.


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 194
MatrixXd tf = MatrixXd::Zero(50, 40); // frequency rows x time columns
tf.middleRows(20, 10).setConstant(1.0); // 20-30 Hz band at 100 Hz sampling
TFplot tfPlot(tf, 100.0, 0.0, 50.0, Jet);
const QImage tfImage = render(tfPlot);
ok &= expect(countColor(tfImage, ColorMap::valueToJet(1.0), 10) > 100 && countColor(tfImage, ColorMap::valueToJet(0.0), 10) > countColor(tfImage, ColorMap::valueToJet(1.0), 10),
"TFplot draws the 20-30 Hz band in the top colour over a bottom-colour background");

ex_connectivity​

Example of using the MNE-CPP Connectivity library.

src/examples/ex_connectivity/connectivitysettingsmanager.h, line 116
TFplot::SPtr m_pTfPlot;
Eigen::MatrixXd m_matEvoked;
Eigen::MatrixXd m_matEvokedSource;
MNELIB::MNEEpochDataList epochs;

ex_disp​

Disp library widgets: image map, line plot and time-frequency plot of raw data.

src/examples/ex_disp/main.cpp, line 221
TFplot tfplot(dataSpectrum, raw.info.sfreq, 0, 100, ColorMaps::Jet);
tfplot.show();

Also used in ex_tf_plot.

Authors of this file​