Boundary element model (BEM)#

This module may be employed to calculate the boundary element model for EEG/MEG source reconstruction.

src_rec.bem_mdl.BEM_mdl(vert, faces, faces_normal, faces_area, solution)#

Container class.

Create a container with BEM model elements for convenience.

Parameters:
  • vert (list of numpy.ndarray, shape(scaled_vtx_cnt, 3)) – Remaining vertices of a skin/skull model vertices.

  • faces (list of numpy.ndarray, shape(scaled_face_cnt, 3)) – Remaining faces of a skin/skull model faces.

  • faces_normal (numpy.ndarray, shape(scaled_face_cnt, 3)) – Normals of the individual remaining inner skull faces.

  • faces_area (numpy.ndarray, shape(scaled_face_cnt)) – Surface area of the remaining faces.

  • solution (numpy.ndarray, shape(scaled_vtx_cnt, scaled_vtx_cnt)) – BEM solution (preliminary step for the calculation of the forward model).

src_rec.bem_mdl.INNER_SKULL_IDX#

Index of the inner skull.

Type:

int

src_rec.bem_mdl.OUTER_SKULL_IDX#

Index of the outer skull.

Type:

int

src_rec.bem_mdl.OUTER_SKIN_IDX#

Index of the skin.

Type:

int

src_rec.bem_mdl.run(fs_path, anatomy_path, subj_name, signal_type, coreg, conductivity=None, tgt_icosahedron_level=4)#

Calcuates the BEM linear basis coefficients using the linear collocation method.

Parameters:
  • fs_path (string) – Path to the freesurfer directory.

  • anatomy_path (string) – Path to the anatomy folder. This folder should contain a sub-folder for each subject, to be pupulated with the corresponding structural data.

  • subj_name (string) – Subject name.

  • signal_type (string) – Mode is either “EEG” or “MEG”.

  • coreg (finnpy.src_rec.coreg.Coreg) – Container with different transformation matrices

  • conductivity ((float,) or (float, float, float)) – Conductivity values for a one layer (MEG) or three layer (EEG) model.

  • tgt_icosahedron_level (int) – Order of the icosahedron employed herein, defaults to 4.

Returns:

bem_mdl – Container class, populed with the following items:

vertlist() of numpy.ndarray, [shape(scaled_vtx_cnt, 3), …]

Remaining vertices of a skin/skull model vertices.

faceslist() of numpy.ndarray, [shape(scaled_face_cnt, 3), …]

Remaining faces of a skin/skull model faces.

faces_normalnumpy.ndarray, shape(scaled_face_cnt, 3)

Normals of the individual remaining inner skull faces.

faces_areanumpy.ndarray, shape(scaled_face_cnt)

Surface area of the remaining faces.

bem_solutionnumpy.ndarray, shape(scaled_vtx_cnt, scaled_vtx_cnt)

BEM solution (preliminary step for the calculation of the forward model).

Return type:

finnpy.src_rec.bem_mdl.BEM_mdl

Raises:

AssertionError – Raised if the number of vertices in the three layer model vary.