v2.0.0
Loading...
Searching...
No Matches
DISPLIB::ChannelDataView Class Reference

ChannelDataView – high-performance, GPU-accelerated channel signal viewer. More...

#include <channeldataview.h>

Public Types

typedef QSharedPointer< ChannelDataViewSPtr
typedef QSharedPointer< const ChannelDataViewConstSPtr
Public Types inherited from DISPLIB::AbstractView
enum  StyleMode { Default , Dark }
enum  GuiMode { Clinical , Research }
enum  ProcessingMode { RealTime , Offline }
typedef QSharedPointer< AbstractViewSPtr
typedef QSharedPointer< const AbstractViewConstSPtr

Signals

void sampleClicked (int sample)
void scrollPositionChanged (int sample)
void sampleRangeSelected (int startSample, int endSample)
void annotationBoundaryMoved (int annotationIndex, bool isStartBoundary, int newSample)
void referenceMarkerAddRequested (int sample)
void referenceMarkerRemoveRequested (int sample)
void referenceMarkersClearRequested ()
void crosshairToggled (bool on)
void butterflyToggled (bool on)
void scalebarsToggled (bool on)
void eventsVisibleToggled (bool on)
void annotationsVisibleToggled (bool on)
void overviewBarToggled (bool on)
void scrollSpeedChanged (float factor)
void epochMarkersToggled (bool on)
void clippingToggled (bool on)
void zScoreModeToggled (bool on)
void cursorDataChanged (float timeSec, float amplitude, const QString &channelName, const QString &unitLabel)
Signals inherited from DISPLIB::AbstractView
void guiStyleChanged (DISPLIB::AbstractView::StyleMode style)

Public Member Functions

 ChannelDataView (const QString &sSettingsPath=QString(), QWidget *parent=nullptr, Qt::WindowFlags f=Qt::Widget)
 ~ChannelDataView () override
void init (QSharedPointer< FIFFLIB::FiffInfo > pInfo)
void setData (const Eigen::MatrixXd &data, int firstSample=0)
void addData (const Eigen::MatrixXd &data)
void scrollToSample (int sample, bool animate=true)
void setWindowSize (float seconds)
float windowSize () const
void setZoom (double factor)
double zoom () const
void setBackgroundColor (const QColor &color)
QColor backgroundColor () const
void setSignalColor (const QColor &color)
QColor signalColor () const
void setScalingMap (const QMap< qint32, float > &scaleMap)
QMap< qint32, float > scalingMap () const
void hideBadChannels (bool hide)
bool badChannelsHidden () const
void setChannelFilter (const QStringList &names)
void setRemoveDC (bool dc)
void setDetrendMode (DetrendMode mode)
DetrendMode detrendMode () const
void setFileBounds (int first, int last)
void setEvents (const QVector< ChannelRhiView::EventMarker > &events)
void setEpochMarkers (const QVector< int > &triggerSamples)
void setEpochMarkersVisible (bool visible)
bool epochMarkersVisible () const
void setClippingVisible (bool visible)
bool clippingVisible () const
void setZScoreMode (bool enabled)
bool zScoreMode () const
void setReferenceMarkers (const QVector< TimeRulerReferenceMark > &markers)
void setAnnotations (const QVector< ChannelRhiView::AnnotationSpan > &annotations)
void setAnnotationSelectionEnabled (bool enabled)
void setEventsVisible (bool visible)
bool eventsVisible () const
void setAnnotationsVisible (bool visible)
bool annotationsVisible () const
void setOverviewBarVisible (bool visible)
bool overviewBarVisible () const
void setScrollSpeedFactor (float factor)
float scrollSpeedFactor () const
void sortChannelsByType ()
void resetChannelOrder ()
void setCrosshairEnabled (bool enabled)
bool crosshairEnabled () const
void setScalebarsVisible (bool visible)
bool scalebarsVisible () const
void setButterflyMode (bool enabled)
bool butterflyMode () const
void toggleTimeFormat ()
void setClockTimeFormat (bool useClock)
bool clockTimeFormat () const
void saveSettings () override
void loadSettings () override
void clearView () override
int firstVisibleSample () const
int visibleSampleCount () const
QRect signalViewportRect () const
int sampleToViewportX (int sample) const
int viewportXToSample (int x) const
ChannelDataModelmodel () const
Public Member Functions inherited from DISPLIB::AbstractView
 AbstractView (QWidget *parent=0, Qt::WindowFlags f=Qt::Widget)
