ChannelDataModel – lightweight data container for ChannelDataView / ChannelRhiView.
More...
#include <channeldatamodel.h>
|
| | 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 |
ChannelDataModel – lightweight data container for ChannelDataView / ChannelRhiView.
Stores per-channel float amplitude data and derives per-channel display metadata (colour, scale, name) from an optional FiffInfo. The renderer calls decimatedVertices() to obtain a ready-to-upload flat float array (x_offset, y_amp) pairs for the current view window.
Definition at line 108 of file channeldatamodel.h.
◆ ConstSPtr
◆ SPtr
◆ ChannelDataModel()
| ChannelDataModel::ChannelDataModel |
( |
QObject * | parent = nullptr | ) |
|
|
explicit |
◆ appendData()
| 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.
- Parameters
-
| [in] | data | Channels × newSamples matrix. |
Definition at line 138 of file channeldatamodel.cpp.
◆ channelCount()
| int ChannelDataModel::channelCount |
( |
| ) |
const |
◆ channelInfo()
Display metadata for the given channel.
- Parameters
-
| [in] | channelIdx | Zero-based channel index. |
- Returns
- ChannelDisplayInfo struct with name, colour, amplitudeMax, bad flag.
Definition at line 326 of file channeldatamodel.cpp.
◆ channelRms()
| 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.
- Parameters
-
| [in] | channelIdx | Zero-based channel index. |
| [in] | firstSample | Absolute first sample (inclusive). |
| [in] | lastSample | Absolute last sample (exclusive). |
- Returns
- RMS in raw (physical) units, or 0 if no data is available.
Definition at line 336 of file channeldatamodel.cpp.
◆ clearData()
| void ChannelDataModel::clearData |
( |
| ) |
|
Override the per-channel-type amplitude scale. Key = FIFF channel kind constant (e.g. FIFFV_MEG_CH), value = physical amplitude.
- Parameters
-
Definition at line 172 of file channeldatamodel.cpp.
◆ dataChanged
| void DISPLIB::ChannelDataModel::dataChanged |
( |
| ) |
|
|
signal |
Emitted whenever stored data changes (new data appended or replaced).
◆ decimatedVertices()
| 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.
- Parameters
-
| [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). |
- Returns
- Flat float array: [x0, y0, x1, y1, ...] where x is offset from vboFirstSample.
Definition at line 372 of file channeldatamodel.cpp.
◆ detrendMode()
| DetrendMode DISPLIB::ChannelDataModel::detrendMode |
( |
| ) |
const |
|
inline |
◆ firstSample()
| int ChannelDataModel::firstSample |
( |
| ) |
const |
◆ init()
Initialise with channel metadata from a FiffInfo.
- Parameters
-
| [in] | pFiffInfo | The FiffInfo describing the channels. |
Definition at line 99 of file channeldatamodel.cpp.
◆ metaChanged
| void DISPLIB::ChannelDataModel::metaChanged |
( |
| ) |
|
|
signal |
Emitted when channel metadata (scale, colour, bad-flag) changes.
◆ removeDC()
| bool DISPLIB::ChannelDataModel::removeDC |
( |
| ) |
const |
|
inline |
◆ sampleValueAt()
| 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.
- Parameters
-
| [in] | channelIdx | Zero-based channel index. |
| [in] | sample | Absolute sample index. |
- Returns
- Sample value in physical units, or 0 if unavailable.
Definition at line 358 of file channeldatamodel.cpp.
◆ setChannelBad()
| void ChannelDataModel::setChannelBad |
( |
int | channelIdx, |
|
|
bool | bad ) |
Mark/unmark a channel as bad.
- Parameters
-
| [in] | channelIdx | Zero-based channel index. |
| [in] | bad | True to mark bad. |
Definition at line 277 of file channeldatamodel.cpp.
◆ setData()
| 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.
- Parameters
-
| [in] | data | Channels × samples matrix (double precision). |
| [in] | firstSample | Absolute sample index of column 0. |
Definition at line 117 of file channeldatamodel.cpp.
◆ setDetrendMode()
| void ChannelDataModel::setDetrendMode |
( |
DetrendMode | mode | ) |
|
◆ setMaxStoredSamples()
| 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.
- Parameters
-
| [in] | n | Maximum sample count per channel, or 0 for unlimited. |
Definition at line 251 of file channeldatamodel.cpp.
◆ setRemoveDC()
| 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.
- Parameters
-
| [in] | remove | true = subtract mean, false = raw data. |
Definition at line 259 of file channeldatamodel.cpp.
◆ setScaleMap()
| void ChannelDataModel::setScaleMap |
( |
const QMap< qint32, float > & | scaleMap | ) |
|
◆ setScaleMapFromStrings()
| void ChannelDataModel::setScaleMapFromStrings |
( |
const QMap< QString, double > & | scaleMap | ) |
|
◆ setSignalColor()
| 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.
- Parameters
-
| [in] | color | The base signal colour. |
Definition at line 239 of file channeldatamodel.cpp.
◆ setVirtualChannels()
| void ChannelDataModel::setVirtualChannels |
( |
const QVector< ChannelDisplayInfo > & | virtualChannels | ) |
|
Set extra browser-level virtual channels appended after the FIFF channels.
- Parameters
-
| [in] | virtualChannels | Display metadata for each appended virtual channel. |
Definition at line 221 of file channeldatamodel.cpp.
◆ sfreq()
| float ChannelDataModel::sfreq |
( |
| ) |
const |
◆ totalSamples()
| int ChannelDataModel::totalSamples |
( |
| ) |
const |
The documentation for this class was generated from the following files: