Source space region clustering#

This module may be employed to cluster source areas into distinct regions.

src_rec.avg_src_reg.run(src_data, subj_to_fsavg_mdl, fs_path)#

Averages source space regions to areas defined by the Desikan-Killiany atlas.

Parameters:
  • src_data (numpy.ndarray, shape(sensor_ch_cnt, samp_cnt)) – Source space data.

  • subj_to_fsavg_mdl (finnpy.src_rec.subj_to_fsavg.Subj_to_fsavg_mdl) –

    Container class, populated with the following items:

    transnumpy.ndarray, shape(valid_subj_vtx_cnt, valid_subj_vtx_cnt)

    Transformation matrix

    lh_valid_vertnumpy.ndarray, shape(fs_avg_vtx_cnt,)

    Valid/supporting vertices for left hemisphere.

    rh_valid_vertnumpy.ndarray, shape(fs_avg_vtx_cnt,)

    Valid/supporting vertices for right hemisphere.

  • fs_path (string) – Path to the freesurfer folder. Should contain the ‘bin’ folder, your license.txt, and sources.sh.

Returns:

  • morphed_epoch_data (numpy.ndarray, shape(src_region_cnt, epoch_cnt, samples)) – Average source space data.

  • morphed_epoch_channels (list of lists, len(source_ch_cnt,)) – List of channel ids, clustered by source space region. Identifies which channel supports which region.

  • morphed_region_names (list, len(source_ch_cnt,)) – Region names.

src_rec.avg_src_reg._read_freesurfer_annotation(path)#

Averages source space regions to areas defined by the Desikan-Killiany atlas.

Parameters:

path (string) – Path to the annotation file.

Returns:

regions – Dictionary of regions containing vortex ids.

Return type:

dict, {regions : [vtx_ids]}

src_rec.avg_src_reg._get_sphere_faces(fs_avg_path, hemisphere, octa_model_vert, octa_model_faces)#

Mimics the original downscaling as this is later needed for region averaging, yet, this time in reference to fs-average instead of subject specific.

Parameters:
  • fs_avg_path (string) – Path to fs average’s freesurfer files.

  • hemisphere (string) – hemisphere to be operated on.

  • octa_model_vert (numpy.ndarray, shape(octa_vtx_cnt, 3)) – Octahedron model vertices.

  • octa_model_faces (numpy.ndarray, shape(octa_face_cnt, 3)) – Octahedron model faces.

Returns:

neigh_faces – Faces most closeby to model faces.

Return type:

numpy.ndarray, shape(octa_face_cnt, 3)

src_rec.avg_src_reg._get_mri_to_model_trans(mri_neigh_faces)#

Limits MRI vertices by employing the reduced face list to reduce vortex count.

Parameters:

mri_neigh_faces (numpy.ndarray, shape(face_cnt, 3)) – Faces most closeby to model faces.

Returns:

mri_to_model_trans – Region names.

Return type:

numpy.ndarray, shape(vtx_cnt, )