Converting .nii.gz to surface .func.gii file?


I’m trying to convert my BOLD mri to an fsaverage projected gifti file, and I’m curious the best way to go forward.

My data is in MNI space. I can get the fsaverage texture file (e.g., right hemisphere) by the following command:

texture = surface.vol_to_surf(fmri_image, fsaverage.pial_right)

How do I save this texture file in a gifti format? Is it possible through nilearn/nibabel?

Many thanks,