virtual void setGuiMode (GuiMode mode)
virtual void setProcessingMode (ProcessingMode mode)

Protected Member Functions

void updateGuiMode (GuiMode mode) override
void updateProcessingMode (ProcessingMode mode) override
void keyPressEvent (QKeyEvent *event) override
void resizeEvent (QResizeEvent *event) override

Additional Inherited Members

Protected Attributes inherited from DISPLIB::AbstractView
bool m_bResearchModeIsActive
bool m_bOfflineModeIsActive
QString m_sSettingsPath

Detailed Description

ChannelDataView – high-performance, GPU-accelerated channel signal viewer.

Drop-in companion to RtFiffRawView that replaces the QTableView + RawDelegate + QOpenGLWidget stack with a single QRhiWidget-based rendering surface.

Key features:

  • GPU rendering on all platforms (OpenGL/ES, Metal, Vulkan, D3D12, WebGL2 / WASM)
  • Min/max decimation: constant rendering cost regardless of zoom level or file size
  • Smooth scroll and zoom animations via QPropertyAnimation
  • Drag-to-scroll with middle mouse button or Alt + left drag
  • Ctrl + mouse wheel zoom
  • Channel-type-aware colours and amplitude scales
  • Compatible with RtFiffRawView's public API for easy migration

Typical usage:

auto *view = new ChannelDataView(this);
view->init(fiffInfo);
view->addData(matrix); // Eigen::MatrixXd, channels × samples
view->setWindowSize(5); // 5-second display window
// ... or:
view->scrollToSample(1000, true); // smooth animate
ChannelDataView(const QString &sSettingsPath=QString(), QWidget *parent=nullptr, Qt::WindowFlags f=Qt::Widget)

Definition at line 119 of file channeldataview.h.

Inheritance diagram for DISPLIB::ChannelDataView:
Inheritance graph

Member Typedef Documentation

◆ ConstSPtr

Definition at line 125 of file channeldataview.h.

◆ SPtr

Definition at line 124 of file channeldataview.h.

Constructor & Destructor Documentation

◆ ChannelDataView()

ChannelDataView::ChannelDataView ( const QString & sSettingsPath = QString(),
QWidget * parent = nullptr,
Qt::WindowFlags f = Qt::Widget )
explicit

Constructs a ChannelDataView.

Parameters
[in]sSettingsPathQSettings prefix for persistent GUI settings.
[in]parentParent widget.
[in]fWindow flags.

Definition at line 153 of file channeldataview.cpp.

◆ ~ChannelDataView()

ChannelDataView::~ChannelDataView ( )
override

Definition at line 166 of file channeldataview.cpp.

Member Function Documentation

◆ addData()

void ChannelDataView::addData ( const Eigen::MatrixXd & data)

Append new samples (real-time streaming use-case).

Parameters
[in]dataChannels × new-samples matrix.

Definition at line 454 of file channeldataview.cpp.

◆ annotationBoundaryMoved

void DISPLIB::ChannelDataView::annotationBoundaryMoved ( int annotationIndex,
bool isStartBoundary,
int newSample )
signal

Emitted when the user drags an annotation boundary to a new position.

◆ annotationsVisible()

bool ChannelDataView::annotationsVisible ( ) const

Definition at line 717 of file channeldataview.cpp.

◆ annotationsVisibleToggled

void DISPLIB::ChannelDataView::annotationsVisibleToggled ( bool on)
signal

◆ backgroundColor()

QColor ChannelDataView::backgroundColor ( ) const

Definition at line 511 of file channeldataview.cpp.

