Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fMRIPrep CIFTI Output Surface Dimension #2720

Closed
ChristianNSchmitz opened this issue Feb 22, 2022 · 2 comments
Closed

fMRIPrep CIFTI Output Surface Dimension #2720

ChristianNSchmitz opened this issue Feb 22, 2022 · 2 comments
Labels

Comments

@ChristianNSchmitz
Copy link

ChristianNSchmitz commented Feb 22, 2022

What happened?

Dear fmriprep team,
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.

You can see two example errors below (one is posted on the github page of pycortex). However, my error resembles this neurstars post: https://neurostars.org/t/fmriprep-cifti-output-surface-dimension-resampling/21344/2
Thanks,
Chris

What command did you use?

docker run --rm -it -v /mnt/d/Data/MyStudy/rawdata:/data:ro -v /mnt/d/Data/MyStudy/derivates/fmriprep-preprocessing/:/out -v /mnt/d/Data/MyStudy/workingDirectory/:/workDir -v /home/.licenses/freesurfer/license.txt:/opt/freesurfer/license.txt nipreps/fmriprep:latest /data /out participant \
    --output-spaces MNI152NLin6Asym:res-2 MNI152NLin2009cAsym \
    -w /workDir \
    --use-aroma \
    --return-all-components \
    --cifti-output \
    --force-syn --stop-on-first-crash

What version of fMRIPrep are you running?

nipreps/fmriprep:latest

How are you running fMRIPrep?

Docker

Is your data BIDS valid?

Yes

Are you reusing any previously computed results?

No

Please copy and paste any relevant log output.

It is an error not by fmriprep but by other down-stream programs

Additional information / screenshots

Following error on pycortex is probably related with this issue: gallantlab/pycortex#428

fig, axes = plt.subplots(1, 1)
cifti = nb.load('D:\\Data\\MyStudy\\derivates\\fmriprep-preprocessing\\sub-011\\ses-01\\func\\sub-011_ses-01_task-rest_run-1_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('D:\\Data\\MyStudy\\derivates\\fmriprep-preprocessing\\sub-011\\anat\\sub-011_run-01_hemi-L_inflated.surf.gii', surf_data_from_cifti(cifti_data, axes[1], 'CIFTI_STRUCTURE_CORTEX_LEFT').mean(axis=1) ,cmap='plasma')


vol, left, right = decompose_cifti(cifti)
Traceback (most recent call last):

  File "C:\Users\CHRIST~1.SCH\AppData\Local\Temp/ipykernel_14584/1497458682.py", line 7, in <module>
    _ = nlp.plot_surf('D:\\Data\\MyStudy\\derivates\\fmriprep-preprocessing\\sub-011\\anat\\sub-011_run-01_hemi-L_inflated.surf.gii', surf_data_from_cifti(cifti_data, axes[1], 'CIFTI_STRUCTURE_CORTEX_LEFT').mean(axis=1) ,cmap='plasma')

  File "C:\Users\Chris\.conda\envs\fMRIAnalysis\lib\site-packages\nilearn\plotting\surf_plotting.py", line 233, in plot_surf
    raise ValueError('The surf_map does not have the same number '

ValueError: The surf_map does not have the same number of vertices as the mesh.
@effigies
Copy link
Member

The .surf.gii files are just GIFTI translations of the individual subject surfaces. The CIFTI files are in the fsLR template space. They can be plotted on other surfaces from that space. You should be able to Google around for Conte69 surfaces.

@mgxd
Copy link
Collaborator

mgxd commented Mar 25, 2022

We recently added 3 types of surface meshes to templateflow which can be used to visualize the CIFTIs. Here's a quick script to fetch / locate them:

# assuming you have the latest templateflow installed
import templateflow.api as tf
files = []
for suff in ('midthickness', 'inflated', 'veryinflated'):
    files += tf.get('fsLR', density='32k', suffix=suff)
print(files)

@mgxd mgxd closed this as completed Mar 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants