v2.0.0
Loading...
Searching...
No Matches
channeldataview.h
Go to the documentation of this file.
1//=============================================================================================================
21
22#ifndef CHANNELDATAVIEW_H
23#define CHANNELDATAVIEW_H
24
25//=============================================================================================================
26// INCLUDES
27//=============================================================================================================
28
29#include "../disp_global.h"
30#include "abstractview.h"
31
32//=============================================================================================================
33// QT INCLUDES
34//=============================================================================================================
35
36#include <QMap>
37#include <QRect>
38#include <QSharedPointer>
39#include <QStringList>
40#include <QVector>
41
45
46//=============================================================================================================
47// EIGEN INCLUDES
48//=============================================================================================================
49
50#include <Eigen/Core>
51
52//=============================================================================================================
53// FORWARD DECLARATIONS
54//=============================================================================================================
55
56class QScrollBar;
57class QSplitter;
58class QToolButton;
59
60namespace FIFFLIB {
61 class FiffInfo;
62}
63
64//=============================================================================================================
65// DEFINE NAMESPACE DISPLIB
66//=============================================================================================================
67
68namespace DISPLIB
69{
70
71//=============================================================================================================
72// DISPLIB FORWARD DECLARATIONS
73//=============================================================================================================
74
75enum class DetrendMode;
78class TimeRulerWidget;
79
80//=============================================================================================================
89{
90 Q_OBJECT
91
92public:
93 typedef QSharedPointer<ChannelDataView> SPtr;
94 typedef QSharedPointer<const ChannelDataView> ConstSPtr;
95
96 //=========================================================================================================
104 explicit ChannelDataView(const QString &sSettingsPath = QString(),
105 QWidget *parent = nullptr,
106 Qt::WindowFlags f = Qt::Widget);
107
108 ~ChannelDataView() override;
109
110 // ── Initialisation ────────────────────────────────────────────────
111
112 //=========================================================================================================
118 void init(QSharedPointer<FIFFLIB::FiffInfo> pInfo);
119
120 // ── Data management ───────────────────────────────────────────────
121
122 //=========================================================================================================
129 void setData(const Eigen::MatrixXd &data, int firstSample = 0);
130
131 //=========================================================================================================
137 void addData(const Eigen::MatrixXd &data);
138
139 // ── Scroll / zoom API ─────────────────────────────────────────────
140
141 //=========================================================================================================
148 void scrollToSample(int sample, bool animate = true);
149
150 //=========================================================================================================
157 void setWindowSize(float seconds);
158
159 //=========================================================================================================
163 float windowSize() const;
164
165 //=========================================================================================================
171 void setZoom(double factor);
172
173 //=========================================================================================================
177 double zoom() const;
178
179 // ── Visual properties ─────────────────────────────────────────────
180
181 //=========================================================================================================
187 void setBackgroundColor(const QColor &color);
188 QColor backgroundColor() const;
189
190 //=========================================================================================================
196 void setSignalColor(const QColor &color);
197 QColor signalColor() const;
198
199 //=========================================================================================================
206 void setScalingMap(const QMap<qint32, float> &scaleMap);
207 QMap<qint32, float> scalingMap() const;
208
209 //=========================================================================================================
215 void hideBadChannels(bool hide);
216 bool badChannelsHidden() const;
217
218 //=========================================================================================================
226 void setChannelFilter(const QStringList &names);
227
228 //=========================================================================================================
235 void setRemoveDC(bool dc);
236
237 //=========================================================================================================
244 void setDetrendMode(DetrendMode mode);
245 DetrendMode detrendMode() const;
246
247 //=========================================================================================================
256 void setFileBounds(int first, int last);
257
258 //=========================================================================================================
265 void setEvents(const QVector<ChannelRhiView::EventMarker> &events);
266
267 void setEpochMarkers(const QVector<int> &triggerSamples);
268 void setEpochMarkersVisible(bool visible);
269 bool epochMarkersVisible() const;
270
271 void setClippingVisible(bool visible);
272 bool clippingVisible() const;
273
274 void setZScoreMode(bool enabled);
275 bool zScoreMode() const;
276
277 //=========================================================================================================
283 void setReferenceMarkers(const QVector<TimeRulerReferenceMark> &markers);
284
285 //=========================================================================================================
291 void setAnnotations(const QVector<ChannelRhiView::AnnotationSpan> &annotations);
292
293 //=========================================================================================================
297 void setAnnotationSelectionEnabled(bool enabled);
298
299 void setEventsVisible(bool visible);
300 bool eventsVisible() const;
301
302 void setAnnotationsVisible(bool visible);
303 bool annotationsVisible() const;
304
305 void setOverviewBarVisible(bool visible);
306 bool overviewBarVisible() const;
307
308 void setScrollSpeedFactor(float factor);
309 float scrollSpeedFactor() const;
310
311 void sortChannelsByType();
312 void resetChannelOrder();
313
314 // ── Interactive inspection features ───────────────────────────────
315
316 //=========================================================================================================
320 void setCrosshairEnabled(bool enabled);
321 bool crosshairEnabled() const;
322
323 //=========================================================================================================
327 void setScalebarsVisible(bool visible);
328 bool scalebarsVisible() const;
329
330 //=========================================================================================================
334 void setButterflyMode(bool enabled);
335 bool butterflyMode() const;
336
337 //=========================================================================================================
341 void toggleTimeFormat();
342
343 //=========================================================================================================
347 void setClockTimeFormat(bool useClock);
348 bool clockTimeFormat() const;
349
350 // ── AbstractView overrides ────────────────────────────────────────
351 void saveSettings() override;
352 void loadSettings() override;
353 void clearView() override;
354
355 //=========================================================================================================
359 int firstVisibleSample() const;
360 int visibleSampleCount() const;
361
362 //=========================================================================================================
366 QRect signalViewportRect() const;
367
368 //=========================================================================================================
375 int sampleToViewportX(int sample) const;
376
377 //=========================================================================================================
384 int viewportXToSample(int x) const;
385
386 //=========================================================================================================
391 ChannelDataModel* model() const { return m_pModel.data(); }
392
393signals:
394 //=========================================================================================================
400 void sampleClicked(int sample);
401
402 //=========================================================================================================
408 void scrollPositionChanged(int sample);
409
410 //=========================================================================================================
414 void sampleRangeSelected(int startSample, int endSample);
415
416 //=========================================================================================================
420 void annotationBoundaryMoved(int annotationIndex, bool isStartBoundary, int newSample);
421
422 //=========================================================================================================
427
428 //=========================================================================================================
433
434 //=========================================================================================================
439
440 void crosshairToggled(bool on);
441 void butterflyToggled(bool on);
442 void scalebarsToggled(bool on);
443 void eventsVisibleToggled(bool on);
445 void overviewBarToggled(bool on);
446 void scrollSpeedChanged(float factor);
447 void epochMarkersToggled(bool on);
448 void clippingToggled(bool on);
449 void zScoreModeToggled(bool on);
450
451 //=========================================================================================================
455 void cursorDataChanged(float timeSec, float amplitude,
456 const QString &channelName, const QString &unitLabel);
457
458protected:
459 void updateGuiMode(GuiMode mode) override;
460 void updateProcessingMode(ProcessingMode mode) override;
461 void keyPressEvent(QKeyEvent *event) override;
462 void resizeEvent(QResizeEvent *event) override;
463
464private slots:
465 void onScrollBarMoved(int value);
466 void onRhiScrollChanged(float sample);
467 void updateScrollBarRange();
468 void onChannelScrollBarMoved(int value);
469 void onChannelOffsetChanged(int firstChannel);
470 void updateChannelScrollBarRange();
471
472private:
473 void setupLayout();
474 void updateSamplesPerPixel();
475
476 QString m_sSettingsPath;
477 QSharedPointer<ChannelDataModel> m_pModel;
478 ChannelLabelPanel* m_pLabelPanel = nullptr;
479 ChannelRhiView* m_pRhiView = nullptr;
480 TimeRulerWidget* m_pTimeRuler = nullptr;
481 OverviewBarWidget* m_pOverviewBar = nullptr;
482 QWidget* m_pRulerHeader = nullptr;
483 QScrollBar* m_pScrollBar = nullptr;
484 QScrollBar* m_pChannelScrollBar = nullptr;
485 QToolButton* m_pScrollModeButton = nullptr;
486
487 bool m_channelScrollBarUpdating = false;
488
489 QSharedPointer<FIFFLIB::FiffInfo> m_pFiffInfo;
490 QMap<qint32, float> m_scaleMap;
491 QColor m_signalColor { Qt::darkGreen };
492 QColor m_bgColor { 250, 250, 250 };
493
494 float m_windowSizeSeconds = 10.f;
495 double m_zoomFactor = 1.0;
496 bool m_hideBadChannels = false;
497 bool m_scrollBarUpdating = false; // re-entrance guard
498
499 int m_firstFileSample = -1; // -1 = not yet set (fall back to model)
500 int m_lastFileSample = -1; // -1 = not yet set
501};
502
503} // namespace DISPLIB
504
505#endif // CHANNELDATAVIEW_H
QRhi-based GPU-accelerated channel time-series renderer used by the modern raw browser.
Minimap thumbnail of the entire recording shown above the raw browser.
Horizontal time-axis ruler displayed beneath ChannelDataView with sample / second ticks.
Common base widget for every dockable Quick-Control settings panel in DISPLIB.
Export macros and build-info hooks for the DISPLIB shared library.
#define DISPSHARED_EXPORT
Definition disp_global.h:38
FIFF file I/O, in-memory data structures and high-level readers/writers.
2-D display widgets and visualisation helpers (charts, topography, colour maps).
DetrendMode
Channel display metadata (read-only from the renderer's perspective).
AbstractView(QWidget *parent=0, Qt::WindowFlags f=Qt::Widget)
ChannelDataView(const QString &sSettingsPath=QString(), QWidget *parent=nullptr, Qt::WindowFlags f=Qt::Widget)
void setScalingMap(const QMap< qint32, float > &scaleMap)
void referenceMarkerRemoveRequested(int sample)
void eventsVisibleToggled(bool on)
void clippingToggled(bool on)
int viewportXToSample(int x) const
void setButterflyMode(bool enabled)
QSharedPointer< ChannelDataView > SPtr
void crosshairToggled(bool on)
void setBackgroundColor(const QColor &color)
void setClockTimeFormat(bool useClock)
void setWindowSize(float seconds)
void sampleClicked(int sample)
DetrendMode detrendMode() const
void zScoreModeToggled(bool on)
void annotationsVisibleToggled(bool on)
void setOverviewBarVisible(bool visible)
QSharedPointer< const ChannelDataView > ConstSPtr
void updateGuiMode(GuiMode mode) override
void setSignalColor(const QColor &color)
void scrollPositionChanged(int sample)
void setData(const Eigen::MatrixXd &data, int firstSample=0)
ChannelDataModel * model() const
void referenceMarkerAddRequested(int sample)
void setEpochMarkersVisible(bool visible)
void setEvents(const QVector< ChannelRhiView::EventMarker > &events)
void setZScoreMode(bool enabled)
void setDetrendMode(DetrendMode mode)
void scrollToSample(int sample, bool animate=true)
void scalebarsToggled(bool on)
void setFileBounds(int first, int last)
void resizeEvent(QResizeEvent *event) override
void init(QSharedPointer< FIFFLIB::FiffInfo > pInfo)
void butterflyToggled(bool on)
void setEpochMarkers(const QVector< int > &triggerSamples)
void setClippingVisible(bool visible)
int sampleToViewportX(int sample) const
void epochMarkersToggled(bool on)
void overviewBarToggled(bool on)
void setAnnotationsVisible(bool visible)
void setScalebarsVisible(bool visible)
void setAnnotationSelectionEnabled(bool enabled)
void updateProcessingMode(ProcessingMode mode) override
void cursorDataChanged(float timeSec, float amplitude, const QString &channelName, const QString &unitLabel)
void addData(const Eigen::MatrixXd &data)
QMap< qint32, float > scalingMap() const
void sampleRangeSelected(int startSample, int endSample)
void setEventsVisible(bool visible)
void scrollSpeedChanged(float factor)
void setCrosshairEnabled(bool enabled)
void annotationBoundaryMoved(int annotationIndex, bool isStartBoundary, int newSample)
void keyPressEvent(QKeyEvent *event) override
void setReferenceMarkers(const QVector< TimeRulerReferenceMark > &markers)
void setAnnotations(const QVector< ChannelRhiView::AnnotationSpan > &annotations)
void setScrollSpeedFactor(float factor)
void setZoom(double factor)
void setChannelFilter(const QStringList &names)
Circular-buffer Qt model exposing a rolling window of the live FIFF stream as a table.
Vertical column of channel-name labels synced with ChannelDataView row geometry.
QRhi-based GPU-accelerated channel time-series renderer used by the modern raw browser.
Minimap thumbnail of the entire recording shown above the raw browser.
Horizontal time-axis ruler displayed beneath ChannelDataView.
Full FIFF measurement info: per-channel descriptors, sampling and filter setup, projectors,...
Definition fiff_info.h:88