◆ badChannelsHidden()

bool ChannelDataView::badChannelsHidden ( ) const

Definition at line 561 of file channeldataview.cpp.

◆ butterflyMode()

bool ChannelDataView::butterflyMode ( ) const

Definition at line 824 of file channeldataview.cpp.

◆ butterflyToggled

void DISPLIB::ChannelDataView::butterflyToggled ( bool on)
signal

◆ clearView()

void ChannelDataView::clearView ( )
overridevirtual

Clears the view

Implements DISPLIB::AbstractView.

Definition at line 956 of file channeldataview.cpp.

◆ clippingToggled

void DISPLIB::ChannelDataView::clippingToggled ( bool on)
signal

◆ clippingVisible()

bool ChannelDataView::clippingVisible ( ) const

Definition at line 654 of file channeldataview.cpp.

◆ clockTimeFormat()

bool ChannelDataView::clockTimeFormat ( ) const

Definition at line 852 of file channeldataview.cpp.

◆ crosshairEnabled()

bool ChannelDataView::crosshairEnabled ( ) const

Definition at line 796 of file channeldataview.cpp.

◆ crosshairToggled

void DISPLIB::ChannelDataView::crosshairToggled ( bool on)
signal

◆ cursorDataChanged

void DISPLIB::ChannelDataView::cursorDataChanged ( float timeSec,
float amplitude,
const QString & channelName,
const QString & unitLabel )
signal

Forwarded from the underlying ChannelRhiView when the crosshair is active.

◆ detrendMode()

DetrendMode ChannelDataView::detrendMode ( ) const

Definition at line 605 of file channeldataview.cpp.

◆ epochMarkersToggled

void DISPLIB::ChannelDataView::epochMarkersToggled ( bool on)
signal

◆ epochMarkersVisible()

bool ChannelDataView::epochMarkersVisible ( ) const

Definition at line 643 of file channeldataview.cpp.

◆ eventsVisible()

bool ChannelDataView::eventsVisible ( ) const

Definition at line 704 of file channeldataview.cpp.

◆ eventsVisibleToggled

void DISPLIB::ChannelDataView::eventsVisibleToggled ( bool on)
signal

◆ firstVisibleSample()

int ChannelDataView::firstVisibleSample ( ) const

Returns the first currently visible sample.

Definition at line 859 of file channeldataview.cpp.

◆ hideBadChannels()

void ChannelDataView::hideBadChannels ( bool hide)

Show or hide channels marked bad.

Parameters
[in]hideIf true, bad channels are collapsed to zero height.

Definition at line 549 of file channeldataview.cpp.

◆ init()

void ChannelDataView::init ( QSharedPointer< FIFFLIB::FiffInfo > pInfo)

Initialise the view from a FiffInfo (channel names, types, sampling rate).

Parameters
[in]pInfoShared pointer to FiffInfo.

Definition at line 396 of file channeldataview.cpp.

◆ keyPressEvent()

void ChannelDataView::keyPressEvent ( QKeyEvent * event)
overrideprotected

Definition at line 980 of file channeldataview.cpp.

◆ loadSettings()

void ChannelDataView::loadSettings ( )
overridevirtual

Loads and inits all important settings of this view via QSettings.

Implements DISPLIB::AbstractView.

Definition at line 931 of file channeldataview.cpp.

◆ model()

ChannelDataModel * DISPLIB::ChannelDataView::model ( ) const
inline

Returns the underlying data model (non-owning pointer). Use for advanced configuration such as setMaxStoredSamples().

Definition at line 422 of file channeldataview.h.

◆ overviewBarToggled

void DISPLIB::ChannelDataView::overviewBarToggled ( bool on)
signal

◆ overviewBarVisible()

bool ChannelDataView::overviewBarVisible ( ) const

Definition at line 730 of file channeldataview.cpp.

◆ referenceMarkerAddRequested

void DISPLIB::ChannelDataView::referenceMarkerAddRequested ( int sample)
signal

