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{
62class FiffInfo;
63}
64
65//=============================================================================================================
66// DEFINE NAMESPACE DISPLIB
67//=============================================================================================================
68
69namespace DISPLIB
70{
71
72//=============================================================================================================
73// DISPLIB FORWARD DECLARATIONS
74//=============================================================================================================
75
76enum class DetrendMode;
79class TimeRulerWidget;
80
81//=============================================================================================================
90{
91 Q_OBJECT
92
93public:
94 typedef QSharedPointer<ChannelDataView> SPtr;
95 typedef QSharedPointer<const ChannelDataView> ConstSPtr;
96
97 //=========================================================================================================
105 explicit ChannelDataView(const QString& sSettingsPath = QString(),
106 QWidget* parent = nullptr,
107 Qt::WindowFlags f = Qt::Widget);
108
109 ~ChannelDataView() override;
110
111 // ── Initialisation ────────────────────────────────────────────────
112
113 //=========================================================================================================
119 void init(QSharedPointer<FIFFLIB::FiffInfo> pInfo);
120
121 // ── Data management ───────────────────────────────────────────────
122
123 //=========================================================================================================
130 void setData(const Eigen::MatrixXd& matData, int firstSample = 0);
131
132 //=========================================================================================================
138 void addData(const Eigen::MatrixXd& matData);
139
140 // ── Scroll / zoom API ─────────────────────────────────────────────
141
142 //=========================================================================================================
149 void scrollToSample(int sample, bool animate = true);
150
151 //=========================================================================================================
158 void setWindowSize(float seconds);
159
160 //=========================================================================================================
166 float windowSize() const;
167
168 //=========================================================================================================
174 void setZoom(double factor);
175
176 //=========================================================================================================
182 double zoom() const;
183
184 // ── Visual properties ─────────────────────────────────────────────
185
186 //=========================================================================================================
192 void setBackgroundColor(const QColor& color);
193 QColor backgroundColor() const;
194
195 //=========================================================================================================
201 void setSignalColor(const QColor& color);
202 QColor signalColor() const;
203
204 //=========================================================================================================
211 void setScalingMap(const QMap<qint32, float>& scaleMap);
212 QMap<qint32, float> scalingMap() const;
213
214 //=========================================================================================================
220 void hideBadChannels(bool hide);
221 bool badChannelsHidden() const;
222
223 //=========================================================================================================
231 void setChannelFilter(const QStringList& names);
232
233 //=========================================================================================================
240 void setRemoveDC(bool dc);
241
242 //=========================================================================================================
249 void setDetrendMode(DetrendMode mode);
250 DetrendMode detrendMode() const;
251
252 //=========================================================================================================
261 void setFileBounds(int first, int last);
262
263 //=========================================================================================================
270 void setEvents(const QVector<ChannelRhiView::EventMarker>& events);
271
272 void setEpochMarkers(const QVector<int>& triggerSamples);
273 void setEpochMarkersVisible(bool visible);
274 bool epochMarkersVisible() const;
275
276 void setClippingVisible(bool visible);
277 bool clippingVisible() const;
278
279 void setZScoreMode(bool enabled);
280 bool zScoreMode() const;
281
282 //=========================================================================================================
288 void setReferenceMarkers(const QVector<TimeRulerReferenceMark>& markers);
289
290 //=========================================================================================================
296 void setAnnotations(const QVector<ChannelRhiView::AnnotationSpan>& annotations);
297
298 //=========================================================================================================
304 void setAnnotationSelectionEnabled(bool enabled);
305
306 void setEventsVisible(bool visible);
307 bool eventsVisible() const;
308
309 void setAnnotationsVisible(bool visible);
310 bool annotationsVisible() const;
311
312 void setOverviewBarVisible(bool visible);
313 bool overviewBarVisible() const;
314
315 void setScrollSpeedFactor(float factor);
316 float scrollSpeedFactor() const;
317
318 void sortChannelsByType();
319 void resetChannelOrder();
320
321 // ── Interactive inspection features ───────────────────────────────
322
323 //=========================================================================================================
329 void setCrosshairEnabled(bool enabled);
330 bool crosshairEnabled() const;
331
332 //=========================================================================================================
341 QImage renderToImage(const QSize& size = QSize()) const;
342
343 //=========================================================================================================
349 void setScalebarsVisible(bool visible);
350 bool scalebarsVisible() const;
351
352 //=========================================================================================================
358 void setButterflyMode(bool enabled);
359 bool butterflyMode() const;
360
361 //=========================================================================================================
365 void toggleTimeFormat();
366
367 //=========================================================================================================
373 void setClockTimeFormat(bool useClock);
374 bool clockTimeFormat() const;
375
376 // ── AbstractView overrides ────────────────────────────────────────
377 void saveSettings() override;
378 void loadSettings() override;
379 void clearView() override;
380
381 //=========================================================================================================
387 int firstVisibleSample() const;
388 int visibleSampleCount() const;
389
390 //=========================================================================================================
396 QRect signalViewportRect() const;
397
398 //=========================================================================================================
405 int sampleToViewportX(int sample) const;
406
407 //=========================================================================================================
414 int viewportXToSample(int x) const;
415
416 //=========================================================================================================
424 {
425 return m_pModel.data();
426 }
427
428signals:
429 //=========================================================================================================
435 void sampleClicked(int sample);
436
437 //=========================================================================================================
443 void scrollPositionChanged(int sample);
444
445 //=========================================================================================================
449 void sampleRangeSelected(int startSample, int endSample);
450
451 //=========================================================================================================
455 void annotationBoundaryMoved(int annotationIndex, bool isStartBoundary, int newSample);
456
457 //=========================================================================================================
462
463 //=========================================================================================================
468
469 //=========================================================================================================
474
475 void crosshairToggled(bool on);
476 void butterflyToggled(bool on);
477 void scalebarsToggled(bool on);
478 void eventsVisibleToggled(bool on);
480 void overviewBarToggled(bool on);
481 void scrollSpeedChanged(float factor);
482 void epochMarkersToggled(bool on);
483 void clippingToggled(bool on);
484 void zScoreModeToggled(bool on);
485
486 //=========================================================================================================
490 void cursorDataChanged(float timeSec, float amplitude,
491 const QString& channelName, const QString& unitLabel);
492
493protected:
494 void updateGuiMode(GuiMode mode) override;
495 void updateProcessingMode(ProcessingMode mode) override;
496 void keyPressEvent(QKeyEvent* event) override;
497 void resizeEvent(QResizeEvent* event) override;
498
499private slots:
500 void onScrollBarMoved(int value);
501 void onRhiScrollChanged(float sample);
502 void updateScrollBarRange();
503 void onChannelScrollBarMoved(int value);
504 void onChannelOffsetChanged(int firstChannel);
505 void updateChannelScrollBarRange();
506
507private:
508 void setupLayout();
509 void updateSamplesPerPixel();
510
511 QString m_sSettingsPath;
512 QSharedPointer<ChannelDataModel> m_pModel;
513 ChannelLabelPanel* m_pLabelPanel = nullptr;
514 ChannelRhiView* m_pRhiView = nullptr;
515 TimeRulerWidget* m_pTimeRuler = nullptr;
516 OverviewBarWidget* m_pOverviewBar = nullptr;
517 QWidget* m_pRulerHeader = nullptr;
518 QScrollBar* m_pScrollBar = nullptr;
519 QScrollBar* m_pChannelScrollBar = nullptr;
520 QToolButton* m_pScrollModeButton = nullptr;
521
522 bool m_channelScrollBarUpdating = false;
523
524 QSharedPointer<FIFFLIB::FiffInfo> m_pFiffInfo;
525 QMap<qint32, float> m_scaleMap;
526 QColor m_signalColor{Qt::darkGreen};
527 QColor m_bgColor{250, 250, 250};
528
529 float m_windowSizeSeconds = 10.f;
530 double m_zoomFactor = 1.0;
531 bool m_hideBadChannels = false;
532 bool m_scrollBarUpdating = false; // re-entrance guard
533
534 int m_firstFileSample = -1; // -1 = not yet set (fall back to model)
535 int m_lastFileSample = -1; // -1 = not yet set
536};
537
538} // namespace DISPLIB
539
540#endif // CHANNELDATAVIEW_H
Export macros and build-info hooks for the DISPLIB shared library.
#define DISPSHARED_EXPORT
Definition disp_global.h:38
Common base widget for every dockable Quick-Control settings panel in DISPLIB.
Minimap thumbnail of the entire recording shown above the raw browser.
Horizontal time-axis ruler displayed beneath DISPLIB::ChannelDataView with sample / second ticks.
QRhi-based GPU-accelerated channel time-series renderer used by the modern raw browser.
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)
void setData(const Eigen::MatrixXd &matData, int firstSample=0)
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)
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)
QImage renderToImage(const QSize &size=QSize()) const
void setAnnotationSelectionEnabled(bool enabled)
void updateProcessingMode(ProcessingMode mode) override
void cursorDataChanged(float timeSec, float amplitude, const QString &channelName, const QString &unitLabel)
QMap< qint32, float > scalingMap() const
void sampleRangeSelected(int startSample, int endSample)
void setEventsVisible(bool visible)
void addData(const Eigen::MatrixXd &matData)
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:90