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

ViewState implementations — per-view data structures and helpers. More...

#include "viewstate.h"
#include "renderable/brainsurface.h"
#include "view/brainrenderer.h"
#include <QSettings>
#include <cmath>
#include <limits>
Include dependency graph for viewstate.cpp:

Go to the source code of this file.

Functions

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

Detailed Description

ViewState implementations — per-view data structures and helpers.

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

LICENSE

Copyright (C) 2026, Christoph Dinh. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of MNE-CPP authors nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file viewstate.cpp.

Function Documentation

◆ mneAnalyzeColor()

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 361 of file viewstate.cpp.

◆ multiViewPresetIsPerspective()

bool multiViewPresetIsPerspective ( int preset)

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

Definition at line 284 of file viewstate.cpp.

◆ multiViewPresetName()

QString multiViewPresetName ( int preset)

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

Definition at line 238 of file viewstate.cpp.

◆ multiViewPresetOffset()

QQuaternion multiViewPresetOffset ( int preset)

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

Definition at line 254 of file viewstate.cpp.

◆ normalizedVisualizationTarget()

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 314 of file viewstate.cpp.

◆ perspectivePresetRotation()

QQuaternion perspectivePresetRotation ( )

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

Definition at line 231 of file viewstate.cpp.

◆ shaderModeFromName()

ShaderMode shaderModeFromName ( const QString & name)

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

Definition at line 321 of file viewstate.cpp.

◆ shaderModeName()

QString shaderModeName ( ShaderMode mode)

Convert a ShaderMode enum to display string.

Definition at line 330 of file viewstate.cpp.

◆ visualizationModeFromName()

VisualizationMode visualizationModeFromName ( const QString & name)

Convert a visualization mode name to enum.

Definition at line 339 of file viewstate.cpp.

◆ visualizationModeName()

QString visualizationModeName ( VisualizationMode mode)

Convert a VisualizationMode enum to display string.

Definition at line 349 of file viewstate.cpp.