Emitted when the ruler context menu requests a new sample marker.

◆ referenceMarkerRemoveRequested

void DISPLIB::ChannelDataView::referenceMarkerRemoveRequested ( int sample)
signal

Emitted when the ruler context menu requests removal of a nearby sample marker.

◆ referenceMarkersClearRequested

void DISPLIB::ChannelDataView::referenceMarkersClearRequested ( )
signal

Emitted when the ruler context menu requests clearing all sample markers.

◆ resetChannelOrder()

void ChannelDataView::resetChannelOrder ( )

Definition at line 779 of file channeldataview.cpp.

◆ resizeEvent()

void ChannelDataView::resizeEvent ( QResizeEvent * event)
overrideprotected

Definition at line 1092 of file channeldataview.cpp.

◆ sampleClicked

void DISPLIB::ChannelDataView::sampleClicked ( int sample)
signal

Emitted when the user clicks on a sample position.

Parameters
[in]sampleAbsolute sample index under the cursor.

◆ sampleRangeSelected

void DISPLIB::ChannelDataView::sampleRangeSelected ( int startSample,
int endSample )
signal

Emitted when the user selected a sample range for annotation creation.

◆ sampleToViewportX()

int ChannelDataView::sampleToViewportX ( int sample) const

Maps an absolute sample index to an x coordinate inside the signal viewport.

Parameters
[in]sampleAbsolute sample index.
Returns
x position in ChannelDataView-local coordinates.

Definition at line 880 of file channeldataview.cpp.

◆ saveSettings()

void ChannelDataView::saveSettings ( )
overridevirtual

Saves all important settings of this view via QSettings.

Implements DISPLIB::AbstractView.

Definition at line 918 of file channeldataview.cpp.

◆ scalebarsToggled

void DISPLIB::ChannelDataView::scalebarsToggled ( bool on)
signal

◆ scalebarsVisible()

bool ChannelDataView::scalebarsVisible ( ) const

Definition at line 809 of file channeldataview.cpp.

◆ scalingMap()

QMap< qint32, float > ChannelDataView::scalingMap ( ) const

Definition at line 542 of file channeldataview.cpp.

◆ scrollPositionChanged

void DISPLIB::ChannelDataView::scrollPositionChanged ( int sample)
signal

Emitted whenever the scroll position changes.

Parameters
[in]sampleCurrent left-edge sample index.

◆ scrollSpeedChanged

void DISPLIB::ChannelDataView::scrollSpeedChanged ( float factor)
signal

◆ scrollSpeedFactor()

float ChannelDataView::scrollSpeedFactor ( ) const

Definition at line 743 of file channeldataview.cpp.

◆ scrollToSample()

void ChannelDataView::scrollToSample ( int sample,
bool animate = true )

Scroll to the given absolute sample index.

Parameters
[in]sampleTarget left-edge sample.
[in]animateIf true, animate with a smooth cubic ease-out.

Definition at line 462 of file channeldataview.cpp.

◆ setAnnotations()

void ChannelDataView::setAnnotations ( const QVector< ChannelRhiView::AnnotationSpan > & annotations)

Set the list of annotation spans to display as translucent overlays.

Parameters
[in]annotationsList of AnnotationSpan objects.

Definition at line 680 of file channeldataview.cpp.

◆ setAnnotationSelectionEnabled()

void ChannelDataView::setAnnotationSelectionEnabled ( bool enabled)

Enable or disable annotation span selection in the raw browser.

Definition at line 690 of file channeldataview.cpp.

◆ setAnnotationsVisible()

void ChannelDataView::setAnnotationsVisible ( bool visible)

Definition at line 711 of file channeldataview.cpp.

◆ setBackgroundColor()

void ChannelDataView::setBackgroundColor ( const QColor & color)

Set the background colour of the rendering surface.

Parameters
[in]colorNew background colour.

Definition at line 501 of file channeldataview.cpp.

◆ setButterflyMode()

void ChannelDataView::setButterflyMode ( bool enabled)

Toggle butterfly mode (overlay all same-type channels).

