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

QRhi-based GPU-accelerated channel time-series renderer used by the modern raw browser. More...

#include <channelrhiview.h>

Classes

struct  EventMarker
 Stimulus / event marker — a coloured vertical line at a given sample. More...
struct  AnnotationSpan
 Time-span annotation overlay. More...

Signals

void scrollSampleChanged (float sample)
void samplesPerPixelChanged (float spp)
void viewResized (int newWidth, int newHeight)
void channelOffsetChanged (int firstChannel)
void sampleClicked (int sample)
void sampleRangeSelected (int startSample, int endSample)
void annotationBoundaryMoved (int annotationIndex, bool isStartBoundary, int newSample)
void cursorDataChanged (float timeSec, float amplitude, const QString &channelName, const QString &unitLabel)

Public Member Functions

 ChannelRhiView (QWidget *parent=nullptr)
 ~ChannelRhiView () override
void setModel (ChannelDataModel *model)
void setEvents (const QVector< 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 setAnnotations (const QVector< AnnotationSpan > &annotations)
void setAnnotationSelectionEnabled (bool enabled)
void setEventsVisible (bool visible)
bool eventsVisible () const
void setAnnotationsVisible (bool visible)
bool annotationsVisible () const
float scrollSample () const
float samplesPerPixel () const
void setScrollSample (float sample)
void setSamplesPerPixel (float spp)
void scrollTo (float targetSample, int durationMs=200)
void scrollBy (float deltaSamples, int durationMs=200)
void zoomTo (float targetSpp, int durationMs=200)
void setBackgroundColor (const QColor &color)
QColor backgroundColor () const
void setPrefetchFactor (float factor)
int visibleFirstSample () const
int visibleSampleCount () const
void setChannelIndices (const QVector< int > &indices)
int totalLogicalChannels () const
void setFirstVisibleChannel (int ch)
int firstVisibleChannel () const
void setVisibleChannelCount (int count)
int visibleChannelCount () const
void setFrozen (bool frozen)
bool isFrozen () const
void setGridVisible (bool visible)
bool gridVisible () const
void setSfreq (float sfreq)
void setFirstFileSample (int first)
void setLastFileSample (int last)
int lastFileSample () const
void setWheelScrollsChannels (bool channelsMode)
bool wheelScrollsChannels () const
void setScrollSpeedFactor (float factor)
float scrollSpeedFactor () const
void setHideBadChannels (bool hide)
bool hideBadChannels () const
void setCrosshairEnabled (bool enabled)
bool crosshairEnabled () const
void setClockTimeFormat (bool useClock)
bool clockTimeFormat () const
QImage renderToImage (const QSize &size=QSize()) const
void setScalebarsVisible (bool visible)
bool scalebarsVisible () const
void setButterflyMode (bool enabled)
bool butterflyMode () const

Protected Member Functions

void initialize (QRhiCommandBuffer *cb) override
void render (QRhiCommandBuffer *cb) override
void releaseResources () override
void paintEvent (QPaintEvent *event) override
void renderFrame (QRhi *rhi, QRhiRenderTarget *target, QRhiCommandBuffer *cb)
void drawCrosshair (QPainter &p)
void drawScalebars (QPainter &p)
void drawRulerOverlay (QPainter &p)
void drawAnnotationSelectionOverlay (QPainter &p)
void emitCursorData ()
bool rulerActive () const
bool annotationSelecting () const
void resizeEvent (QResizeEvent *event) override
void wheelEvent (QWheelEvent *event) override
void mousePressEvent (QMouseEvent *event) override
void mouseMoveEvent (QMouseEvent *event) override
void mouseReleaseEvent (QMouseEvent *event) override
void mouseDoubleClickEvent (QMouseEvent *event) override

Properties

float scrollSample
float samplesPerPixel

Friends

class ::CrosshairOverlay

Detailed Description

QRhi-based GPU-accelerated channel time-series renderer used by the modern raw browser.

Manages its own pipeline, samplers, resource bindings and a small CrosshairOverlay for the time / amplitude cursor; exposes callbacks for the host ChannelDataView to push samples, change scaling or update the visible window.

Definition at line 76 of file channelrhiview.h.

Inheritance diagram for DISPLIB::ChannelRhiView:
Inheritance graph

Constructor & Destructor Documentation

◆ ChannelRhiView()

ChannelRhiView::ChannelRhiView ( QWidget * parent = nullptr)
explicit

Definition at line 141 of file channelrhiview.cpp.

◆ ~ChannelRhiView()

ChannelRhiView::~ChannelRhiView ( )
overridedefault

Member Function Documentation

◆ annotationBoundaryMoved

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

Emitted when the user finishes dragging an annotation boundary.

Parameters
[in]annotationIndexIndex in the annotation span list.
[in]isStartBoundaryTrue if the start boundary was dragged.
[in]newSampleNew absolute sample position of the boundary.

◆ annotationSelecting()

bool DISPLIB::ChannelRhiView::annotationSelecting ( ) const
inlineprotected

Definition at line 550 of file channelrhiview.h.

◆ annotationsVisible()

bool ChannelRhiView::annotationsVisible ( ) const

Definition at line 722 of file channelrhiview.cpp.

◆ backgroundColor()

QColor DISPLIB::ChannelRhiView::backgroundColor ( ) const
inline

Definition at line 236 of file channelrhiview.h.

◆ butterflyMode()

bool DISPLIB::ChannelRhiView::butterflyMode ( ) const
inline

Definition at line 473 of file channelrhiview.h.

◆ channelOffsetChanged

void DISPLIB::ChannelRhiView::channelOffsetChanged ( int firstChannel)
signal

Emitted whenever the first visible channel index changes.

◆ clippingVisible()

bool DISPLIB::ChannelRhiView::clippingVisible ( ) const
inline

Definition at line 138 of file channelrhiview.h.

◆ clockTimeFormat()

bool DISPLIB::ChannelRhiView::clockTimeFormat ( ) const
inline

Definition at line 428 of file channelrhiview.h.

◆ crosshairEnabled()

bool DISPLIB::ChannelRhiView::crosshairEnabled ( ) const
inline

Definition at line 413 of file channelrhiview.h.

◆ cursorDataChanged

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

Emitted continuously when the crosshair is active and the mouse moves.

Parameters
[in]timeSecTime at cursor in seconds relative to file start.
[in]amplitudeRaw amplitude value under the cursor in physical units.
[in]channelNameName of the channel under the cursor.
[in]unitLabelShort unit label ("T", "V", "AU", …).

◆ drawAnnotationSelectionOverlay()

void ChannelRhiView::drawAnnotationSelectionOverlay ( QPainter & p)
protected

Definition at line 2242 of file channelrhiview.cpp.

◆ drawCrosshair()

void ChannelRhiView::drawCrosshair ( QPainter & p)
protected

Definition at line 1879 of file channelrhiview.cpp.

◆ drawRulerOverlay()

void ChannelRhiView::drawRulerOverlay ( QPainter & p)
protected

Definition at line 2091 of file channelrhiview.cpp.

◆ drawScalebars()

void ChannelRhiView::drawScalebars ( QPainter & p)
protected

Definition at line 2008 of file channelrhiview.cpp.

◆ emitCursorData()

void ChannelRhiView::emitCursorData ( )
protected

Definition at line 1969 of file channelrhiview.cpp.

◆ epochMarkersVisible()

bool DISPLIB::ChannelRhiView::epochMarkersVisible ( ) const
inline

Definition at line 132 of file channelrhiview.h.

◆ eventsVisible()

bool ChannelRhiView::eventsVisible ( ) const

Definition at line 706 of file channelrhiview.cpp.

◆ firstVisibleChannel()

int DISPLIB::ChannelRhiView::firstVisibleChannel ( ) const
inline

Definition at line 293 of file channelrhiview.h.

◆ gridVisible()

bool DISPLIB::ChannelRhiView::gridVisible ( ) const
inline

Definition at line 330 of file channelrhiview.h.

◆ hideBadChannels()

bool DISPLIB::ChannelRhiView::hideBadChannels ( ) const
inline

Definition at line 397 of file channelrhiview.h.

◆ initialize()

void ChannelRhiView::initialize ( QRhiCommandBuffer * cb)
overrideprotected

Definition at line 748 of file channelrhiview.cpp.

◆ isFrozen()

bool DISPLIB::ChannelRhiView::isFrozen ( ) const
inline

Definition at line 318 of file channelrhiview.h.

◆ lastFileSample()

int DISPLIB::ChannelRhiView::lastFileSample ( ) const
inline

Definition at line 362 of file channelrhiview.h.

◆ mouseDoubleClickEvent()

void ChannelRhiView::mouseDoubleClickEvent ( QMouseEvent * event)
overrideprotected

Definition at line 2658 of file channelrhiview.cpp.

◆ mouseMoveEvent()

void ChannelRhiView::mouseMoveEvent ( QMouseEvent * event)
overrideprotected

Definition at line 2408 of file channelrhiview.cpp.

◆ mousePressEvent()

void ChannelRhiView::mousePressEvent ( QMouseEvent * event)
overrideprotected

Definition at line 2332 of file channelrhiview.cpp.

◆ mouseReleaseEvent()

void ChannelRhiView::mouseReleaseEvent ( QMouseEvent * event)
overrideprotected

Definition at line 2541 of file channelrhiview.cpp.

◆ paintEvent()

void ChannelRhiView::paintEvent ( QPaintEvent * event)
overrideprotected

Definition at line 1552 of file channelrhiview.cpp.

◆ releaseResources()

void ChannelRhiView::releaseResources ( )
overrideprotected

Definition at line 757 of file channelrhiview.cpp.

◆ render()

void ChannelRhiView::render ( QRhiCommandBuffer * cb)
overrideprotected

Definition at line 1351 of file channelrhiview.cpp.

◆ renderFrame()

void ChannelRhiView::renderFrame ( QRhi * rhi,
QRhiRenderTarget * target,
QRhiCommandBuffer * cb )
protected

Records one frame into target; render() calls it with the widget's own QRhi and render target.

Parameters
[in]rhiThe QRhi that owns target and the view's GPU resources.
[in]targetRender target sized like the widget times its device pixel ratio.
[in]cbCommand buffer of the current frame.

Definition at line 1358 of file channelrhiview.cpp.

◆ renderToImage()

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

Render the current view (background bands, grid, annotations, traces, event and epoch markers) into an image with QPainter, without the GPU. Rows, scaling, butterfly layout, z-score mode and clipping highlight match the on-screen rendering, so this also works offscreen, e.g. for reports.

Parameters
[in]sizeOutput size in pixels; the visible time span is stretched to fit. An invalid size (default) uses the widget size.
Returns
The rendered image (only the background if no channel is shown), or a null image if there is no model or the size is empty.

Definition at line 1560 of file channelrhiview.cpp.

◆ resizeEvent()

void ChannelRhiView::resizeEvent ( QResizeEvent * event)
overrideprotected

Definition at line 2285 of file channelrhiview.cpp.

◆ rulerActive()

bool DISPLIB::ChannelRhiView::rulerActive ( ) const
inlineprotected

Definition at line 546 of file channelrhiview.h.

◆ sampleClicked

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

Emitted whenever the user clicks; provides the sample index under the cursor.

◆ sampleRangeSelected

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

Emitted when the user selects a time span with Shift+drag in annotation mode.

◆ samplesPerPixel()

float DISPLIB::ChannelRhiView::samplesPerPixel ( ) const
inline

Definition at line 178 of file channelrhiview.h.

◆ samplesPerPixelChanged

void DISPLIB::ChannelRhiView::samplesPerPixelChanged ( float spp)
signal

◆ scalebarsVisible()

bool DISPLIB::ChannelRhiView::scalebarsVisible ( ) const
inline

Definition at line 459 of file channelrhiview.h.

◆ scrollBy()

void ChannelRhiView::scrollBy ( float deltaSamples,
int durationMs = 200 )

Smoothly scroll by a number of samples. While a scroll animation runs, the step continues from its target, so repeated wheel ticks or key presses add up.

Parameters
[in]deltaSamplesSamples to scroll (negative = earlier).
[in]durationMsAnimation duration in milliseconds (0 = instant).

Definition at line 307 of file channelrhiview.cpp.

◆ scrollSample()

float DISPLIB::ChannelRhiView::scrollSample ( ) const
inline

Definition at line 174 of file channelrhiview.h.

◆ scrollSampleChanged

void DISPLIB::ChannelRhiView::scrollSampleChanged ( float sample)
signal

◆ scrollSpeedFactor()

float DISPLIB::ChannelRhiView::scrollSpeedFactor ( ) const
inline

Definition at line 382 of file channelrhiview.h.

◆ scrollTo()

void ChannelRhiView::scrollTo ( float targetSample,
int durationMs = 200 )

Smoothly animate the scroll position.

Parameters
[in]targetSampleTarget left-edge sample index.
[in]durationMsAnimation duration in milliseconds (0 = instant).

Definition at line 275 of file channelrhiview.cpp.

◆ setAnnotations()

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

Set the list of time-span annotations to overlay on the traces.

Parameters
[in]annotationsList of AnnotationSpan objects.

Definition at line 681 of file channelrhiview.cpp.

◆ setAnnotationSelectionEnabled()

void ChannelRhiView::setAnnotationSelectionEnabled ( bool enabled)

Enable or disable annotation range selection. When enabled, Shift+drag emits sampleRangeSelected on mouse release instead of acting as a pure measurement tool.

Parameters
[in]enabledTrue to make Shift+drag select annotation ranges.

Definition at line 690 of file channelrhiview.cpp.

◆ setAnnotationsVisible()

void ChannelRhiView::setAnnotationsVisible ( bool visible)

Definition at line 713 of file channelrhiview.cpp.

◆ setBackgroundColor()

void ChannelRhiView::setBackgroundColor ( const QColor & color)

Background colour of the render surface.

Parameters
[in]colorThe new background colour.

Definition at line 331 of file channelrhiview.cpp.

◆ setButterflyMode()

void ChannelRhiView::setButterflyMode ( bool enabled)

Toggle butterfly mode: all channels of the same type are overlaid in a single lane.

Parameters
[in]enabledTrue to enable butterfly mode.

Definition at line 496 of file channelrhiview.cpp.

◆ setChannelIndices()

void ChannelRhiView::setChannelIndices ( const QVector< int > & indices)

Restrict rendering to a specific subset of channel indices. When indices is empty all channels in the model are shown (no filter). When set, scrolling and visible-channel-count are relative to this subset.

Parameters
[in]indicesOrdered list of model channel indices to display. Pass an empty vector to clear the filter.

Definition at line 558 of file channelrhiview.cpp.

◆ setClippingVisible()

void ChannelRhiView::setClippingVisible ( bool visible)

Definition at line 660 of file channelrhiview.cpp.

◆ setClockTimeFormat()

void DISPLIB::ChannelRhiView::setClockTimeFormat ( bool useClock)
inline

Set whether the crosshair label uses clock time (mm:ss.ms) or seconds.

Parameters
[in]useClockTrue for clock time, false for float seconds.

Definition at line 423 of file channelrhiview.h.

◆ setCrosshairEnabled()

void ChannelRhiView::setCrosshairEnabled ( bool enabled)

Enable or disable the crosshair cursor overlay. When enabled, a vertical + horizontal cross follows the mouse and the view continuously emits cursorDataChanged() with the time/amplitude under the cursor.

Parameters
[in]enabledTrue to show the crosshair overlay.

Definition at line 470 of file channelrhiview.cpp.

◆ setEpochMarkers()

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

Definition at line 640 of file channelrhiview.cpp.

◆ setEpochMarkersVisible()

void ChannelRhiView::setEpochMarkersVisible ( bool visible)

Definition at line 649 of file channelrhiview.cpp.

◆ setEvents()

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

Set the list of stimulus / event markers to overlay on the traces. Each marker is drawn as a coloured vertical line spanning all channel rows, with a small colour-coded label chip at the bottom of the view. Pass an empty vector to clear all markers.

Parameters
[in]eventsList of EventMarker objects.

Definition at line 631 of file channelrhiview.cpp.

◆ setEventsVisible()

void ChannelRhiView::setEventsVisible ( bool visible)

Definition at line 697 of file channelrhiview.cpp.

◆ setFirstFileSample()

void ChannelRhiView::setFirstFileSample ( int first)

Set the absolute sample index of the first sample in the file. Used to align grid tick lines with the time ruler labels.

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

Definition at line 419 of file channelrhiview.cpp.

◆ setFirstVisibleChannel()

void ChannelRhiView::setFirstVisibleChannel ( int ch)

Set the index of the first visible channel row.

Parameters
[in]chZero-based channel index (within the active filter if any).

Definition at line 361 of file channelrhiview.cpp.

◆ setFrozen()

void ChannelRhiView::setFrozen ( bool frozen)

Freeze or unfreeze drag-panning (mouse drag and inertia). Wheel scroll and the scrollbar remain active when frozen.

Parameters
[in]frozenTrue to disable drag-panning.

Definition at line 389 of file channelrhiview.cpp.

◆ setGridVisible()

void ChannelRhiView::setGridVisible ( bool visible)

Show or hide the time and amplitude grid overlay.

Parameters
[in]visibleTrue to draw the grid.

Definition at line 399 of file channelrhiview.cpp.

◆ setHideBadChannels()

void ChannelRhiView::setHideBadChannels ( bool hide)

Show or hide waveform traces of channels marked bad. When hide is true bad channels are removed from the logical channel list used for scrolling and rendering so the trace lanes collapse upward in sync with the label panel.

Parameters
[in]hidetrue = remove bad channels from the visible trace list.

Definition at line 437 of file channelrhiview.cpp.

◆ setLastFileSample()

void ChannelRhiView::setLastFileSample ( int last)

Set the absolute sample index of the last sample in the file. Used to clamp scrolling so mouse pan cannot exceed the file end. Pass -1 (default) for unlimited.

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

Definition at line 430 of file channelrhiview.cpp.

◆ setModel()

void ChannelRhiView::setModel ( ChannelDataModel * model)

Attach the data model. The view does NOT take ownership.

Parameters
[in]modelThe channel data model to render.

Definition at line 182 of file channelrhiview.cpp.

◆ setPrefetchFactor()

void ChannelRhiView::setPrefetchFactor ( float factor)

How many samples to prefetch beyond the visible window on each side (in multiples of the visible window). Default = 1.0.

Parameters
[in]factorPrefetch factor.

Definition at line 340 of file channelrhiview.cpp.

◆ setSamplesPerPixel()

void ChannelRhiView::setSamplesPerPixel ( float spp)

Set the horizontal zoom (samples per screen pixel). Triggers a VBO rebuild with new decimation.

Parameters
[in]sppSamples per pixel (> 1 = zoomed out, < 1 = zoomed in).

Definition at line 261 of file channelrhiview.cpp.

◆ setScalebarsVisible()

void ChannelRhiView::setScalebarsVisible ( bool visible)

Show or hide per-channel-type scalebars in the bottom-right corner.

Parameters
[in]visibleTrue to draw the scalebars.

Definition at line 486 of file channelrhiview.cpp.

◆ setScrollSample()

void ChannelRhiView::setScrollSample ( float sample)

Set the left-edge scroll position. Updates only the GPU uniform — no VBO rebuild unless the prefetch window is exhausted.

Parameters
[in]sampleAbsolute sample index for the left viewport edge.

Definition at line 228 of file channelrhiview.cpp.

◆ setScrollSpeedFactor()

void ChannelRhiView::setScrollSpeedFactor ( float factor)

Definition at line 463 of file channelrhiview.cpp.

◆ setSfreq()

void ChannelRhiView::setSfreq ( float sfreq)

Set the sampling frequency (Hz) used to place time-grid tick lines. Call this from ChannelDataView::init() after FiffInfo is available.

Parameters
[in]sfreqSampling frequency in Hz.

Definition at line 410 of file channelrhiview.cpp.

◆ setVisibleChannelCount()

void ChannelRhiView::setVisibleChannelCount ( int count)

Set how many channel rows are displayed simultaneously.

Parameters
[in]countNumber of channels to show (clamped to 1–model count).

Definition at line 376 of file channelrhiview.cpp.

◆ setWheelScrollsChannels()

void ChannelRhiView::setWheelScrollsChannels ( bool channelsMode)

Control what the vertical mouse wheel scrolls. When channelsMode is true the vertical wheel scrolls through channels. When false the vertical wheel scrolls through time (same as horizontal).

Parameters
[in]channelsModetrue = vertical wheel → channels, false → time.

Definition at line 456 of file channelrhiview.cpp.

◆ setZScoreMode()

void ChannelRhiView::setZScoreMode ( bool enabled)

Definition at line 670 of file channelrhiview.cpp.

◆ totalLogicalChannels()

int ChannelRhiView::totalLogicalChannels ( ) const

Total number of logical channels available for scrolling (respects active filter).

Returns
Number of channels after applying the index filter and bad-channel hiding.

Definition at line 575 of file channelrhiview.cpp.

◆ viewResized

void DISPLIB::ChannelRhiView::viewResized ( int newWidth,
int newHeight )
signal

◆ visibleChannelCount()

int DISPLIB::ChannelRhiView::visibleChannelCount ( ) const
inline

Definition at line 305 of file channelrhiview.h.

◆ visibleFirstSample()

int ChannelRhiView::visibleFirstSample ( ) const

Returns the absolute sample index currently shown at x = 0 (left edge). (Same as scrollSample rounded to int.)

Returns
Absolute sample index at the left viewport edge.

Definition at line 347 of file channelrhiview.cpp.

◆ visibleSampleCount()

int ChannelRhiView::visibleSampleCount ( ) const

Returns the number of samples currently visible.

Returns
Widget width in pixels times samples per pixel, truncated to int.

Definition at line 354 of file channelrhiview.cpp.

◆ wheelEvent()

void ChannelRhiView::wheelEvent ( QWheelEvent * event)
overrideprotected

Definition at line 2298 of file channelrhiview.cpp.

◆ wheelScrollsChannels()

bool DISPLIB::ChannelRhiView::wheelScrollsChannels ( ) const
inline

Definition at line 376 of file channelrhiview.h.

◆ zoomTo()

void ChannelRhiView::zoomTo ( float targetSpp,
int durationMs = 200 )

Smoothly animate the zoom level.

Parameters
[in]targetSppTarget samples-per-pixel.
[in]durationMsAnimation duration in milliseconds (0 = instant).

Definition at line 314 of file channelrhiview.cpp.

◆ zScoreMode()

bool DISPLIB::ChannelRhiView::zScoreMode ( ) const
inline

Definition at line 144 of file channelrhiview.h.

◆ ::CrosshairOverlay

friend class ::CrosshairOverlay
friend

Definition at line 540 of file channelrhiview.h.

Property Documentation

◆ samplesPerPixel

float DISPLIB::ChannelRhiView::samplesPerPixel
readwrite

Definition at line 81 of file channelrhiview.h.

◆ scrollSample

float DISPLIB::ChannelRhiView::scrollSample
readwrite

Definition at line 80 of file channelrhiview.h.


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