v2.0.0
Loading...
Searching...
No Matches
viewstate.h
Go to the documentation of this file.
1//=============================================================================================================
34
35#ifndef VIEWSTATE_H
36#define VIEWSTATE_H
37
38//=============================================================================================================
39// INCLUDES
40//=============================================================================================================
41
43
44#include "rendertypes.h"
45
46#include <QString>
47#include <QMap>
48#include <QQuaternion>
49#include <QVector2D>
50#include <QVariant>
51#include <QColor>
52
53#include <algorithm>
54#include <memory>
55
56//=============================================================================================================
57// FORWARD DECLARATIONS
58//=============================================================================================================
59
60class QSettings;
61class BrainSurface;
62
63//=============================================================================================================
74{
75 bool lh = true;
76 bool rh = true;
77 bool bemHead = true;
78 bool bemOuterSkull = true;
79 bool bemInnerSkull = true;
80 bool sensMeg = false;
81 bool sensMegGrad = false;
82 bool sensMegMag = false;
83 bool sensMegHelmet = false;
84 bool sensEeg = false;
85 bool dig = false;
86 bool digCardinal = false;
87 bool digHpi = false;
88 bool digEeg = false;
89 bool digExtra = false;
90 bool megFieldMap = false;
91 bool eegFieldMap = false;
92 bool megFieldContours = false;
93 bool eegFieldContours = false;
94 bool dipoles = true;
95 bool sourceSpace = false;
96 bool network = false;
97 bool megFieldMapOnHead = false;
98
99 //=========================================================================================================
106 bool isObjectVisible(const QString &object) const;
107
108 //=========================================================================================================
115 void setObjectVisible(const QString &object, bool visible);
116
117 //=========================================================================================================
124 void load(const QSettings &settings, const QString &prefix);
125
126 //=========================================================================================================
133 void save(QSettings &settings, const QString &prefix) const;
134};
135
136//=============================================================================================================
148{
149 // ── Per-view render configuration ──────────────────────────────────
150 QString surfaceType = "pial";
155
156 // ── Per-view camera state ─────────────────────────────────────────
157 float zoom = 0.0f;
158 QVector2D pan;
160 int preset = 1; // 0=Top,1=Perspective,...,6=Right
161 bool enabled = true;
162
163 // ── Surface classification helpers ─────────────────────────────────
164
169 static bool isBrainSurfaceKey(const QString &key);
170
175 bool matchesSurfaceType(const QString &key) const;
176
181 bool shouldRenderSurface(const QString &key) const;
182
188 QMap<QString, std::shared_ptr<BrainSurface>> &surfaces) const;
189
190 // ── Serialisation ──────────────────────────────────────────────────
191
199 void load(const QSettings &settings, const QString &prefix,
200 const QQuaternion &fallbackRotation = QQuaternion());
201
208 void save(QSettings &settings, const QString &prefix) const;
209
210 // ── Factory ─────────────────────────────────────────────────────────
211
219 static SubView defaultForIndex(int index);
220};
221
222//=============================================================================================================
223// FREE FUNCTIONS — camera presets
224//=============================================================================================================
225
230
235
239DISP3DRHISHARED_EXPORT QQuaternion multiViewPresetOffset(int preset);
240
246
247//=============================================================================================================
248// FREE FUNCTIONS — enum ↔ string conversion
249//=============================================================================================================
250
258DISP3DRHISHARED_EXPORT int normalizedVisualizationTarget(int target, int maxIndex = 3);
259
262
265
268
271
272//=============================================================================================================
273// FREE FUNCTIONS — colormap
274//=============================================================================================================
275
286
287//=============================================================================================================
288// FREE FUNCTIONS — QSettings helpers
289//=============================================================================================================
290
294inline bool isTrue(const QVariant &value, bool fallback)
295{
296 return value.isValid() ? value.toBool() : fallback;
297}
298
299#endif // VIEWSTATE_H
disp3D_rhi library export/import macros.
#define DISP3DRHISHARED_EXPORT
QQuaternion multiViewPresetOffset(int preset)
QString shaderModeName(ShaderMode mode)
VisualizationMode visualizationModeFromName(const QString &name)
QString visualizationModeName(VisualizationMode mode)
bool multiViewPresetIsPerspective(int preset)
int normalizedVisualizationTarget(int target, int maxIndex=3)
bool isTrue(const QVariant &value, bool fallback)
Definition viewstate.h:294
QRgb mneAnalyzeColor(double v)
ShaderMode shaderModeFromName(const QString &name)
QQuaternion perspectivePresetRotation()
QString multiViewPresetName(int preset)
Lightweight render-related enums shared across the disp3D_rhi library.
ShaderMode
Definition rendertypes.h:73
@ Standard
Definition rendertypes.h:74
VisualizationMode
Definition rendertypes.h:90
@ ModeSurface
Definition rendertypes.h:91
Per-view toggle flags controlling which data layers (brain, sensors, sources, network) are visible.
Definition viewstate.h:74
void save(QSettings &settings, const QString &prefix) const
void load(const QSettings &settings, const QString &prefix)
void setObjectVisible(const QString &object, bool visible)
Definition viewstate.cpp:81
bool isObjectVisible(const QString &object) const
Definition viewstate.cpp:52
Viewport subdivision holding its own camera, projection, and scissor rectangle.
Definition viewstate.h:148
bool enabled
Definition viewstate.h:161
void save(QSettings &settings, const QString &prefix) const
void applyOverlayToSurfaces(QMap< QString, std::shared_ptr< BrainSurface > > &surfaces) const
bool matchesSurfaceType(const QString &key) const
ViewVisibilityProfile visibility
Definition viewstate.h:154
static bool isBrainSurfaceKey(const QString &key)
ShaderMode bemShader
Definition viewstate.h:152
QVector2D pan
Definition viewstate.h:158
bool shouldRenderSurface(const QString &key) const
QQuaternion perspectiveRotation
Definition viewstate.h:159
QString surfaceType
Definition viewstate.h:150
VisualizationMode overlayMode
Definition viewstate.h:153
static SubView defaultForIndex(int index)
ShaderMode brainShader
Definition viewstate.h:151
int preset
Definition viewstate.h:160
float zoom
Definition viewstate.h:157
void load(const QSettings &settings, const QString &prefix, const QQuaternion &fallbackRotation=QQuaternion())
Renderable cortical surface mesh with per-vertex color, curvature data, and GPU buffer management.