Definition at line 816 of file channeldataview.cpp.

◆ setChannelFilter()

void ChannelDataView::setChannelFilter ( const QStringList & names)

Restrict the view to a named subset of channels. Channels not in names are hidden immediately. Pass an empty list to restore all channels.

Parameters
[in]namesList of channel names to show (case-sensitive).

Definition at line 568 of file channeldataview.cpp.

◆ setClippingVisible()

void ChannelDataView::setClippingVisible ( bool visible)

Definition at line 648 of file channeldataview.cpp.

◆ setClockTimeFormat()

void ChannelDataView::setClockTimeFormat ( bool useClock)

Set clock time format on the ruler.

Definition at line 842 of file channeldataview.cpp.

◆ setCrosshairEnabled()

void ChannelDataView::setCrosshairEnabled ( bool enabled)

Enable or disable the crosshair cursor with coordinate readout.

Definition at line 790 of file channeldataview.cpp.

◆ setData()

void ChannelDataView::setData ( const Eigen::MatrixXd & data,
int firstSample = 0 )

Replace all buffered data.

Parameters
[in]dataChannels × samples matrix.
[in]firstSampleAbsolute sample index of column 0.

Definition at line 446 of file channeldataview.cpp.

◆ setDetrendMode()

void ChannelDataView::setDetrendMode ( DetrendMode mode)

Set the detrending mode for on-the-fly trend removal during rendering. None = raw, Mean = DC offset, Linear = least-squares linear fit.

Parameters
[in]modeThe DetrendMode to use.

Definition at line 598 of file channeldataview.cpp.

◆ setEpochMarkers()

void ChannelDataView::setEpochMarkers ( const QVector< int > & triggerSamples)

Definition at line 631 of file channeldataview.cpp.

◆ setEpochMarkersVisible()

void ChannelDataView::setEpochMarkersVisible ( bool visible)

Definition at line 637 of file channeldataview.cpp.

◆ setEvents()

void ChannelDataView::setEvents ( const QVector< ChannelRhiView::EventMarker > & events)

Set the list of event / stimulus markers to display as coloured vertical lines. Pass an empty vector to clear all markers.

Parameters
[in]eventsList of EventMarker objects.

Definition at line 612 of file channeldataview.cpp.

◆ setEventsVisible()

void ChannelDataView::setEventsVisible ( bool visible)

Definition at line 698 of file channeldataview.cpp.

◆ setFileBounds()

void ChannelDataView::setFileBounds ( int first,
int last )

Set the absolute sample indices of the file's first and last samples. The scrollbar range and mouse-pan clamp use these to prevent scrolling outside the actual file boundaries regardless of the ring-buffer state.

Parameters
[in]firstAbsolute sample index of the file's first sample.
[in]lastAbsolute sample index of the file's last sample.

Definition at line 427 of file channeldataview.cpp.

◆ setOverviewBarVisible()

void ChannelDataView::setOverviewBarVisible ( bool visible)

Definition at line 724 of file channeldataview.cpp.

◆ setReferenceMarkers()

void ChannelDataView::setReferenceMarkers ( const QVector< TimeRulerReferenceMark > & markers)

Set the list of persistent sample/reference markers shown in the time ruler.

Parameters
[in]markersReference markers to display in the ruler.

Definition at line 672 of file channeldataview.cpp.

◆ setRemoveDC()

void ChannelDataView::setRemoveDC ( bool dc)

Enable or disable DC (mean) removal applied at render time. Takes effect immediately — the view redraws with the current data.

Parameters
[in]dctrue = subtract per-channel mean from each rendered window.

Definition at line 591 of file channeldataview.cpp.

◆ setScalebarsVisible()

void ChannelDataView::setScalebarsVisible ( bool visible)

Show or hide per-channel-type amplitude scalebars.

Definition at line 803 of file channeldataview.cpp.

◆ setScalingMap()

void ChannelDataView::setScalingMap ( const QMap< qint32, float > & scaleMap)

