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

Composite real-time multi-channel raw scroller assembling label panel, table view, time ruler and scrollbars. More...

#include <channeldataview.h>

Public Types

typedef QSharedPointer< ChannelDataView > SPtr
typedef QSharedPointer< const ChannelDataView > ConstSPtr
Public Types inherited from DISPLIB::AbstractView
enum  StyleMode { Default , Dark }
enum  GuiMode { Clinical , Research }
enum  ProcessingMode { RealTime , Offline }
typedef QSharedPointer< AbstractView > SPtr
typedef QSharedPointer< const AbstractView > ConstSPtr

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 &matData, int firstSample=0)
void addData (const Eigen::MatrixXd &matData)
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
QImage renderToImage (const QSize &size=QSize()) 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
ChannelDataModel * model () 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

Composite real-time multi-channel raw scroller assembling label panel, table view, time ruler and scrollbars.

Acts as the user-facing host of the ChannelDataModel and RtFiffRawViewDelegate pair, exposing playback / zoom / channel-selection signals consumed by the surrounding plugin GUI.

Definition at line 89 of file channeldataview.h.

Inheritance diagram for DISPLIB::ChannelDataView:
Inheritance graph

Member Typedef Documentation

◆ ConstSPtr

Definition at line 95 of file channeldataview.h.

◆ SPtr

Definition at line 94 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 135 of file channeldataview.cpp.

◆ ~ChannelDataView()

ChannelDataView::~ChannelDataView ( )
override

Definition at line 148 of file channeldataview.cpp.

Member Function Documentation

◆ addData()

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

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

Parameters
[in]matDataChannels × new-samples matrix.

Definition at line 436 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 699 of file channeldataview.cpp.

◆ annotationsVisibleToggled

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

◆ backgroundColor()

QColor ChannelDataView::backgroundColor ( ) const

Definition at line 493 of file channeldataview.cpp.

◆ badChannelsHidden()

bool ChannelDataView::badChannelsHidden ( ) const

Definition at line 543 of file channeldataview.cpp.

◆ butterflyMode()

bool ChannelDataView::butterflyMode ( ) const

Definition at line 815 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 943 of file channeldataview.cpp.

◆ clippingToggled

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

◆ clippingVisible()

bool ChannelDataView::clippingVisible ( ) const

Definition at line 636 of file channeldataview.cpp.

◆ clockTimeFormat()

bool ChannelDataView::clockTimeFormat ( ) const

Definition at line 843 of file channeldataview.cpp.

◆ crosshairEnabled()

bool ChannelDataView::crosshairEnabled ( ) const

Definition at line 780 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 587 of file channeldataview.cpp.

◆ epochMarkersToggled

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

◆ epochMarkersVisible()

bool ChannelDataView::epochMarkersVisible ( ) const

Definition at line 625 of file channeldataview.cpp.

◆ eventsVisible()

bool ChannelDataView::eventsVisible ( ) const

Definition at line 686 of file channeldataview.cpp.

◆ eventsVisibleToggled

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

◆ firstVisibleSample()

int ChannelDataView::firstVisibleSample ( ) const

Returns the first currently visible sample.

Returns
Absolute index of the first visible sample, or 0 if no render view exists.

Definition at line 850 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 531 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 378 of file channeldataview.cpp.

◆ keyPressEvent()

void ChannelDataView::keyPressEvent ( QKeyEvent * event)
overrideprotected

Definition at line 971 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 918 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().

Returns
Non-owning pointer to the ChannelDataModel.

Definition at line 423 of file channeldataview.h.

◆ overviewBarToggled

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

◆ overviewBarVisible()

bool ChannelDataView::overviewBarVisible ( ) const

Definition at line 712 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.

◆ renderToImage()

QImage ChannelDataView::renderToImage ( const QSize & size = QSize()) const

Render the channel traces as currently shown into an image, without the GPU (see ChannelRhiView::renderToImage()). Usable offscreen, e.g. for reports.

Parameters
[in]sizeOutput size in pixels; an invalid size (default) uses the plot size.
Returns
The rendered image, or a null image if the size is empty.

Definition at line 787 of file channeldataview.cpp.

◆ resetChannelOrder()

void ChannelDataView::resetChannelOrder ( )

Definition at line 763 of file channeldataview.cpp.

◆ resizeEvent()

void ChannelDataView::resizeEvent ( QResizeEvent * event)
overrideprotected

Definition at line 1086 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 871 of file channeldataview.cpp.

◆ saveSettings()

void ChannelDataView::saveSettings ( )
overridevirtual

Saves all important settings of this view via QSettings.

