v2.0.0
Loading...
Searching...
No Matches
sensorfieldmapper.h
Go to the documentation of this file.
1//=============================================================================================================
25
26#ifndef SENSORFIELDMAPPER_H
27#define SENSORFIELDMAPPER_H
28
29//=============================================================================================================
30// INCLUDES
31//=============================================================================================================
32
33#include "../disp3D_global.h"
34
35#include "core/viewstate.h"
36
37#include <fiff/fiff_evoked.h>
39
40#include <Eigen/Core>
41#include <QMap>
42#include <QVector>
43#include <QString>
44#include <memory>
45#include <vector>
46
47namespace DISP3DLIB
48{
49
50class BrainSurface;
51
52//=============================================================================================================
70{
71public:
72 //=========================================================================================================
76 SensorFieldMapper() = default;
77
78 //=========================================================================================================
87
88 //=========================================================================================================
92 bool isLoaded() const
93 {
94 return m_loaded;
95 }
96
97 //=========================================================================================================
103 void setTimePoint(int tp)
104 {
105 m_timePoint = tp;
106 }
107
111 int timePoint() const
112 {
113 return m_timePoint;
114 }
115
116 //=========================================================================================================
123 void setMegFieldMapOnHead(bool onHead)
124 {
125 m_megOnHead = onHead;
126 }
127
128 bool megFieldMapOnHead() const
129 {
130 return m_megOnHead;
131 }
132
133 //=========================================================================================================
139 void setColormap(const QString& name)
140 {
141 m_colormap = name;
142 }
143
144 const QString& colormap() const
145 {
146 return m_colormap;
147 }
148
149 //=========================================================================================================
154 {
155 return m_evoked;
156 }
157
158 //=========================================================================================================
167 bool hasMappingFor(const FIFFLIB::FiffEvoked& newEvoked) const;
168
172 const Eigen::VectorXi& megPick() const
173 {
174 return m_megPick;
175 }
176
180 const Eigen::VectorXi& eegPick() const
181 {
182 return m_eegPick;
183 }
184
188 std::shared_ptr<Eigen::MatrixXf> megMapping() const
189 {
190 return m_megMapping;
191 }
192
196 std::shared_ptr<Eigen::MatrixXf> eegMapping() const
197 {
198 return m_eegMapping;
199 }
200
201 //=========================================================================================================
214 bool buildMapping(const QMap<QString, std::shared_ptr<BrainSurface>>& surfaces,
215 const FIFFLIB::FiffCoordTrans& headToMriTrans,
216 bool applySensorTrans);
217
218 //=========================================================================================================
229 void apply(QMap<QString, std::shared_ptr<BrainSurface>>& surfaces,
230 const SubView& singleView,
231 const QVector<SubView>& subViews);
232
233 //=========================================================================================================
237 const QString& megSurfaceKey() const
238 {
239 return m_megSurfaceKey;
240 }
241
245 const QString& eegSurfaceKey() const
246 {
247 return m_eegSurfaceKey;
248 }
249
250 //=========================================================================================================
251 // ── Static utilities ───────────────────────────────────────────────
252
262 static QString findHeadSurfaceKey(const QMap<QString, std::shared_ptr<BrainSurface>>& surfaces);
263
270 static QString findHelmetSurfaceKey(const QMap<QString, std::shared_ptr<BrainSurface>>& surfaces);
271
280 static float contourStep(float minVal, float maxVal, int targetTicks);
281
295 static Eigen::Vector3f fitSphereOrigin(const FIFFLIB::FiffInfo& info,
296 float* radius = nullptr);
297
314 void computeNormRange();
315
316private:
317 //=========================================================================================================
318 // ── Contour surface generation ─────────────────────────────────────
319
332 void updateContourSurfaces(QMap<QString, std::shared_ptr<BrainSurface>>& surfaces,
333 const QString& prefix,
334 const BrainSurface& surface,
335 const QVector<float>& values,
336 float step,
337 bool visible);
338
339 //=========================================================================================================
340 // ── Internal data ──────────────────────────────────────────────────
341
342 FIFFLIB::FiffEvoked m_evoked;
343 bool m_loaded = false;
344 int m_timePoint = 0;
345 bool m_megOnHead = false;
346 QString m_colormap = QStringLiteral("MNE");
347
348 QString m_megSurfaceKey;
349 QString m_eegSurfaceKey;
350 QString m_megContourPrefix = QStringLiteral("sens_contour_meg");
351 QString m_eegContourPrefix = QStringLiteral("sens_contour_eeg");
352
353 Eigen::VectorXi m_megPick;
354 Eigen::VectorXi m_eegPick;
355 std::vector<Eigen::Vector3f> m_megPositions;
356 std::vector<Eigen::Vector3f> m_eegPositions;
357 std::shared_ptr<Eigen::MatrixXf> m_megMapping;
358 std::shared_ptr<Eigen::MatrixXf> m_eegMapping;
359
360 float m_megVmax = 0.0f;
361 float m_eegVmax = 0.0f;
362};
363
364} // namespace DISP3DLIB
365
366#endif // SENSORFIELDMAPPER_H
Single averaged evoked response: time axis, samples, baseline, channel info and processing history.
4x4 affine FIFF coordinate transform (FIFF_COORD_TRANS) annotated with source/destination coordinate-...
Library export/import macros and namespace marker for the disp3D library.
#define DISP3DSHARED_EXPORT
Per-viewport state (camera preset, zoom, pan, visibility filter) and serialisation helpers.
3-D brain visualisation using the Qt RHI rendering backend.
Viewport subdivision holding its own camera, projection, and scissor rectangle.
Definition viewstate.h:143
Renderable cortical surface mesh with per-vertex color, curvature data, and GPU buffer management.
void setMegFieldMapOnHead(bool onHead)
void setColormap(const QString &name)
const Eigen::VectorXi & megPick() const
const Eigen::VectorXi & eegPick() const
const QString & eegSurfaceKey() const
void setEvoked(const FIFFLIB::FiffEvoked &evoked)
std::shared_ptr< Eigen::MatrixXf > eegMapping() const
const QString & megSurfaceKey() const
std::shared_ptr< Eigen::MatrixXf > megMapping() const
const FIFFLIB::FiffEvoked & evoked() const
const QString & colormap() const
Labelled 4x4 FIFF affine: source frame, destination frame, rotation, translation and cached inverse.
Single averaged evoked response: time axis, data, baseline, channel info and averaging metadata.
Definition fiff_evoked.h:77
Full FIFF measurement info: per-channel descriptors, sampling and filter setup, projectors,...
Definition fiff_info.h:90