v2.0.0
Loading...
Searching...
No Matches
channeldataview.h
Go to the documentation of this file.
1//=============================================================================================================
34
35#ifndef CHANNELDATAVIEW_H
36#define CHANNELDATAVIEW_H
37
38//=============================================================================================================
39// INCLUDES
40//=============================================================================================================
41
42#include "../disp_global.h"
43#include "abstractview.h"
44
45//=============================================================================================================
46// QT INCLUDES
47//=============================================================================================================
48
49#include <QMap>
50#include <QRect>
51#include <QSharedPointer>
52#include <QStringList>
53#include <QVector>
54
58
59//=============================================================================================================
60// EIGEN INCLUDES
61//=============================================================================================================
62
63#include <Eigen/Core>
64
65//=============================================================================================================
66// FORWARD DECLARATIONS
67//=============================================================================================================
68
69class QScrollBar;
70class QSplitter;
71class QToolButton;
72
73namespace FIFFLIB {
74 class FiffInfo;
75}
76
77//=============================================================================================================
78// DEFINE NAMESPACE DISPLIB
79//=============================================================================================================
80
81namespace DISPLIB
82{
83
84//=============================================================================================================
85// DISPLIB FORWARD DECLARATIONS
86//=============================================================================================================
87
88enum class DetrendMode;
91class TimeRulerWidget;
92
93//=============================================================================================================
120{
121 Q_OBJECT
122
123public:
124 typedef QSharedPointer<ChannelDataView> SPtr;
125 typedef QSharedPointer<const ChannelDataView> ConstSPtr;
126
127 //=========================================================================================================
135 explicit ChannelDataView(const QString &sSettingsPath = QString(),
136 QWidget *parent = nullptr,
137 Qt::WindowFlags f = Qt::Widget);
138
139 ~ChannelDataView() override;
140
141 // ── Initialisation ────────────────────────────────────────────────
142
143 //=========================================================================================================
149 void init(QSharedPointer<FIFFLIB::FiffInfo> pInfo);
150
151 // ── Data management ───────────────────────────────────────────────
152
153 //=========================================================================================================
160 void setData(const Eigen::MatrixXd &data, int firstSample = 0);
161
162 //=========================================================================================================
168 void addData(const Eigen::MatrixXd &data);
169
170 // ── Scroll / zoom API ─────────────────────────────────────────────
171
172 //=========================================================================================================
179 void scrollToSample(int sample, bool animate = true);
180
181 //=========================================================================================================
188 void setWindowSize(float seconds);
189
190 //=========================================================================================================
194 float windowSize() const;
195
196 //=========================================================================================================
202 void setZoom(double factor);
203
204 //=========================================================================================================
208 double zoom() const;
209
210 // ── Visual properties ─────────────────────────────────────────────
211
212 //=========================================================================================================
218 void setBackgroundColor(const QColor &color);
219 QColor backgroundColor() const;
220
221 //=========================================================================================================
227 void setSignalColor(const QColor &color);
228 QColor signalColor() const;
229
230 //=========================================================================================================
237 void setScalingMap(const QMap<qint32, float> &scaleMap);
238 QMap<qint32, float> scalingMap() const;
239
240 //=========================================================================================================
246 void hideBadChannels(bool hide);
247 bool badChannelsHidden() const;
248
249 //=========================================================================================================
257 void setChannelFilter(const QStringList &names);
258
259 //=========================================================================================================
266 void setRemoveDC(bool dc);
267
268 //=========================================================================================================
275 void setDetrendMode(DetrendMode mode);
276 DetrendMode detrendMode() const;
277
278 //=========================================================================================================
287 void setFileBounds(int first, int last);
288
289 //=========================================================================================================
296 void setEvents(const QVector<ChannelRhiView::EventMarker> &events);
297
298 void setEpochMarkers(const QVector<int> &triggerSamples);
299 void setEpochMarkersVisible(bool visible);
300 bool epochMarkersVisible() const;
301
302 void setClippingVisible(bool visible);
303 bool clippingVisible() const;
304
305 void setZScoreMode(bool enabled);
306 bool zScoreMode() const;
307
308 //=========================================================================================================
314 void setReferenceMarkers(const QVector<TimeRulerReferenceMark> &markers);
315
316 //=========================================================================================================
322 void setAnnotations(const QVector<ChannelRhiView::AnnotationSpan> &annotations);
323
324 //=========================================================================================================
328 void setAnnotationSelectionEnabled(bool enabled);
329
330 void setEventsVisible(bool visible);
331 bool eventsVisible() const;
332
333 void setAnnotationsVisible(bool visible);
334 bool annotationsVisible() const;
335
336 void setOverviewBarVisible(bool visible);
337 bool overviewBarVisible() const;
338
339 void setScrollSpeedFactor(float factor);
340 float scrollSpeedFactor() const;
341
342 void sortChannelsByType();
343 void resetChannelOrder();
344
345 // ── Interactive inspection features ───────────────────────────────
346
347 //=========================================================================================================
351 void setCrosshairEnabled(bool enabled);
352 bool crosshairEnabled() const;
353
354 //=========================================================================================================
358 void setScalebarsVisible(bool visible);
359 bool scalebarsVisible() const;
360
361 //=========================================================================================================
365 void setButterflyMode(bool enabled);
366 bool butterflyMode() const;
367
368 //=========================================================================================================
372 void toggleTimeFormat();
373
374 //=========================================================================================================
378 void setClockTimeFormat(bool useClock);
379 bool clockTimeFormat() const;
380
381 // ── AbstractView overrides ────────────────────────────────────────
382 void saveSettings() override;
383 void loadSettings() override;
384 void clearView() override;
385
386 //=========================================================================================================
390 int firstVisibleSample() const;
391 int visibleSampleCount() const;
392
393 //=========================================================================================================
397 QRect signalViewportRect() const;
398
399 //=========================================================================================================
406 int sampleToViewportX(int sample) const;
407
408 //=========================================================================================================
415 int viewportXToSample(int x) const;
416
417 //=========================================================================================================
422 ChannelDataModel* model() const { return m_pModel.data(); }
423
424signals:
425 //=========================================================================================================
431 void sampleClicked(int sample);
432
433 //=========================================================================================================
439 void scrollPositionChanged(int sample);
440
441 //=========================================================================================================
445 void sampleRangeSelected(int startSample, int endSample);
446
447 //=========================================================================================================
451 void annotationBoundaryMoved(int annotationIndex, bool isStartBoundary, int newSample);
452
453 //=========================================================================================================
458
459 //=========================================================================================================
464
465 //=========================================================================================================
470
471 void crosshairToggled(bool on);
472 void butterflyToggled(bool on);
473 void scalebarsToggled(bool on);
474 void eventsVisibleToggled(bool on);
476 void overviewBarToggled(bool on);
477 void scrollSpeedChanged(float factor);
478 void epochMarkersToggled(bool on);
479 void clippingToggled(bool on);
480 void zScoreModeToggled(bool on);
481
482 //=========================================================================================================
486 void cursorDataChanged(float timeSec, float amplitude,
487 const QString &channelName, const QString &unitLabel);
488
489protected:
490 void updateGuiMode(GuiMode mode) override;
491 void updateProcessingMode(ProcessingMode mode) override;
492 void keyPressEvent(QKeyEvent *event) override;
493 void resizeEvent(QResizeEvent *event) override;
494
495private slots:
496 void onScrollBarMoved(int value);
497 void onRhiScrollChanged(float sample);
498 void updateScrollBarRange();
499 void onChannelScrollBarMoved(int value);
500 void onChannelOffsetChanged(int firstChannel);
501 void updateChannelScrollBarRange();
502
503private:
504 void setupLayout();
505 void updateSamplesPerPixel();
506
507 QString m_sSettingsPath;
508 QSharedPointer<ChannelDataModel> m_pModel;
509 ChannelLabelPanel* m_pLabelPanel = nullptr;
510 ChannelRhiView* m_pRhiView = nullptr;
511 TimeRulerWidget* m_pTimeRuler = nullptr;
512 OverviewBarWidget* m_pOverviewBar = nullptr;
513 QWidget* m_pRulerHeader = nullptr;
514 QScrollBar* m_pScrollBar = nullptr;
515 QScrollBar* m_pChannelScrollBar = nullptr;
516 QToolButton* m_pScrollModeButton = nullptr;
517
518 bool m_channelScrollBarUpdating = false;
519
520 QSharedPointer<FIFFLIB::FiffInfo> m_pFiffInfo;
521 QMap<qint32, float> m_scaleMap;
522 QColor m_signalColor { Qt::darkGreen };
523 QColor m_bgColor { 250, 250, 250 };
524
525 float m_windowSizeSeconds = 10.f;
526 double m_zoomFactor = 1.0;
527 bool m_hideBadChannels = false;
528 bool m_scrollBarUpdating = false; // re-entrance guard
529
530 int m_firstFileSample = -1; // -1 = not yet set (fall back to model)
531 int m_lastFileSample = -1; // -1 = not yet set
532};
533
534} // namespace DISPLIB
535
536#endif // CHANNELDATAVIEW_H
disp library export/import macros.
#define DISPSHARED_EXPORT
Definition disp_global.h:51
Declaration of the AbstractView Class.
Declaration of the TimeRulerWidget class.
Declaration of the OverviewBarWidget class.
Declaration of the ChannelRhiView class.
FIFF file I/O and data structures (raw, epochs, evoked, covariance, forward).
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)
ChannelDataModel – lightweight data container for ChannelDataView / ChannelRhiView.
Fixed-width panel showing channel names and metadata, left of the render surface.
ChannelRhiView – QRhiWidget-based channel signal renderer.
Minimap / overview bar showing the full recording extent.
TimeRulerWidget – a thin horizontal time axis ruler for ChannelDataView.
FIFF measurement file information.
Definition fiff_info.h:86