Cortical model#

This module may be employed to read and cortical models.

src_rec.cort_mdl.Cort_mdl(lh_vert, lh_faces, lh_valid_vert, rh_vert, rh_faces, rh_valid_vert, octa_mdl_vert, octa_mdl_faces)#

Container populated with the following items:

lh_vertnumpy.ndarray, shape(lh_vtx_cnt, 3)

White matter surface model vertices (left hemisphere).

lh_facesnumpy.ndarray, shape(lh_face_cnt, 3)

White matter surface model faces (left hemisphere).

lh_valid_vertnumpy.ndarray, shape(lh_vtx_cnt,)

Valid flags for white matter surface model vertices (left hemisphere).

rh_vertnumpy.ndarray, shape(rh_vtx_cnt, 3)

White matter surface model vertices (right hemisphere).

rh_facesnumpy.ndarray, shape(rh_face_cnt, 3)

White matter surface model faces (right hemisphere).

lh_valid_vertnumpy.ndarray, shape(rh_vtx_cnt,)

Valid flags for white matter surface model vertices (right hemisphere).

octa_model_vertnumpy.ndarray, shape(octa_mdl_vtx_cnt, 3)

Octamodel vertices (left hemisphere).

octa_model_facesnumpy.ndarray, shape(octa_mdl_face_cnt, 3)

Octamodel faces (right hemisphere).

src_rec.cort_mdl.get(anatomy_path, subj_name, coreg, bem_reduced_vert)#

Reads and filters cortical freesurfer data.

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) – Name of the subject.

Returns:

cort_mdl – Container populated with the following items:

lh_vertnumpy.ndarray, shape(lh_vtx_cnt, 3)

White matter surface model vertices (left hemisphere).

lh_facesnumpy.ndarray, shape(lh_face_cnt, 3)

White matter surface model faces (left hemisphere).

lh_valid_vertnumpy.ndarray, shape(lh_vtx_cnt,)

Valid flags for white matter surface model vertices (left hemisphere).

rh_vertnumpy.ndarray, shape(rh_vtx_cnt, 3)

White matter surface model vertices (right hemisphere).

rh_facesnumpy.ndarray, shape(rh_face_cnt, 3)

White matter surface model faces (right hemisphere).

lh_valid_vertnumpy.ndarray, shape(rh_vtx_cnt,)

Valid flags for white matter surface model vertices (right hemisphere).

octa_model_vertnumpy.ndarray, shape(octa_mdl_vtx_cnt, 3)

Octamodel vertices (left hemisphere).

octa_model_facesnumpy.ndarray, shape(octa_mdl_face_cnt, 3)

Octamodel faces (right hemisphere).

Return type:

finnpy.src_rec.cort_mdl.Cort_mdl

src_rec.cort_mdl._read(anatomy_path, subj_name, coreg)#

Reads cortical freesurfer data.

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) – Name of the subject.

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

Returns:

  • lh_white_vert (numpy.ndarray, shape(lh_white_vtx_cnt, 3)) – White matter surface model vertices (left hemisphere).

  • lh_white_faces (numpy.ndarray, shape(lh_white_face_cnt, 3)) – White matter surface model faces (left hemisphere).

  • rh_white_vert (numpy.ndarray, shape(rh_white_vtx_cnt, 3)) – White matter surface model vertices (right hemisphere).

  • rh_white_faces (numpy.ndarray, shape(rh_white_face_cnt, 3)) – White matter surface model faces (right hemisphere).

  • lh_sphere_vert (numpy.ndarray, shape(lh_sphere_vtx_cnt, 3)) – Spherical freesurfer head model vertices (left hemisphere).

  • rh_sphere_vert (numpy.ndarray, shape(rh_sphere_vtx_cnt, 3)) – Spherical freesurfer head model vertices (right hemisphere).

src_rec.cort_mdl._create_source_mesh_model()#

Creates a source mesh model by warping an octahedron towards the surface sphere created by freesurfer.

Returns:

  • octa_model_vert (numpy.ndarray, shape(octa_vtx_cnt, 3)) – Vertices of the spherical model (octahedron).

  • octa_model_faces (numpy.ndarray, shape(octa_face_cnt, 3)) – Faces of the spherical model (octahedron).

src_rec.cort_mdl._match_source_mesh_model(lh_sphere_vert, rh_sphere_vert, octa_model_vert)#

Creates a source mesh model by warping an octahedron towards the surface sphere created by freesurfer.

Parameters:
  • lh_sphere_vert (numpy.ndarray, shape(lh_sphere_vtx_cnt, 3)) – Spherical freesurfer head model vertices (left hemisphere).

  • rh_sphere_vert (numpy.ndarray, shape(rh_sphere_vtx_cnt, 3)) – Spherical freesurfer head model vertices (right hemisphere).

  • octa_model_vert (numpy.ndarray, shape(octa_vtx_cnt, 3)) – Vertices of the spherical model (octahedron).

Returns:

  • lh_valid_vert (numpy.ndarray, shape(lh_white_vtx_cnt,)) – Vertices with a match in the spherical model (left hemisphere).

  • rh_valid_vert (numpy.ndarray, shape(rh_white_vtx_cnt,)) – Vertices with a match in the spherical model (right hemisphere).

src_rec.cort_mdl._rm_out_of_in_skull_vert(reduced_in_skull_vert, lh_white_vert_mri, lh_valid_vert, rh_white_vert_mri, rh_valid_vert)#
src_rec.cort_mdl._update_invalid_vertices(approx_surface, white_vert, valid_vert)#

Updates invalid vertices

Parameters:
  • approx_surface (scipy.spatial._qhull.Delaunay) – Approximate in/out skull/skin surface.

  • white_vert (numpy.ndarray, shape(white_vtx_cnt, 3)) – White matter surface vertices.

  • valid_vert (numpy.ndarray, shape(white_vtx_cnt, 3)) – Binary list of valid vertices.

Returns:

trans_white_vert – Transformed vertices.

Return type:

numpy.ndarray, shape(white_vtx_cnt, 3)