Set the per-channel-type amplitude scale map. Keys should be FIFF channel kind constants (FIFFV_MEG_CH, FIFFV_EEG_CH, …).

Parameters
[in]scaleMapMap from FIFF kind to physical amplitude (e.g. 1.2e-12 for MEG).

Definition at line 534 of file channeldataview.cpp.

◆ setScrollSpeedFactor()

void ChannelDataView::setScrollSpeedFactor ( float factor)

Definition at line 737 of file channeldataview.cpp.

◆ setSignalColor()

void ChannelDataView::setSignalColor ( const QColor & color)

Set the default signal line colour (used for channel types without a type-specific colour).

Parameters
[in]colorNew signal colour.

Definition at line 518 of file channeldataview.cpp.

◆ setWindowSize()

void ChannelDataView::setWindowSize ( float seconds)

Set the visible time window (in seconds). This adjusts samplesPerPixel to fit the requested duration.

Parameters
[in]secondsDuration of the visible window.

Definition at line 469 of file channeldataview.cpp.

◆ setZoom()

void ChannelDataView::setZoom ( double factor)

Set the zoom factor (> 1 = zoom in, < 1 = zoom out relative to default).

Parameters
[in]factorZoom multiplier applied to the default samples-per-pixel.

Definition at line 485 of file channeldataview.cpp.

◆ setZScoreMode()

void ChannelDataView::setZScoreMode ( bool enabled)

Definition at line 659 of file channeldataview.cpp.

◆ signalColor()

QColor ChannelDataView::signalColor ( ) const

Definition at line 527 of file channeldataview.cpp.

◆ signalViewportRect()

QRect ChannelDataView::signalViewportRect ( ) const

Returns the geometry of the actual QRHI signal viewport in ChannelDataView-local coordinates.

Definition at line 873 of file channeldataview.cpp.

◆ sortChannelsByType()

void ChannelDataView::sortChannelsByType ( )

Definition at line 750 of file channeldataview.cpp.

◆ toggleTimeFormat()

void ChannelDataView::toggleTimeFormat ( )

Toggle time format between float seconds and HH:MM:SS clock time.

Definition at line 831 of file channeldataview.cpp.

◆ updateGuiMode()

void ChannelDataView::updateGuiMode ( GuiMode mode)
overrideprotectedvirtual

Update the views GUI based on the set GuiMode (Clinical=0, Research=1).

Parameters
modeThe new mode (Clinical=0, Research=1).

Implements DISPLIB::AbstractView.

Definition at line 974 of file channeldataview.cpp.

◆ updateProcessingMode()

void ChannelDataView::updateProcessingMode ( ProcessingMode mode)
overrideprotectedvirtual

Update the views GUI based on the set ProcessingMode (RealTime=0, Offline=1).

Parameters
modeThe new mode (RealTime=0, Offline=1).

Implements DISPLIB::AbstractView.

Definition at line 976 of file channeldataview.cpp.

◆ viewportXToSample()

int ChannelDataView::viewportXToSample ( int x) const

Maps a ChannelDataView-local x coordinate inside the signal viewport to an absolute sample index.

Parameters
[in]xChannelDataView-local x coordinate.
Returns
Absolute sample index at the requested x position.

Definition at line 899 of file channeldataview.cpp.

◆ visibleSampleCount()

int ChannelDataView::visibleSampleCount ( ) const

Definition at line 866 of file channeldataview.cpp.

◆ windowSize()

float ChannelDataView::windowSize ( ) const

Get the current visible time window in seconds.

Definition at line 478 of file channeldataview.cpp.

◆ zoom()

double ChannelDataView::zoom ( ) const

Return the current zoom factor.

Definition at line 494 of file channeldataview.cpp.

◆ zScoreMode()

bool ChannelDataView::zScoreMode ( ) const

Definition at line 665 of file channeldataview.cpp.

◆ zScoreModeToggled

void DISPLIB::ChannelDataView::zScoreModeToggled ( bool on)
signal

The documentation for this class was generated from the following files: