Circular-buffer Qt model exposing a rolling window of the live FIFF stream as a table. More...
#include <channeldatamodel.h>
Public Types | |
| typedef QSharedPointer< ChannelDataModel > | SPtr |
| typedef QSharedPointer< const ChannelDataModel > | ConstSPtr |
Signals | |
| void | dataChanged () |
| void | metaChanged () |
Public Member Functions | |
| ChannelDataModel (QObject *parent=nullptr) | |
| void | init (QSharedPointer< FIFFLIB::FiffInfo > pFiffInfo) |
| void | setData (const Eigen::MatrixXd &data, int firstSample=0) |
| void | appendData (const Eigen::MatrixXd &data) |
| void | clearData () |
| void | setScaleMap (const QMap< qint32, float > &scaleMap) |
| void | setScaleMapFromStrings (const QMap< QString, double > &scaleMap) |
| void | setVirtualChannels (const QVector< ChannelDisplayInfo > &virtualChannels) |
| void | setSignalColor (const QColor &color) |
| void | setMaxStoredSamples (int n) |
| void | setChannelBad (int channelIdx, bool bad) |
| void | setRemoveDC (bool remove) |
| bool | removeDC () const |
| void | setDetrendMode (DetrendMode mode) |
| DetrendMode | detrendMode () const |
| int | channelCount () const |
| int | firstSample () const |
| int | totalSamples () const |
| float | sfreq () const |
| ChannelDisplayInfo | channelInfo (int channelIdx) const |
| float | channelRms (int channelIdx, int firstSample, int lastSample) const |
| QVector< float > | decimatedVertices (int channelIdx, int firstSample, int lastSample, int pixelWidth, int &vboFirstSample) const |
| float | sampleValueAt (int channelIdx, int sample) const |
Circular-buffer Qt model exposing a rolling window of the live FIFF stream as a table.
Keeps a per-channel Eigen::MatrixXd ring buffer of the most recent N seconds, tracks bad-channel flags, trigger annotations and the active SSP / compensation / filter operators so the delegate can render the pre-processed signal without touching the raw buffer.
Definition at line 97 of file channeldatamodel.h.

