Subject to fs-avg#
This module provides methods to transform data from subject specific into fs-average space.
- src_rec.subj_to_fsavg.prepare(fs_path, anatomy_path, subj_name)#
Compute precursors of the mri projections.
- Parameters:
fs_path (string) – Path to the freesurfer folder. Should contain the ‘bin’ folder, your license.txt, and sources.sh.
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.
- src_rec.subj_to_fsavg.compute(cort_mdl, anatomy_path, subj_name, fs_path, overwrite)#
Create a subject to fs average transformation matrix.
- Parameters:
cort_mdl (finnpy.src_rec.cort_mdl.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).
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.
fs_path (string) – Path to the freesurfer folder. Should contain the ‘bin’ folder, your license.txt, and sources.sh.
overwrite (boolean) – Flag whether to overwrite MRI maps.
- Returns:
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.
- Return type:
finnpy.src_rec.subj_to_fsavg.Subj_to_fsavg_mdl
- src_rec.subj_to_fsavg.apply(subj_to_fsavg_mdl, data)#
Transforms data from subject space to fs_average space
- Parameters:
trans_mat (scipy.sparse.csr_matrix, shape(source_space_ch_cnt, source_space_ch_cnt)) – Subject to fs-average transformation matrix.
data (numpy.ndarray, shape(source_space_ch_cnt, samp_cnt)) – Source space (subject) data.
- Returns:
transformed_data – Source space (fs-average) data.
- Return type:
numpy.ndarray, shape(source_space_ch_cnt, samp_cnt)
- src_rec.subj_to_fsavg._calc_small_to_default_vertices_proj(valid_vert, sub_vert, sub_faces)#
Calculates projection from subject vertices to small sphere vertices.
- Parameters:
valid_vert (numpy.ndarray, shape(mri_vtx_cnt,)) – Valid vertices
sub_vert (numpy.ndarray, shape(mri_vtx_cnt, 3)) – High-definition vertices.
sub_faces (numpy.ndarray, shape(mri_face_cnt, 3)) – High-definition faces.
- Returns:
proj – Projection from all vertices to valid vertices.
- Return type:
numpy.ndarray, shape(mri_face_cnt, valid_vtx_cnt)
- src_rec.subj_to_fsavg._calc_mri_maps(anatomy_path, subj_name, fs_avg_path, hemisphere, overwrite)#
Find the subject space points corresponding to fs avg space points.
- 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.
fs_avg_path (string) – Path for fs average freesurfer files.
hemisphere (string) – Hemisphere to compute for.
overwrite (boolean) – Flag whether to overwrite preexisting mri maps.
- Returns:
sub_vert (numpy.ndarray, shape(mri_vtx_cnt, 3)) – Vertices of the MRI model.
sub_faces (numpy.ndarray, shape(mri_face_cnt, 3)) – Faces of the MRI model.
avg_vert (numpy.ndarray, shape(fs_avg_vtx_cnt, 3)) – Vertices of fs-avg’s sphere model.
mri_map (numpy.ndarray, shape(fs_avg_vtx_cnt, mri_vtx_cnt)) – Translation from subject mri to fs-average sphere model.