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
47class BrainSurface;
48
49//=============================================================================================================
65{
66public:
67 //=========================================================================================================
71 SensorFieldMapper() = default;
72
73 //=========================================================================================================
82
83 //=========================================================================================================
87 bool isLoaded() const { return m_loaded; }
88
89 //=========================================================================================================
95 void setTimePoint(int tp) { m_timePoint = tp; }
96
100 int timePoint() const { return m_timePoint; }
101
102 //=========================================================================================================
109 void setMegFieldMapOnHead(bool onHead) { m_megOnHead = onHead; }
110
111 bool megFieldMapOnHead() const { return m_megOnHead; }
112
113 //=========================================================================================================
119 void setColormap(const QString &name) { m_colormap = name; }
120
121 const QString &colormap() const { return m_colormap; }
122
123 //=========================================================================================================
127 const FIFFLIB::FiffEvoked &evoked() const { return m_evoked; }
128
129 //=========================================================================================================
138 bool hasMappingFor(const FIFFLIB::FiffEvoked &newEvoked) const;
139
143 const Eigen::VectorXi &megPick() const { return m_megPick; }
144
148 const Eigen::VectorXi &eegPick() const { return m_eegPick; }
149
153 std::shared_ptr<Eigen::MatrixXf> megMapping() const { return m_megMapping; }
154
158 std::shared_ptr<Eigen::MatrixXf> eegMapping() const { return m_eegMapping; }
159
160 //=========================================================================================================
173 bool buildMapping(const QMap<QString, std::shared_ptr<BrainSurface>> &surfaces,
174 const FIFFLIB::FiffCoordTrans &headToMriTrans,
175 bool applySensorTrans);
176
177 //=========================================================================================================
188 void apply(QMap<QString, std::shared_ptr<BrainSurface>> &surfaces,
189 const SubView &singleView,
190 const QVector<SubView> &subViews);
191
192 //=========================================================================================================
196 const QString &megSurfaceKey() const { return m_megSurfaceKey; }
197
201 const QString &eegSurfaceKey() const { return m_eegSurfaceKey; }
202
203 //=========================================================================================================
204 // ── Static utilities ───────────────────────────────────────────────
205
212 static QString findHeadSurfaceKey(const QMap<QString, std::shared_ptr<BrainSurface>> &surfaces);
213
217 static QString findHelmetSurfaceKey(const QMap<QString, std::shared_ptr<BrainSurface>> &surfaces);
218
222 static float contourStep(float minVal, float maxVal, int targetTicks);
223
237 static Eigen::Vector3f fitSphereOrigin(const FIFFLIB::FiffInfo &info,
238 float *radius = nullptr);
239
256 void computeNormRange();
257
258private:
259 //=========================================================================================================
260 // ── Contour surface generation ─────────────────────────────────────
261
274 void updateContourSurfaces(QMap<QString, std::shared_ptr<BrainSurface>> &surfaces,
275 const QString &prefix,
276 const BrainSurface &surface,
277 const QVector<float> &values,
278 float step,
279 bool visible);
280
281 //=========================================================================================================
282 // ── Internal data ──────────────────────────────────────────────────
283
284 FIFFLIB::FiffEvoked m_evoked;
285 bool m_loaded = false;
286 int m_timePoint = 0;
287 bool m_megOnHead = false;
288 QString m_colormap = QStringLiteral("MNE");
289
290 QString m_megSurfaceKey;
291 QString m_eegSurfaceKey;
292 QString m_megContourPrefix = QStringLiteral("sens_contour_meg");
293 QString m_eegContourPrefix = QStringLiteral("sens_contour_eeg");
294
295 Eigen::VectorXi m_megPick;
296 Eigen::VectorXi m_eegPick;
297 std::vector<Eigen::Vector3f> m_megPositions;
298 std::vector<Eigen::Vector3f> m_eegPositions;
299 std::shared_ptr<Eigen::MatrixXf> m_megMapping;
300 std::shared_ptr<Eigen::MatrixXf> m_eegMapping;
301
302 float m_megVmax = 0.0f;
303 float m_eegVmax = 0.0f;
304};
305
306#endif // SENSORFIELDMAPPER_H
Per-viewport state (camera preset, zoom, pan, visibility filter) and serialisation helpers.
Library export/import macros and namespace marker for the disp3D library.
#define DISP3DSHARED_EXPORT
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-...
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.
void setMegFieldMapOnHead(bool onHead)
const QString & colormap() const
SensorFieldMapper()=default
const QString & megSurfaceKey() const
void setTimePoint(int tp)
std::shared_ptr< Eigen::MatrixXf > megMapping() const
const FIFFLIB::FiffEvoked & evoked() const
void setColormap(const QString &name)
bool megFieldMapOnHead() const
const QString & eegSurfaceKey() const
const Eigen::VectorXi & megPick() const
void setEvoked(const FIFFLIB::FiffEvoked &evoked)
const Eigen::VectorXi & eegPick() const
std::shared_ptr< Eigen::MatrixXf > eegMapping() 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:75
Full FIFF measurement info: per-channel descriptors, sampling and filter setup, projectors,...
Definition fiff_info.h:88