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, populed with the following items:
- vertnumpy.ndarray, shape(scaled_vtx_cnt, 3)
Remaining Vertices of a skin/skull model vertices.
- facesnumpy.ndarray, shape(scaled_face_cnt, 3)
Remaining Vertices 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).
- src_rec.bem_mdl.run(fs_path, vert, faces, tgt_icosahedron_level=4)#
Calcuates the BEM linear basis coefficients using the linear collocation method.
- Parameters:
fs_path (string) – Path to the freesurfer directory.
vert (numpy.ndarray, shape(vtx_cnt, 3)) – Vertices of a skin/skull model.
faces (numpy.ndarray, shape(face_cnt, 3)) – Faces of a skin/skull model.
tgt_icosahedron_level (int) – Order of the icosahedron employed herein, defaults to 4.
- Returns:
bem_mdl – Container class, populed with the following items:
- vertnumpy.ndarray, shape(scaled_vtx_cnt, 3)
Remaining Vertices of a skin/skull model vertices.
- facesnumpy.ndarray, shape(scaled_face_cnt, 3)
Remaining Vertices 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
- src_rec.bem_mdl._find_non_diag_omega(vert, faces, double_faces_area, faces_normal)#
Calculates the non-diagonal elements of omega (linear basis factors), see function calc_bem_model.
- Parameters:
vert (numpy.ndarray, shape(reduced_vtx_cnt, 3)) – Vertices used for linear basis function calculation.
faces (numpy.ndarray, shape(face_cnt, 3)) – Vertices used for linear basis function calculation.
double_faces_area (numpy.ndarray, shape(face_cnt)) – Surface area of the remaining skin/skull model faces.
faces_normal (numpy.ndarray, shape(face_cnt, 3)) – Normals of the individual remaining skin/skull model faces.
- Returns:
omega – Linear basis factor elements of the BEM solution, precurser to the BEM solution proper. Warning, diagonal elements are invalid!
- Return type:
numpy.ndarray, shape(reduced_vtx_cnt, reduced_vtx_cnt)
- src_rec.bem_mdl._find_diag_omega(omega, faces)#
Calculates the diagonal elements of omega as these cannot be calculated as the non-diagonal ones due to the auto solid angle problem.
See “Error Analysis of a New Galerkin Method to Solve the Forward Problem in MEG and EEG Using the Boundary Element Method” by Satu Tissari, Jussi Rahola for reference. See function calc_bem_model for a more general description.
- Parameters:
omega (numpy.ndarray, shape(reduced_vtx_cnt, reduced_vtx_cnt)) – Linear basis factor elements of the BEM solution, precurser to the BEM solution proper. Warning, diagonal elements are currently invalid!
faces (numpy.ndarray, shape(face_cnt, 3)) – Remaining skin/skull model faces.
- Returns:
omega – Linear basis factor elements of the BEM solution with proper diagonal elements.
- Return type:
numpy.ndarray, shape(reduced_vtx_cnt, reduced_vtx_cnt)