Skip to main content

MNEMshDisplaySurfaceSet

Namespace: MNELIB  ·  Library: MNE Library

#include <mne/mne_msh_display_surface_set.h>

class MNELIB::MNEMshDisplaySurfaceSet

Replaces *mshDisplaySurfaceSet, mshDisplaySurfaceSetRec struct (analyze_types.c).

Note that another implementation can be found in movie_types.h

The MNE Msh Display FsSurface Set class holds information about a set of surfaces to be rendered.

src/examples/ex_mne_api/main.cpp
// Total solid angle seen from a point: 4 pi inside a closed surface, 0 outside
auto skull = MNESurface::read_bem_surface2(bemFile.fileName(), FIFFV_BEM_SURF_ID_BRAIN, true);
skull->compute_surface_cm();
const double inside = skull->sum_solids(Map<const Vector3f>(skull->cm)) / (4.0 * M_PI);
const double outside = skull->sum_solids(Vector3f(0.0f, 0.0f, 0.2f)) / (4.0 * M_PI);

// The same surface as an MNE-C viewer display surface
MNEMshDisplaySurfaceSet display;
display.add_bem_surface(bemFile.fileName(), FIFFV_BEM_SURF_ID_BRAIN, "inner skull", 1, 1); // checks closure
const MNEMshDisplaySurface& shown = *display.surfs[0];

Public Methods​

MNEMshDisplaySurfaceSet(nsurf)​

Constructs the MNEMshDisplaySurfaceSet.

Parameters:

  • nsurf : int Number of surface slots to allocate (all initially inactive and drawable).

~MNEMshDisplaySurfaceSet()​

Destroys the MNEMshDisplaySurfaceSet.


add_bem_surface(filepath, kind, bemname, full_geom, check)​

Read a BEM surface from a FIFF file, optionally validate that it is topologically closed (via solid-angle check), and add it to this set.

Parameters:

  • filepath : const QString & Path to the BEM FIFF file.

  • kind : int BEM surface kind constant.

  • bemname : const QString & Display name for the surface.

  • full_geom : int If non-zero, compute full geometry information.

  • check : int If non-zero, verify the surface is closed.

Returns:

  • int — OK on success, FAIL on error.

add_replace_surface(newSurf, replace, isDrawable)​

Add a new surface to the set, or replace an existing surface with the same ID if replace is true.

Parameters:

  • newSurf : std::unique_ptr< MNEMshDisplaySurface > The surface to add or use as replacement.

  • replace : bool If true, replace an existing surface with matching ID.

  • isDrawable : bool Whether the surface should be marked as drawable.


apply_left_right_eyes()​

Assign hemisphere-appropriate eye positions and up-vectors to each surface (left eye for left hemisphere, right eye for right).


apply_left_eyes()​

Apply the left-eye position and up-vector uniformly to all surfaces regardless of hemisphere.


setup_current_lights()​

Initialize the custom light set (if needed) and apply it as the active lighting configuration.


setup_lights(set)​

Replace the current active lighting with a deep copy of the provided light set.

Parameters:


Static Methods​

load(subject_id, surf, subjects_dir)​

Load left and right hemisphere FreeSurfer surfaces (with curvature) from the subjects directory, configuring eye positions and lighting.

Parameters:

  • subject_id : const QString & Subject name.

  • surf : const QString & FsSurface type name (e.g. "inflated", "white").

  • subjects_dir : const QString & Path to the FreeSurfer subjects directory.

Returns:

  • std::unique_ptr< MNEMshDisplaySurfaceSet > — A new display surface set, or NULL on failure. Caller takes ownership.

initialize_custom_lights()​

Create a default set of 8 directional lights if custom lights have not been initialized yet.


dup_light_set(s)​

Deep-copy a light set including all individual light entries.

Parameters:

Returns:

  • std::unique_ptr< MNEMshLightSet > — A new deep copy. Caller takes ownership.

Example​

Used in examples​

ex_mne_api​

MNE library: BEM surfaces, surface projection, ICP, source spaces and epochs.

src/examples/ex_mne_api/main.cpp, line 469
// The same surface as an MNE-C viewer display surface
MNEMshDisplaySurfaceSet display;
display.add_bem_surface(bemFile.fileName(), FIFFV_BEM_SURF_ID_BRAIN, "inner skull", 1, 1); // checks closure
const MNEMshDisplaySurface& shown = *display.surfs[0];
// mne.surface._get_solids (which returns the solid angle / 2): 0.5 at the centroid, 0 at (0, 0, 200) mm;
// bounding box -66.7 ... 105.8 mm, centroid (0.67, -10.01, 44.26) mm
ok &= expect(near(inside, 1.0, 1e-6) && std::fabs(outside) < 1e-6 && (Map<const Vector3f>(skull->cm) - Vector3f(0.00067339f, -0.01001356f, 0.04426273f)).norm() < 1e-6f,
"MNESurface: solid angles show the inner skull is closed, like mne._get_solids");
ok &= expect(display.nsurf == 1 && shown.np == 2562 && shown.surf_name == "inner skull" && near(shown.fov, 0.10576099902391434, 1e-6) && (shown.minv - Vector3f(-0.0667366f, -0.0880172f, -0.0445037f)).norm() < 1e-6f,
"MNEMshDisplaySurfaceSet/MNEMshDisplaySurface: the BEM surface and its extent in the viewer");

Authors of this file​