MNEBem
Namespace: MNELIB · Library: MNE Library
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.
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 &
MNEBEM.
operator=(p_MNEBem)
Copy assignment.
Parameters:
Returns:
- MNEBem & — This BEM.
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
MNEBem 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:
- const MNEBemSurface & —
MNEBemSurfacerelated to the parameter index.
operator[](idx)
Subscript operator [] to access bem_surface by index.
Parameters:
- idx : qint32 the surface index (0,1 or 2).
Returns:
- MNEBemSurface & —
MNEBemSurfacerelated to the parameter index.
operator<<(surf)
Subscript operator << to add a new bem_surface.
Parameters:
- surf : const MNEBemSurface & BemSurface to be added.
Returns:
operator<<(surf)
Subscript operator << to add a new bem_surface.
Parameters:
- surf : *const MNEBemSurface ** BemSurface to be added.
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:
- trans : const FiffCoordTrans & The Transformation Matrix.
invtransform(trans)
Transform the Bem using the inverse.
Parameters:
- trans : const FiffCoordTrans & The Transformation Matrix.
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
- Full source:
src/examples/ex_mne_api/main.cpp - Build target:
ex_mne_api(runs under CTest) - Data: mne-cpp-test-data
Used in examples
ex_mne_api
MNE library: BEM surfaces, surface projection, ICP, source spaces and epochs.
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.
// 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.
//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
- Jana Kiesel <jana.kiesel@tu-ilmenau.de>
- Lorenz Esch <lorenz.esch@tu-ilmenau.de>
- Christoph Dinh <christoph.dinh@mne-cpp.org>
- Gabriel Motta <gabrielbenmotta@gmail.com>
- Ruben Doerfel <doerfelruben@aol.com>
- Juan GPC <jgarciaprieto@mgh.harvard.edu>