Skip to main content

MNEBem

Namespace: MNELIB  ·  Library: MNE Library

Python equivalent

mne.make_bem_model in MNE-Python.

#include <mne/mne_bem.h>

class MNELIB::MNEBem

Boundary element model: aggregates the inner-skull, outer-skull and scalp MNEBemSurface objects of a head conductor model.

Aggregated boundary element model loaded from a -bem.fif file.

src/examples/ex_mne_api/main.cpp
QFile bemFile(data + "/subjects/sample/bem/sample-5120-bem.fif");
MNEBem bem(bemFile); // one MNEBemSurface per BEM layer
const MNEBemSurface& innerSkull = bem[0];

Public Methods​

MNEBem()​

Default constructor.


MNEBem(p_MNEBem)​

Copy constructor.

Parameters:

  • p_MNEBem : const MNEBem & MNE BEM.

operator=(p_MNEBem)​

Copy assignment.

Parameters:

Returns:


MNEBem(p_IODevice)​

Default constructor.

Parameters:

  • p_IODevice : QIODevice & IO device (e.g. a FIFF file) to read the BEM surfaces from; throws std::runtime_error on failure.

~MNEBem()​

Destroys the MNE Bem.


clear()​

Initializes MNE Bem.


isEmpty()​

True if MNE Bem is empty.

Returns:

  • bool — true if MNE Bem is empty.

size()​

Returns the number of stored bem surfaces.

Returns:

  • qint32 — number of stored bem surfaces.

write(p_IODevice)​

MNE Toolbox function mne_write_bem_surfaces_block.

Write the Bem to a FIF file

Parameters:

  • p_IODevice : QIODevice & IO device to write the bem to.

Returns:

  • bool — false if the device cannot be opened for writing.

writeToStream(p_pStream)​

MNE Toolbox function mne_write_bem_surfaces_block.

Write the Bem to a FIF stream

Parameters:

  • p_pStream : *FiffStream ** The stream to write to.

operator[](idx)​

Subscript operator [] to access bem_surface by index.

Parameters:

  • idx : qint32 the surface index (0,1 or 2).

Returns:


operator[](idx)​

Subscript operator [] to access bem_surface by index.

Parameters:

  • idx : qint32 the surface index (0,1 or 2).

Returns:


operator<<(surf)​

Subscript operator << to add a new bem_surface.

Parameters:

Returns:


operator<<(surf)​

Subscript operator << to add a new bem_surface.

Parameters:

Returns:


warp(sLm, dLm)​

Warp the Bem.

Parameters:

  • sLm : const Eigen::MatrixXf & 3D Landmarks of the source geometry.

  • dLm : const Eigen::MatrixXf & 3D Landmarks of the destination geometry.


transform(trans)​

Transform the Bem.

Parameters:


invtransform(trans)​

Transform the Bem using the inverse.

Parameters:


Static Methods​

readFromStream(p_pStream, add_geom, p_Bem)​

Parameters:

  • p_pStream : FIFFLIB::FiffStream::SPtr & The opened fif file.

  • add_geom : bool Add geometry information to the Bem FsSurface.

  • p_Bem : MNEBem & The BEM that receives the surfaces read.

Returns:

  • bool — true if succeeded, false otherwise.

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 146
QFile bemFile(data + "/subjects/sample/bem/sample-5120-bem.fif");
MNEBem bem(bemFile); // one MNEBemSurface per BEM layer
const MNEBemSurface& innerSkull = bem[0];
// mne.read_bem_surfaces: 1 surface, id 1 (inner skull), 2562 vertices, 5120 triangles
ok &= expect(bem.size() == 1 && innerSkull.id == FIFFV_BEM_SURF_ID_BRAIN && innerSkull.np == 2562 && innerSkull.ntri == 5120 && (innerSkull.rr.row(0) - RowVector3f(0.0006128f, -0.007984f, 0.103732f)).norm() < 1e-6f && (innerSkull.nn.row(0) - RowVector3f(0.05623665f, -0.1050898f, 0.99287134f)).norm() < 1e-5f && MNEBemSurface::id_name(innerSkull.id) == "Brain",
"MNEBem/MNEBemSurface: inner skull with 2562 vertices and normals like mne.read_bem_surfaces");

ex_read_bem​

Example of reading BEM data.

src/examples/ex_read_bem/main.cpp, line 76
// Read the BEM
QFile t_fileBem(parser.value(bemFileInOption));
MNEBem t_Bem(t_fileBem);

ex_disp_3D​

Example of using the MNE-CPP Disp3D library.

src/examples/ex_disp_3D/main.cpp, line 254
//Read and show BEM
QFile t_fileBem(QCoreApplication::applicationDirPath() + "/../resources/data/MNE-sample-data/subjects/sample/bem/sample-5120-5120-5120-bem.fif");
MNEBem t_Bem(t_fileBem);
for (int i = 0; i < t_Bem.size(); ++i) {
pModel->addBemSurface(parser.value(subjectOption), "BEM", t_Bem[i]);
}

Also used in ex_interpolation.

Authors of this file​