ChannelRhiView
Namespace: DISPLIB · Library: Display Library
#include <disp/channelrhiview.h>
class DISPLIB::ChannelRhiView
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.
Inheritance
Public Methods
ChannelRhiView(parent)
~ChannelRhiView()
setModel(model)
Attach the data model.
The view does NOT take ownership.
Parameters:
- model : *ChannelDataModel ** The channel data model to render.
setEvents(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:
- events : const QVector< EventMarker > &
List of
EventMarkerobjects.
setEpochMarkers(triggerSamples)
setEpochMarkersVisible(visible)
epochMarkersVisible()
setClippingVisible(visible)
clippingVisible()
setZScoreMode(enabled)
zScoreMode()
setAnnotations(annotations)
Set the list of time-span annotations to overlay on the traces.
Parameters:
- annotations : const QVector< AnnotationSpan > &
List of
AnnotationSpanobjects.
setAnnotationSelectionEnabled(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:
- enabled : bool True to make Shift+drag select annotation ranges.
setEventsVisible(visible)
eventsVisible()
setAnnotationsVisible(visible)
annotationsVisible()
scrollSample()
samplesPerPixel()
setScrollSample(sample)
Set the left-edge scroll position.
Updates only the GPU uniform — no VBO rebuild unless the prefetch window is exhausted.
Parameters:
- sample : float Absolute sample index for the left viewport edge.
setSamplesPerPixel(spp)
Set the horizontal zoom (samples per screen pixel).
Triggers a VBO rebuild with new decimation.
Parameters:
- spp : float Samples per pixel (> 1 = zoomed out, < 1 = zoomed in).
scrollTo(targetSample, durationMs)
Smoothly animate the scroll position.
Parameters:
-
targetSample : float Target left-edge sample index.
-
durationMs : int Animation duration in milliseconds (0 = instant).
scrollBy(deltaSamples, durationMs)
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:
-
deltaSamples : float Samples to scroll (negative = earlier).
-
durationMs : int Animation duration in milliseconds (0 = instant).
zoomTo(targetSpp, durationMs)
Smoothly animate the zoom level.
Parameters:
-
targetSpp : float Target samples-per-pixel.
-
durationMs : int Animation duration in milliseconds (0 = instant).
setBackgroundColor(color)
Background colour of the render surface.
Parameters:
- color : const QColor & The new background colour.
backgroundColor()
setPrefetchFactor(factor)
How many samples to prefetch beyond the visible window on each side (in multiples of the visible window).
Default = 1.0.
Parameters:
- factor : float Prefetch factor.
visibleFirstSample()
Returns the absolute sample index currently shown at x = 0 (left edge).
(Same as scrollSample rounded to int.)
Returns:
- int — Absolute sample index at the left viewport edge.
visibleSampleCount()
Returns the number of samples currently visible.
Returns:
- int — Widget width in pixels times samples per pixel, truncated to int.
setChannelIndices(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:
- indices : const QVector< int > & Ordered list of model channel indices to display. Pass an empty vector to clear the filter.
totalLogicalChannels()
Total number of logical channels available for scrolling (respects active filter).
Returns:
- int — Number of channels after applying the index filter and bad-channel hiding.
setFirstVisibleChannel(ch)
Set the index of the first visible channel row.
Parameters:
- ch : int Zero-based channel index (within the active filter if any).
firstVisibleChannel()
setVisibleChannelCount(count)
Set how many channel rows are displayed simultaneously.
Parameters:
- count : int Number of channels to show (clamped to 1–model count).
visibleChannelCount()
setFrozen(frozen)
Freeze or unfreeze drag-panning (mouse drag and inertia).
Wheel scroll and the scrollbar remain active when frozen.
Parameters:
- frozen : bool True to disable drag-panning.
isFrozen()
setGridVisible(visible)
Show or hide the time and amplitude grid overlay.
Parameters:
- visible : bool True to draw the grid.
gridVisible()
setSfreq(sfreq)
Set the sampling frequency (Hz) used to place time-grid tick lines.
Call this from ChannelDataView::init() after FiffInfo is available.
Parameters:
- sfreq : float Sampling frequency in Hz.
setFirstFileSample(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:
- first : int Absolute sample index of the file's first sample.
setLastFileSample(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:
- last : int Absolute sample index of the file's last sample.
lastFileSample()
setWheelScrollsChannels(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:
- channelsMode : bool true = vertical wheel → channels, false → time.
wheelScrollsChannels()
setScrollSpeedFactor(factor)
scrollSpeedFactor()
setHideBadChannels(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:
- hide : bool true = remove bad channels from the visible trace list.
hideBadChannels()
setCrosshairEnabled(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:
- enabled : bool True to show the crosshair overlay.
crosshairEnabled()
setClockTimeFormat(useClock)
Set whether the crosshair label uses clock time (mm:ss.ms) or seconds.
Parameters:
- useClock : bool True for clock time, false for float seconds.
clockTimeFormat()
renderToImage(size)
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:
- size : const QSize & Output size in pixels; the visible time span is stretched to fit. An invalid size (default) uses the widget size.
Returns:
- QImage — 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.
setScalebarsVisible(visible)
Show or hide per-channel-type scalebars in the bottom-right corner.
Parameters:
- visible : bool True to draw the scalebars.
scalebarsVisible()
setButterflyMode(enabled)
Toggle butterfly mode: all channels of the same type are overlaid in a single lane.
Parameters:
- enabled : bool True to enable butterfly mode.
butterflyMode()
Authors of this file
- Christoph Dinh <christoph.dinh@mne-cpp.org>