lyman.surface.vol_to_surf

lyman.surface.vol_to_surf(data_img, subject, hemi, surf='graymid', null_value=0, cortex_only=True, subjects_dir=None)[source]

Sample data from a volume image onto a surface mesh.

This function assumes that data_img is in register with the anatomy and loads data from the Freesurfer data directory hierarchy.

Parameters
data_imgnibabel image

Input volume image; can be 3D or 4D.

subjectstring

Subject ID to locate data in data directory.

hemilh | rh

Hemisphere code; with surf finds surface mesh geometry file.

surfstring

Surface name, with hemi finds surface mesh geometry file.

null_valuefloat

Value to use for surface vertices that are outside the volume field of view.

cortex_onlybool

If True, vertices outside the Freesurfer-defined cortex label are assigned null_value.

subjects_dirstring

Path to the Freesurfer data directory root; if absent, get from the SUBJECTS_DIR environment variable.

Returns
surf_datan_vert (x n_tp) array

Data as a vector (for 3D inputs) or matrix (for 4D inputs).