nipreps / fmriprep

fMRIPrep is a robust and easy-to-use pipeline for preprocessing of diverse fMRI data. The transparent workflow dispenses of manual intervention, thereby ensuring the reproducibility of the results.
https://fmriprep.org
Apache License 2.0
628 stars 290 forks source link

resample subject native anat surface to fsaverage5 & smooth #2251

Open oareii opened 4 years ago

oareii commented 4 years ago

Hi! I am new to fmriprep, I want to analyze my resting-state fMRI data based on surface. Considered the resolution of functional image, fsaverage5 seems a favorable destination surface for me.

So first I run fmriprep and resampled my functional data onto fsaverage5 by command below:

docker run --rm -it -v /home/Documents/HCprep/Nifti:/data:ro -v /home/Documents/HCprep/derivatives:/out -v /home/Documents/HCprep/work:/work -v /usr/local/freesurfer/license.txt:/opt/freesurfer/license.txt poldracklab/fmriprep /data /out participant -w /work --resource-monitor --fs-license-file /opt/freesurfer/license.txt --write-graph --use-aroma --cifti-output --output-spaces fsaverage5 T1w func >/home/Document/sub.log

And I have two questions:

  1. The [--output_space] parameter will only specify the functional output space, when anatomical output (e.g. xxx.pial.surf.gii, xxx.midthickness.surf.gii) will still be in native space, how could I resample these gifti file to fsaverage5 space?

  2. And if there any recommendation for how to smoothing the functional file, I mean the raw gifti bold file(xxx.bold.func.gii) which have went through some other preprocessing steps?

Many thanks!!!

effigies commented 4 years ago
  1. You mean you want to resample structural surfaces to fsaverage5? If so, I think this is a misunderstanding, as fsaverage5 defines a set of structural surfaces, available in the FreeSurfer subject's directory.
  2. mri_surf2surf can be used to smooth data sampled on the surface.
oareii commented 4 years ago
  1. You mean you want to resample structural surfaces to fsaverage5? If so, I think this is a misunderstanding, as fsaverage5 defines a set of structural surfaces, available in the FreeSurfer subject's directory.
  2. mri_surf2surf can be used to smooth data sampled on the surface.

Hi, Thank you so much for your responding. I may not have made it clear before, here is the thing:

I run fmriprep to get the functional data in fsaverage5 by specifying the output-space fsaverage5, so I will get the gifti file of bold signal in fsaverage5 (i.e., xxx.bold.func.gii), and I actually can read these gifti file, thus, I will get my time series matrix in fsaverage5 space (namely, a n

Sorry for troubling you again. With regards!

effigies commented 4 years ago

I have to register every subjects' surface (such as midthickness) to fsaverage5(this is how my first question came from).

Yes, this seems to be a misunderstanding. Subjects are registered to fsaverage during reconstruction, and this is how data is resampled to fsaverage5. To manipulate these data, use mri_surf2surf with the --srcsubject fsaverage5. To smooth using the midthickness coordinates to determine distance, use --projfrac white 0.5.

I go into this in a bit more detail here.

oareii commented 4 years ago

Thank you so much! That's really helpful!

A quick question! Is there any function to convert the bold signal matrix to a .mgh format file to perform mri_surf2surf (for the --srcsurfval tag) or any other format for this tag?

Many thanks!

effigies commented 4 years ago

All FreeSurfer tools should support Gifti natively. If it does not, then you can use mris_convert.

oareii commented 4 years ago

Got it! Thank you so much!

Bests!!!

oareii commented 3 years ago

Hi, there are some updates along my questions:

To begin with, I want clarify my goal again here: I want to resample my resting data in fsaverage5 and then do some preprocessing before statistical analysis, and I get stuck in smooth now.

So, after your suggestion, I tried the following command:

mri_surf2surf --srcsubject sub-40 --srcsurfval /home/disk2/Data/HC/HCprep/derivatives/fmriprep/sub-40/ses-1/func/sub-40_ses-1_task-rest_run-1_space-fsnative_hemi-L_bold.func.gii --trgsubject fsaverage5 --trgicoorder 5 --trgsurfval /home/disk2/Data/HC/HCprep/sub-40_smooth6_proj.mgh --hemi lh --fwhm-trg 6 --projfrac white 0.5

  1. --srcsubject: this is the freesurfer output folder from fmriprep (in ...derivatives/freesurfer/...)

  2. --srcsurfval: I used fmriprep --output-space fsnative to resample the resting data to subject native space. (which I'd like to get confirmed from you because I found there is a transform matrix between T1w and fsnative, and I believe T1w is in THE subject native space.)

  3. --trgsubject/--trgicoorder: I want to resample the data to a fsaverage5 as I mentioned before

  4. --projfrac white 0.5: I followed your advice to smooth use midthickness coordinates, but there is an error: ERROR: cannot spec both --sval-xyz and --sval then I tried to add these two parameters: mri_surf2surf --srcsubject sub-40 --srcsurfval /home/disk2/Data/HC/HCprep/derivatives/fmriprep/sub-40/ses-1/func/sub-40_ses-1_task-rest_run-1_space-fsnative_hemi-L_bold.func.gii --trgsubject fsaverage5 --trgicoorder 5 --trgsurfval /home/disk2/Data/HC/HCprep/sub-40_smooth6_proj.mgh --hemi lh --fwhm-trg 6 --projfrac white 0.5 --sval-xyz white --sval /home/disk2/Data/HC/HCprep/derivatives/fmriprep/sub-40/ses-1/func/ but the error still exist: ERROR: cannot spec both --sval-xyz and --sval I searched a lot and cannot found any useful help with it.

I also have another question about smooth: I can also smooth my data with following command: mri_surf2surf --srcsubject fsaverage5 --srcsurfval /home/disk2/Data/HC/HCprep/derivatives/fmriprep/sub-15/ses-1/func/sub-15_ses-1_task-rest_run-1_space-fsaverage5_hemi-L_bold.func.gii --trgsubject fsaverage5 --trgsurfval /home/disk2/Data/HC/HCprep/sub-40_smooth6_proj.mgh --hemi lh --fwhm-trg 6 --projfrac white 0.5 (--projfrac didn't work here too)

With --srcsubject fsaverage5 specified here, will every subject use the same coordinate/distance info when performing smooth? If the answer is yes, is that acceptable? And in the command I used above will every subject use their own info?

Sorry for troubling you again, Thanks a lot! rao