Skull and skin models#

This module may be employed to calculate a (source space) mesh model.

src_rec.skull_skin_mdls.Skull_skin_mdls(in_skull_vert, in_skull_faces, out_skull_vert=None, out_skull_faces=None, out_skin_vect=None, out_skin_faces=None)#

Container class populated with the following elements:

in_skull_vertnumpy.ndarray, shape(in_skull_vtx_cnt, 3)

Vertices of the inner skull model.

in_skull_facesnumpy.ndarray, shape(in_skull_face_cnt, 3)

Faces of the inner skull model.

out_skull_vertnumpy.ndarray, shape(out_skull_vtx_cnt, 3) - optional

Vertices of the outer skull model.

out_skull_facesnumpy.ndarray, shape(out_skull_face_cnt, 3) - optional

Faces of the outer skull model.

out_skin_vectnumpy.ndarray, shape(out_skin_vtx_cnt, 3) - optional

Vertices of the skin model.

out_skin_facesnumpy.ndarray, shape(out_skull_face_cnt, 3) - optional

Faces of the skin model.

src_rec.skull_skin_mdls.read(anatomy_path, subj_name, mode, coreg=None)#

Reads skull and skin models extracted via freesurfer’s watershed algorithm.

Parameters:
  • 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.

  • mode (string) – Mode is either ‘EEG’, ‘MEG’, ‘MEEG’ or ‘full. ‘MEG’ populates only in_skull_vert and in_skull_faces. The other modes also poulated outer skull and outer skin models.

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

Returns:

skull_skin_mdl – Container class.

Return type:

finnpy.src_rec.bem_mdl.Skull_skin_mdl

src_rec.skull_skin_mdls.plot(skull_skin_mdl, anatomy_path, subj_name, block=True)#

Plot skull and skin models for visual confirmation of proper alignment.

Parameters:
  • in_skull_vert (numpy.ndarray, shape(in_skull_vtx_cnt, 3)) – Vertices of the inner skull model.

  • in_skull_faces (numpy.ndarray, shape(in_skull_face_cnt, 3)) – Faces of the inner skull model.

  • out_skull_vert (numpy.ndarray, shape(out_skull_vtx_cnt, 3)) – Vertices of the outer skull model.

  • out_skull_faces (numpy.ndarray, shape(out_skull_face_cnt, 3)) – Faces of the outer skull model.

  • out_skin_vect (numpy.ndarray, shape(out_skin_vtx_cnt, 3)) – Vertices of the skin model.

  • out_skin_faces (numpy.ndarray, shape(out_skull_face_cnt, 3)) – Faces of the skin model.

  • 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.

src_rec.skull_skin_mdls._load_and_orient_t1(subject_path)#

Loads and orients an MRI scan.

Parameters:

subject_path (string) – Path to the subject’s T1 scan.

Returns:

  • t1_image_trans.get_fdata() (numpy.ndarray, shape(a, b, c)) – Reoriented T1 scan.

  • ras_to_mri (numpy.ndarray, shape(a, b, c)) – RAS (right, anterior, superior) to MRI transformation.

src_rec.skull_skin_mdls._plot_subplots(data, axes, surfaces)#

Adds splices from the MRI scan onto the plot.

Parameters:
  • data (numpy.ndarray, shape(a, b, c)) – RAS oriented data.

  • axes (list of matplotlib.axes) – Axes for plotting.

  • surfaces (list of surfaces, ("Name", "Color", vertices, faces)) – List of surfices to draw.