Implements DISPLIB::AbstractView.

Definition at line 905 of file channeldataview.cpp.

◆ scalebarsToggled

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

◆ scalebarsVisible()

bool ChannelDataView::scalebarsVisible ( ) const

Definition at line 800 of file channeldataview.cpp.

◆ scalingMap()

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

Definition at line 524 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 726 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 444 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 662 of file channeldataview.cpp.

◆ setAnnotationSelectionEnabled()

void ChannelDataView::setAnnotationSelectionEnabled ( bool enabled)

Enable or disable annotation span selection in the raw browser.

Parameters
[in]enabledTrue to allow selecting annotation spans with the mouse.

Definition at line 672 of file channeldataview.cpp.

◆ setAnnotationsVisible()

void ChannelDataView::setAnnotationsVisible ( bool visible)

Definition at line 693 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 483 of file channeldataview.cpp.

◆ setButterflyMode()

void ChannelDataView::setButterflyMode ( bool enabled)

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

Parameters
[in]enabledTrue to overlay channels of the same type in one lane.

Definition at line 807 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 550 of file channeldataview.cpp.

◆ setClippingVisible()

void ChannelDataView::setClippingVisible ( bool visible)

Definition at line 630 of file channeldataview.cpp.

◆ setClockTimeFormat()

void ChannelDataView::setClockTimeFormat ( bool useClock)

Set clock time format on the ruler.

Parameters
[in]useClockTrue for HH:MM:SS clock time, false for float seconds.

Definition at line 833 of file channeldataview.cpp.

◆ setCrosshairEnabled()

void ChannelDataView::setCrosshairEnabled ( bool enabled)

Enable or disable the crosshair cursor with coordinate readout.

Parameters
[in]enabledTrue to show the crosshair and its time/amplitude readout.

Definition at line 774 of file channeldataview.cpp.

◆ setData()

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

Replace all buffered data.

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

Definition at line 428 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 580 of file channeldataview.cpp.

◆ setEpochMarkers()

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

Definition at line 613 of file channeldataview.cpp.

◆ setEpochMarkersVisible()

void ChannelDataView::setEpochMarkersVisible ( bool visible)

Definition at line 619 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 594 of file channeldataview.cpp.

◆ setEventsVisible()

void ChannelDataView::setEventsVisible ( bool visible)

Definition at line 680 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 409 of file channeldataview.cpp.

◆ setOverviewBarVisible()

void ChannelDataView::setOverviewBarVisible ( bool visible)

Definition at line 706 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 654 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 573 of file channeldataview.cpp.

◆ setScalebarsVisible()

void ChannelDataView::setScalebarsVisible ( bool visible)

Show or hide per-channel-type amplitude scalebars.

Parameters
[in]visibleTrue to draw the scalebars.

Definition at line 794 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 516 of file channeldataview.cpp.

◆ setScrollSpeedFactor()

void ChannelDataView::setScrollSpeedFactor ( float factor)

Definition at line 720 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 500 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 451 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 467 of file channeldataview.cpp.

◆ setZScoreMode()

void ChannelDataView::setZScoreMode ( bool enabled)

Definition at line 641 of file channeldataview.cpp.

◆ signalColor()

QColor ChannelDataView::signalColor ( ) const

Definition at line 509 of file channeldataview.cpp.

◆ signalViewportRect()

QRect ChannelDataView::signalViewportRect ( ) const

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

Returns
Viewport rectangle, or a null QRect if no render view exists.

Definition at line 864 of file channeldataview.cpp.

◆ sortChannelsByType()

void ChannelDataView::sortChannelsByType ( )

Definition at line 733 of file channeldataview.cpp.

◆ toggleTimeFormat()

void ChannelDataView::toggleTimeFormat ( )

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

Definition at line 822 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 961 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 965 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 888 of file channeldataview.cpp.

◆ visibleSampleCount()

int ChannelDataView::visibleSampleCount ( ) const

Definition at line 857 of file channeldataview.cpp.

◆ windowSize()

float ChannelDataView::windowSize ( ) const

Get the current visible time window in seconds.

Returns
Visible window duration in seconds.

Definition at line 460 of file channeldataview.cpp.

◆ zoom()

double ChannelDataView::zoom ( ) const

Return the current zoom factor.

Returns
Zoom multiplier relative to the default samples-per-pixel (at least 0.001).

Definition at line 476 of file channeldataview.cpp.

◆ zScoreMode()

bool ChannelDataView::zScoreMode ( ) const

Definition at line 647 of file channeldataview.cpp.

◆ zScoreModeToggled

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

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