Skip to main content

ImageSc

Namespace: DISPLIB  ·  Library: Display Library

#include <disp/imagesc.h>

class DISPLIB::ImageSc

False-colour heat-map QWidget visualising an Eigen matrix with selectable colour map.

Accepts MatrixXd, MatrixXf and MatrixXi inputs; init() rebuilds the cached QImage from the current matrix and the active colour map, and updateData() / paintEvent() keep the rendering in sync with the data.

src/examples/ex_disp_plots/main.cpp
MatrixXd ramp(4, 8);
for (int r = 0; r < ramp.rows(); ++r) {
for (int c = 0; c < ramp.cols(); ++c) {
ramp(r, c) = c; // rises left to right
}
}
ImageSc image(ramp); // min..max mapped to 0..1, "Hot" by default
image.setColorMap("Viridis");
image.setTitle("ramp");

Inheritance​


Public Methods​

ImageSc(parent)​

Creates the scaled image view.

Parameters:

  • parent : *QWidget ** Parent QObject (optional).

ImageSc(p_dMat, parent)​

Creates the scaled image view with a given double matrix.

Parameters:

  • p_dMat : Eigen::MatrixXd & The double data matrix.

  • parent : *QWidget ** Parent QObject (optional).


ImageSc(p_fMat, parent)​

Creates the scaled image view with a given float matrix.

Parameters:

  • p_fMat : Eigen::MatrixXf & The float data matrix.

  • parent : *QWidget ** Parent QObject (optional).


ImageSc(p_iMat, parent)​

Creates the scaled image view with a given integer matrix.

Parameters:

  • p_iMat : Eigen::MatrixXi & The integer data matrix.

  • parent : *QWidget ** Parent QObject (optional).


~ImageSc()​

Destructs the ImageSc object.


init()​

Initializes the ImageSc object.


updateData(p_dMat)​

Updates the scaled image view with a given double matrix.

Parameters:

  • p_dMat : Eigen::MatrixXd & The double data matrix.

updateData(p_fMat)​

Updates the scaled image view with a given float matrix.

Parameters:

  • p_fMat : Eigen::MatrixXf & The float data matrix.

updateData(p_iMat)​

Updates the scaled image view with a given integer matrix.

Parameters:

  • p_iMat : Eigen::MatrixXi & The integer data matrix.

setColorMap(p_sColorMap)​

Sets the color map to use, e.g.

"Jet", "Hot", "Bone"

Parameters:

  • p_sColorMap : const QString & The colormap to use.

Example​

Used in examples​

ex_disp​

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

src/examples/ex_disp/main.cpp, line 199
//ImageSc example
ImageSc imagesc(data);
imagesc.setTitle("Data ImageSc");
imagesc.setXLabel("X Axes");
imagesc.setYLabel("Y Axes");
imagesc.setColorMap("Hot"); //imagesc.setColorMap("Jet");//imagesc.setColorMap("RedBlue");//imagesc.setColorMap("Bone");//imagesc.setColorMap("Jet");//imagesc.setColorMap("Hot");
imagesc.show();

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 174
ImageSc image(ramp); // min..max mapped to 0..1, "Hot" by default
image.setColorMap("Viridis");
image.setTitle("ramp");
const QImage scImage = render(image);
// Data area: x in [60, 340); first and last columns are the colour map ends
ok &= expect(close(scImage.pixel(70, 150), qRgb(68, 1, 84), 4) && close(scImage.pixel(330, 150), qRgb(253, 231, 37), 4),
"ImageSc maps the minimum and maximum columns to the ends of viridis");

ex_connectivity​

Example of using the MNE-CPP Connectivity library.

src/examples/ex_connectivity/connectivitysettingsmanager.h, line 111
DISPLIB::Plot* m_pEvokedSignalCoursePlot = nullptr;
DISPLIB::Plot* m_pEpochSignalCoursePlot = nullptr;
DISPLIB::Plot* m_pEvokedSourceSignalCoursePlot = nullptr;
DISPLIB::ImageSc* m_pImageConnWeights = nullptr;

Authors of this file​