v2.0.0
Loading...
Searching...
No Matches
viewstate.h File Reference

Per-viewport state (camera preset, zoom, pan, visibility filter) and serialisation helpers. More...

#include "../disp3D_global.h"
#include "rendertypes.h"
#include <QString>
#include <QMap>
#include <QQuaternion>
#include <QVector2D>
#include <QVariant>
#include <QColor>
#include <algorithm>
#include <memory>
Include dependency graph for viewstate.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ViewVisibilityProfile
 Per-view toggle flags controlling which data layers (brain, sensors, sources, network) are visible. More...
struct  SubView
 Viewport subdivision holding its own camera, projection, and scissor rectangle. More...

Functions

DISP3DSHARED_EXPORT QQuaternion perspectivePresetRotation ()
DISP3DSHARED_EXPORT QString multiViewPresetName (int preset)
DISP3DSHARED_EXPORT QQuaternion multiViewPresetOffset (int preset)
DISP3DSHARED_EXPORT bool multiViewPresetIsPerspective (int preset)
DISP3DSHARED_EXPORT int normalizedVisualizationTarget (int target, int maxIndex=3)
DISP3DSHARED_EXPORT ShaderMode shaderModeFromName (const QString &name)
DISP3DSHARED_EXPORT QString shaderModeName (ShaderMode mode)
DISP3DSHARED_EXPORT VisualizationMode visualizationModeFromName (const QString &name)
DISP3DSHARED_EXPORT QString visualizationModeName (VisualizationMode mode)
DISP3DSHARED_EXPORT QRgb mneAnalyzeColor (double v)
bool isTrue (const QVariant &value, bool fallback)

Detailed Description

Per-viewport state (camera preset, zoom, pan, visibility filter) and serialisation helpers.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2026 MNE-CPP Authors

Author
Christoph Dinh chris.nosp@m.toph.nosp@m..dinh.nosp@m.@mne.nosp@m.-cpp..nosp@m.org
Since
2.0.0
Date
March 2026

A disp3D scene can be displayed either in a single interactive viewport or in a 2x2 multi-view grid. SubView holds the per-pane camera state — preset (Top / Left / Front / Perspective), zoom, pan offset and rotation quaternion — and ViewVisibilityProfile holds the per-pane visibility mask (hide skin in the cortex view, hide dipoles in the sensor view, ...).

Both structs are POD-like and round-trip through QSettings so the user's last camera and per-pane filter are restored when the host application is relaunched.

Definition in file viewstate.h.

Function Documentation

◆ isTrue()

bool isTrue ( const QVariant & value,
bool fallback )
inline

Read a boolean from QSettings with a default fallback.

Definition at line 291 of file viewstate.h.

◆ mneAnalyzeColor()

DISP3DSHARED_EXPORT QRgb mneAnalyzeColor ( double v)

MNE analyze colormap: teal → blue → gray → red → yellow.

Port of mne_analyze_colormap(format='vtk') from MNE-Python. Input v is normalised to [0,1] where 0.5 corresponds to zero field.

Parameters
[in]vNormalised value in [0,1].
Returns
Packed QRgb colour.

Definition at line 349 of file viewstate.cpp.

◆ multiViewPresetIsPerspective()

DISP3DSHARED_EXPORT bool multiViewPresetIsPerspective ( int preset)

Whether a preset is a perspective (free-rotate) camera rather than an orthographic-style fixed camera.

Definition at line 271 of file viewstate.cpp.

◆ multiViewPresetName()

DISP3DSHARED_EXPORT QString multiViewPresetName ( int preset)

Human-readable name for a multi-view preset index (0–6).

Definition at line 225 of file viewstate.cpp.

◆ multiViewPresetOffset()

DISP3DSHARED_EXPORT QQuaternion multiViewPresetOffset ( int preset)

Camera rotation quaternion for a multi-view preset index (0–6).

Definition at line 241 of file viewstate.cpp.

◆ normalizedVisualizationTarget()

DISP3DSHARED_EXPORT int normalizedVisualizationTarget ( int target,
int maxIndex = 3 )

Clamp a visualization target index to [-1, maxIndex].

Parameters
[in]targetRaw target index (-1 = single view, 0+ = multi pane).
[in]maxIndexUpper bound (inclusive). Defaults to 3 for backwards compatibility, but callers should pass viewportCount-1.

Definition at line 301 of file viewstate.cpp.

◆ perspectivePresetRotation()

DISP3DSHARED_EXPORT QQuaternion perspectivePresetRotation ( )

Default perspective rotation quaternion used for the "Perspective" camera.

Definition at line 218 of file viewstate.cpp.

◆ shaderModeFromName()

DISP3DSHARED_EXPORT ShaderMode shaderModeFromName ( const QString & name)

Convert a shader name ("Standard", "Holographic", "Anatomical") to enum.

Definition at line 308 of file viewstate.cpp.

◆ shaderModeName()

DISP3DSHARED_EXPORT QString shaderModeName ( ShaderMode mode)

Convert a ShaderMode enum to display string.

Definition at line 318 of file viewstate.cpp.

◆ visualizationModeFromName()

DISP3DSHARED_EXPORT VisualizationMode visualizationModeFromName ( const QString & name)

Convert a visualization mode name to enum.

Definition at line 327 of file viewstate.cpp.

◆ visualizationModeName()

DISP3DSHARED_EXPORT QString visualizationModeName ( VisualizationMode mode)

Convert a VisualizationMode enum to display string.

Definition at line 337 of file viewstate.cpp.