| typedef QSharedPointer<const ChannelDataModel> DISPLIB::ChannelDataModel::ConstSPtr |
Definition at line 103 of file channeldatamodel.h.
| typedef QSharedPointer<ChannelDataModel> DISPLIB::ChannelDataModel::SPtr |
Definition at line 102 of file channeldatamodel.h.
|
explicit |
Definition at line 63 of file channeldatamodel.cpp.
| void ChannelDataModel::appendData | ( | const Eigen::MatrixXd & | data | ) |
Append new samples to the ring buffer. Oldest samples are dropped when the internal capacity (maxStoredSamples) is exceeded.
| [in] | data | Channels × newSamples matrix. |
Definition at line 117 of file channeldatamodel.cpp.
| int ChannelDataModel::channelCount | ( | ) | const |
Definition at line 280 of file channeldatamodel.cpp.
| ChannelDisplayInfo ChannelDataModel::channelInfo | ( | int | channelIdx | ) | const |
Display metadata for the given channel.
| [in] | channelIdx | Zero-based channel index. |
Definition at line 305 of file channeldatamodel.cpp.
| float ChannelDataModel::channelRms | ( | int | channelIdx, |
| int | firstSample, | ||
| int | lastSample ) const |
Compute the RMS amplitude of a channel over a sample window. Samples outside the buffer are silently ignored. Capped internally at 1000 samples for rendering-thread safety.
| [in] | channelIdx | Zero-based channel index. |
| [in] | firstSample | Absolute first sample (inclusive). |
| [in] | lastSample | Absolute last sample (exclusive). |
Definition at line 315 of file channeldatamodel.cpp.
| void ChannelDataModel::clearData | ( | ) |
Override the per-channel-type amplitude scale. Key = FIFF channel kind constant (e.g. FIFFV_MEG_CH), value = physical amplitude.
| [in] | scaleMap | Map from FIFF kind to amplitude max. Clear all stored sample data without affecting channel metadata. After this call totalSamples() == 0 and firstSample() == 0. Emits dataChanged(). |
Definition at line 151 of file channeldatamodel.cpp.
|
signal |
Emitted whenever stored data changes (new data appended or replaced).
| QVector< float > ChannelDataModel::decimatedVertices | ( | int | channelIdx, |
| int | firstSample, | ||
| int | lastSample, | ||
| int | pixelWidth, | ||
| int & | vboFirstSample ) const |
Return a flat float array ready for VBO upload. The array contains interleaved (x_offset, y_amplitude) pairs.
When samplesPerPixel <= 1 (zoomed in), raw samples are returned. When samplesPerPixel > 1 (zoomed out), min/max decimation is applied so that at most 2 * pixelWidth vertices are returned.
| [in] | channelIdx | Zero-based channel index. |
| [in] | firstSample | Absolute sample index of the first desired sample. |
| [in] | lastSample | Absolute sample index (exclusive) of the last desired sample. |
| [in] | pixelWidth | Destination viewport width in pixels. |
| [out] | vboFirstSample | The absolute sample index stored at VBO vertex 0 (= firstSample, returned for the UBO uniform). |
Definition at line 351 of file channeldatamodel.cpp.
|
inline |
Definition at line 199 of file channeldatamodel.h.
| int ChannelDataModel::firstSample | ( | ) | const |
Definition at line 289 of file channeldatamodel.cpp.
| void ChannelDataModel::init | ( | QSharedPointer< FIFFLIB::FiffInfo > | pFiffInfo | ) |
Initialise with channel metadata from a FiffInfo.
| [in] | pFiffInfo | The FiffInfo describing the channels. |
Definition at line 78 of file channeldatamodel.cpp.
|
signal |
Emitted when channel metadata (scale, colour, bad-flag) changes.
|
inline |
Definition at line 196 of file channeldatamodel.h.
| float ChannelDataModel::sampleValueAt | ( | int | channelIdx, |
| int | sample ) const |
Return the raw sample value at a specific absolute sample index for the given channel. Returns 0 if the sample is outside the buffer or channel index is out of range.
| [in] | channelIdx | Zero-based channel index. |
| [in] | sample | Absolute sample index. |
Definition at line 337 of file channeldatamodel.cpp.
| void ChannelDataModel::setChannelBad | ( | int | channelIdx, |
| bool | bad ) |
Mark/unmark a channel as bad.
| [in] | channelIdx | Zero-based channel index. |
| [in] | bad | True to mark bad. |
Definition at line 256 of file channeldatamodel.cpp.
| void ChannelDataModel::setData | ( | const Eigen::MatrixXd & | data, |
| int | firstSample = 0 ) |
Replace all stored data with the provided matrix (channels × samples). The absolute index of the first column is firstSample.
| [in] | data | Channels × samples matrix (double precision). |
| [in] | firstSample | Absolute sample index of column 0. |
Definition at line 96 of file channeldatamodel.cpp.
| void ChannelDataModel::setDetrendMode | ( | DetrendMode | mode | ) |
Definition at line 245 of file channeldatamodel.cpp.
| void ChannelDataModel::setMaxStoredSamples | ( | int | n | ) |
Set the maximum number of samples to keep in the ring buffer. When samples are appended beyond this limit, the oldest are dropped. Set to 0 (default) for unlimited storage.
| [in] | n | Maximum sample count per channel, or 0 for unlimited. |
Definition at line 230 of file channeldatamodel.cpp.
| void ChannelDataModel::setRemoveDC | ( | bool | remove | ) |
Enable or disable DC (mean) removal applied on-the-fly during rendering. When enabled each channel's mean amplitude over the requested window is subtracted.
| [in] | remove | true = subtract mean, false = raw data. |
Definition at line 238 of file channeldatamodel.cpp.
| void ChannelDataModel::setScaleMap | ( | const QMap< qint32, float > & | scaleMap | ) |
Definition at line 164 of file channeldatamodel.cpp.
| void ChannelDataModel::setScaleMapFromStrings | ( | const QMap< QString, double > & | scaleMap | ) |
Definition at line 176 of file channeldatamodel.cpp.
| void ChannelDataModel::setSignalColor | ( | const QColor & | color | ) |
Set the signal line colour for all channels. Individual channel colours are derived from this base colour by type.
| [in] | color | The base signal colour. |
Definition at line 218 of file channeldatamodel.cpp.
| void ChannelDataModel::setVirtualChannels | ( | const QVector< ChannelDisplayInfo > & | virtualChannels | ) |
Set extra browser-level virtual channels appended after the FIFF channels.
| [in] | virtualChannels | Display metadata for each appended virtual channel. |
Definition at line 200 of file channeldatamodel.cpp.
| float ChannelDataModel::sfreq | ( | ) | const |
Sampling frequency in Hz; 0 if no FiffInfo attached.
Definition at line 576 of file channeldatamodel.cpp.
| int ChannelDataModel::totalSamples | ( | ) | const |
Definition at line 297 of file channeldatamodel.cpp.