Fmriprep: Which registration file is used for resampling BOLD to surface space?

Hi all,

After preprocessing my data using fmriprep, I would like to run my voxel-wise BOLD regression in T1w volume space and then sample my results to fsnative surface space. Does anyone know which registration file fmriprep uses to sample the BOLD time series in original space to the fsnative surface space? And is there a transformation matrix in the fmriprep output which would give me those voxels used to create the BOLD time series in surface space later on so that I can limit the number of voxels in my regression beforehand?

Thank you so much for your help!

Elmsch

If I understood correctly, you want to:

1 - Run fMRIPrep with --output-space T1w <and other spaces if you'd like>
2 - Sample the BOLD signal (eg., sub-01_task-sometask_run-02_space-T1w_desc-preproc_bold.nii.gz) after your regression step, with sub-01_hemi-{L,R}_midthickness.surf.gii as sampling reference (the surface between pial and white from fsnative).

Alternatively, you could run regression on sub-01_task-sometask_run-02_space-fsnative_hemi-{R,L}.func.gii, making sure you run fmriprep with --output-space fsnative

Is that correct? (cc/ @effigies for double-checking)

Thank you for the very comprehensive reply, @oesteban !

I hope that the second part of my question becomes a bit clearer below:

I would like to first run voxel-wise regression in volume space and then sample my regression results to fsnative space. As only cortical voxels are represented in surface space anyway, I would like to mask those voxels relevant for surface sampling so that I can apply (rather time-consuming) regression only to this limited number of voxels. So it is really more about computational resources…

I already ran fmriprep with fsnative as an output space because I was hoping that the workflow would also output some kind of matrix enabling me to figure out which voxels are considered for BOLD surface sampling. However, I was not able to figure out which file might contain such info so far.

Does fmriprep create any such file? I guess, a simple grey matter brain mask would not do, as freesurfer does not operate on those!?

So basically you want a surface mask in volume space.

BOLD=<your output BOLD file>
for HEMI in lh rh; do
    mri_surf2vol --hemi $HEMI --fillribbon --identity \
        --template $BOLD --mkmask --outvol $HEMI.mask.nii.gz
done

I haven’t actually tried this… I adapted it from a command I found from a previous project. So I would recommend overlaying it onto your T1w and BOLD files to make sure that it lines up as you’d expect.

1 Like

Hi @effigies and other fMRIprep experts. I am essentially trying to find out something very similar (perhaps even simpler) as in the question above. I would need to know the total number of BOLD voxels that are used to produce the resampled timecourses on the fsnative surface (i.e. the BOLD voxels that intercept the cortical ribbon, or equivalently the upsampling factor that occurs between BOLD grey-matter-voxel timecourses and fsnative timecourses). Is there a way to find this out from fmriprep outputs? And/or, if possible, could you provide a bit more explanation on how to use the snippet in previous answer? Thank you very much!!

If you get the cortical ribbon in BOLD space, you should be able to get the number of gray matter voxels by simply counting the non-zero voxels.

Alternately, there should be an aseg file resampled to BOLD resolution in the functional fMRIPrep outputs. You should be able to count the voxels that are segmented as cortex (see the FreeSurferColorLUT).

1 Like

I just thought of an easier way to calculate what I was looking for, using only Freesurfer outputs. I post it here in case someone else needs it. It is not an exact calculation, only an approximate estimate, but should be reasonably accurate.

  1. Use …/surf/lh.ribbon and rh.ribbon to compute number of grey matter voxels, at native anatomy resolution. Multiply by the volume of a single anatomical voxel to obtain an estimate of total grey matter volume.
  2. Divide total grey matter volume by the volume of a single BOLD voxel to obtain an approximate estimate of the number of BOLD voxels within the cortical ribbon.
  3. Compute ratio of BOLD voxels within the cortical ribbon to fsnative surface vertices to obtain an estimate of the upsampling between timecourses in BOLD space and timecourses on fsnative surface.