fMRIPrep CIFTI Output Surface Dimension Resampling


I am using fMRIprep 21.0.0 cifti outputs (91k). There appears to be a dimension mismatch between the func/*dtseries.nii resolution and the anat/*.surf.gii files. The subject’s surface gifti is much higher resolution. However, the func dimensions do match when comparing against the templateflow tpl-fsLR_den-32k_hemi-* file. Is there a way using software in the fMRIPrep container to resample the high-resolution specific template to the resolution of the template?


Sorry, I’m not parsing this. What’s the specific output you want?

One interpretation I have is a decimated subject surface mesh with vertices that match the fsLR template such that resampling to the decimated mesh is equivalent to resampling to the template. That I definitely don’t know how to achieve, though it would be cool…

I definitely could have explained that better. As an example, in following some of the CIFTI examples in this tutorial, I am trying to run the following to plot the CIFTI data overlaid the subject surface (with paths replaced by placeholders):

cifti = nb.load('/fmriprep/sub-XXX/func/sub-XXX_task-XXX_space-fsLR_den-91k_bold.dtseries.nii')
cifti_data = cifti.get_fdata(dtype=np.float32)
cifti_hdr = cifti.header
nifti_hdr = cifti.nifti_header
axes = [cifti_hdr.get_axis(i) for i in range(cifti.ndim)]

_ = nlp.plot_surf("/fmriprep/sub-XXX/anat/",
                  surf_data_from_cifti(cifti_data, axes[1], 'CIFTI_STRUCTURE_CORTEX_LEFT').mean(axis=1),

I get the following error:

ValueError                                Traceback (most recent call last)
/tmp/ipykernel_31980/ in <module>
----> 1 _ = nlp.plot_surf("/om4/group/gablab/data/ds003126/derivatives/fmriprep/sub-047EPKL011005/ses-1/anat/",
      2                   surf_data_from_cifti(cifti_data, axes[1], 'CIFTI_STRUCTURE_CORTEX_LEFT').mean(axis=1),
      3                   cmap='plasma')

/om2/user/smeisler/anaconda3/envs/nipype/lib/python3.8/site-packages/nilearn/plotting/ in plot_surf(surf_mesh, surf_map, bg_map, hemi, view, cmap, colorbar, avg_method, threshold, alpha, bg_on_data, darkness, vmin, vmax, cbar_vmin, cbar_vmax, cbar_tick_format, title, output_file, axes, figure, **kwargs)
    231                              '%i dimensions' % surf_map_data.ndim)
    232         if surf_map_data.shape[0] != coords.shape[0]:
--> 233             raise ValueError('The surf_map does not have the same number '
    234                              'of vertices as the mesh.')

ValueError: The surf_map does not have the same number of vertices as the mesh.

Here are the numbers of vertices of each file from the ciftiTools package in R (the first part is from the functional data, second from the anatomical surfaces):

Got it. Yes, I see what you’re asking for, and there’s probably a way, but I don’t know how to do that. Might check the freesurfer or hcp-users lists?

If you just want to see the time series on your subject surface, you can always use the fsnative output space (though it’s massive…). If you have outputs in T1w space, then you can use mri_vol2surf to resample, yourself.

Dear @Steven and @effigies,
we are currently encountering the same issue. All cifti-reading programs (Connectome workbench, nibabel, etc.) are indicating a mismatch between the func/*dtseries.nii resolution and the anat/*.surf.gii files.
@Steven, have you found a solution for the issue?