v2.0.0
Loading...
Searching...
No Matches
sourceestimatemanager.h
Go to the documentation of this file.
1//=============================================================================================================
19
20#ifndef SOURCEESTIMATEMANAGER_H
21#define SOURCEESTIMATEMANAGER_H
22
23//=============================================================================================================
24// INCLUDES
25//=============================================================================================================
26
27#include "../disp3D_global.h"
28
29#include <QObject>
30#include <QVector>
31#include <QMap>
32#include <QString>
33#include <Eigen/Core>
34#include <memory>
35
36//=============================================================================================================
37// FORWARD DECLARATIONS
38//=============================================================================================================
39
40class QThread;
41class BrainSurface;
45struct SubView;
46
47//=============================================================================================================
58{
59 Q_OBJECT
60
61public:
62 //=========================================================================================================
68 explicit SourceEstimateManager(QObject *parent = nullptr);
69
70 //=========================================================================================================
74 ~SourceEstimateManager() override;
75
76 // ── Loading ────────────────────────────────────────────────────────
77
87 bool load(const QString &lhPath, const QString &rhPath,
88 const QMap<QString, std::shared_ptr<BrainSurface>> &surfaces,
89 const QString &activeSurfaceType);
90
94 void cancelLoading();
95
99 bool isLoading() const { return m_isLoading; }
100
104 bool isLoaded() const;
105
106 // ── Time-point navigation ──────────────────────────────────────────
107
116 void setTimePoint(int index,
117 const QMap<QString, std::shared_ptr<BrainSurface>> &surfaces,
118 const SubView &singleView,
119 const QVector<SubView> &subViews);
120
122 int currentTimePoint() const { return m_currentTimePoint; }
123
125 float tstep() const;
126
128 float tmin() const;
129
131 int numTimePoints() const;
132
134 int closestIndex(float timeSec) const;
135
136 // ── Colormap / thresholds ──────────────────────────────────────────
137
143 void setColormap(const QString &name);
144
152 void setThresholds(float min, float mid, float max);
153
154 // ── Real-time streaming ────────────────────────────────────────────
155
164 void startStreaming(const QMap<QString, std::shared_ptr<BrainSurface>> &surfaces,
165 const SubView &singleView,
166 const QVector<SubView> &subViews);
167
169 void stopStreaming();
170
172 bool isStreaming() const { return m_isStreaming; }
173
175 void pushData(const Eigen::VectorXd &data);
176
178 void setInterval(int msec);
179
181 void setLooping(bool enabled);
182
183 // ── Accessors ──────────────────────────────────────────────────────
184
186 const SourceEstimateOverlay *overlay() const;
187
188signals:
189 //=========================================================================================================
192
194 void thresholdsUpdated(float min, float mid, float max);
195
197 void timePointChanged(int index, float time);
198
200 void loadingProgress(int percent, const QString &message);
201
207 void realtimeColorsAvailable(const QVector<uint32_t> &colorsLh,
208 const QVector<uint32_t> &colorsRh);
209
210private slots:
212 void onStcLoadingFinished(bool success);
213
214private:
215 std::unique_ptr<SourceEstimateOverlay> m_overlay;
216 std::unique_ptr<RtSourceDataController> m_rtController;
217 QThread *m_loadingThread = nullptr;
218 StcLoadingWorker *m_stcWorker = nullptr;
219 int m_currentTimePoint = 0;
220 bool m_isLoading = false;
221 bool m_isStreaming = false;
222};
223
224#endif // SOURCEESTIMATEMANAGER_H
Library export/import macros and namespace marker for the disp3D library.
#define DISP3DSHARED_EXPORT
Viewport subdivision holding its own camera, projection, and scissor rectangle.
Definition viewstate.h:139
Renderable cortical surface mesh with per-vertex color, curvature data, and GPU buffer management.
Color-mapped source estimate overlay that interpolates activation values onto a cortical surface mesh...
bool load(const QString &lhPath, const QString &rhPath, const QMap< QString, std::shared_ptr< BrainSurface > > &surfaces, const QString &activeSurfaceType)
void loadingProgress(int percent, const QString &message)
void timePointChanged(int index, float time)
void loaded(int numTimePoints)
void thresholdsUpdated(float min, float mid, float max)
void realtimeColorsAvailable(const QVector< uint32_t > &colorsLh, const QVector< uint32_t > &colorsRh)
SourceEstimateManager(QObject *parent=nullptr)
Controller for real-time source estimate streaming.
Background worker that loads source estimate (STC) files and emits loaded data for visualization.