v2.0.0
Loading...
Searching...
No Matches
viewstate.h
Go to the documentation of this file.
1//=============================================================================================================
24
25#ifndef VIEWSTATE_H
26#define VIEWSTATE_H
27
28//=============================================================================================================
29// INCLUDES
30//=============================================================================================================
31
32#include "../disp3D_global.h"
33
34#include "rendertypes.h"
35
36#include <QString>
37#include <QMap>
38#include <QQuaternion>
39#include <QVector2D>
40#include <QVariant>
41#include <QColor>
42
43#include <algorithm>
44#include <memory>
45
46//=============================================================================================================
47// FORWARD DECLARATIONS
48//=============================================================================================================
49
50class QSettings;
51
52namespace DISP3DLIB
53{
54
55class BrainSurface;
56
57//=============================================================================================================
68{
69 bool lh = true;
70 bool rh = true;
71 bool bemHead = true;
72 bool bemOuterSkull = true;
73 bool bemInnerSkull = true;
74 bool sensMeg = false;
75 bool sensMegGrad = false;
76 bool sensMegMag = false;
77 bool sensMegHelmet = false;
78 bool sensEeg = false;
79 bool dig = false;
80 bool digCardinal = false;
81 bool digHpi = false;
82 bool digEeg = false;
83 bool digExtra = false;
84 bool megFieldMap = false;
85 bool eegFieldMap = false;
86 bool megFieldContours = false;
87 bool eegFieldContours = false;
88 bool dipoles = true;
89 bool sourceSpace = false;
90 bool network = false;
91 bool megFieldMapOnHead = false;
92 bool mriSlices = true;
93
94 //=========================================================================================================
101 bool isObjectVisible(const QString& object) const;
102
103 //=========================================================================================================
110 void setObjectVisible(const QString& object, bool visible);
111
112 //=========================================================================================================
119 void load(const QSettings& settings, const QString& prefix);
120
121 //=========================================================================================================
128 void save(QSettings& settings, const QString& prefix) const;
129};
130
131//=============================================================================================================
143{
144 // ── Per-view render configuration ──────────────────────────────────
145 QString surfaceType = "pial";
150
151 // ── Per-view camera state ─────────────────────────────────────────
152 float zoom = 0.0f;
153 QVector2D pan;
155 int preset = 1; // 0=Top,1=Perspective,...,6=Right
156 bool enabled = true;
157
158 // ── Per-viewport timeline state ───────────────────────────────────
160 double playbackSpeed = 1.0;
161 double stcStepAccum = 0.0;
162 bool isPlaying = false;
163
164 // ── FsSurface classification helpers ─────────────────────────────────
165
173 static bool isBrainSurfaceKey(const QString& key);
174
182 bool matchesSurfaceType(const QString& key) const;
183
191 bool shouldRenderSurface(const QString& key) const;
192
200 QMap<QString, std::shared_ptr<BrainSurface>>& surfaces) const;
201
202 // ── Serialisation ──────────────────────────────────────────────────
203
211 void load(const QSettings& settings, const QString& prefix,
212 const QQuaternion& fallbackRotation = QQuaternion());
213
220 void save(QSettings& settings, const QString& prefix) const;
221
222 // ── Factory ─────────────────────────────────────────────────────────
223
234 static SubView defaultForIndex(int index);
235};
236
237//=============================================================================================================
238// FREE FUNCTIONS — camera presets
239//=============================================================================================================
240
247
254DISP3DSHARED_EXPORT QString multiViewPresetName(int preset);
255
262DISP3DSHARED_EXPORT QQuaternion multiViewPresetOffset(int preset);
263
272
273//=============================================================================================================
274// FREE FUNCTIONS — enum ↔ string conversion
275//=============================================================================================================
276
285DISP3DSHARED_EXPORT int normalizedVisualizationTarget(int target, int maxIndex = 3);
286
294
302
310
318
319//=============================================================================================================
320// FREE FUNCTIONS — colormap
321//=============================================================================================================
322
333
334//=============================================================================================================
335// FREE FUNCTIONS — QSettings helpers
336//=============================================================================================================
337
345inline bool isTrue(const QVariant& value, bool fallback)
346{
347 return value.isValid() ? value.toBool() : fallback;
348}
349
350} // namespace DISP3DLIB
351
352#endif // VIEWSTATE_H
Library export/import macros and namespace marker for the disp3D library.
#define DISP3DSHARED_EXPORT
Lightweight render-related enums (ShaderMode, VisualizationMode) shared across disp3D.
3-D brain visualisation using the Qt RHI rendering backend.
ShaderMode shaderModeFromName(const QString &name)
QString shaderModeName(ShaderMode mode)
QString visualizationModeName(VisualizationMode mode)
bool multiViewPresetIsPerspective(int preset)
QString multiViewPresetName(int preset)
QRgb mneAnalyzeColor(double v)
QQuaternion multiViewPresetOffset(int preset)
QQuaternion perspectivePresetRotation()
int normalizedVisualizationTarget(int target, int maxIndex)
bool isTrue(const QVariant &value, bool fallback)
Definition viewstate.h:345
VisualizationMode visualizationModeFromName(const QString &name)
Per-view toggle flags controlling which data layers (brain, sensors, sources, network) are visible.
Definition viewstate.h:68
void save(QSettings &settings, const QString &prefix) const
void setObjectVisible(const QString &object, bool visible)
Definition viewstate.cpp:86
bool isObjectVisible(const QString &object) const
Definition viewstate.cpp:33
void load(const QSettings &settings, const QString &prefix)
Viewport subdivision holding its own camera, projection, and scissor rectangle.
Definition viewstate.h:143
QQuaternion perspectiveRotation
Definition viewstate.h:154
void applyOverlayToSurfaces(QMap< QString, std::shared_ptr< BrainSurface > > &surfaces) const
ShaderMode brainShader
Definition viewstate.h:146
void save(QSettings &settings, const QString &prefix) const
static SubView defaultForIndex(int index)
bool matchesSurfaceType(const QString &key) const
bool shouldRenderSurface(const QString &key) const
ShaderMode bemShader
Definition viewstate.h:147
ViewVisibilityProfile visibility
Definition viewstate.h:149
VisualizationMode overlayMode
Definition viewstate.h:148
void load(const QSettings &settings, const QString &prefix, const QQuaternion &fallbackRotation=QQuaternion())
static bool isBrainSurfaceKey(const QString &key)
Renderable cortical surface mesh with per-vertex color, curvature data, and GPU buffer management.