Extracting time-series using parcellation file not the same size as fmriprep functional scan

Hi,

I currently have my functional fmriprep(version 1.5.8) outputs (volume 62 x 53 x 65), and I am wanting to extract the time series from the functional scans using a parcellation file. However, I need to warp the parcellation file into the functional scans volume space. I was hoping to do this using the subjects T1-weight scan (229 x 193 x 193), however they are not in the same space as the functional scan, despite using the ‘MNI152NLin2009cAsym’ warped scans.
The parcel file (which is currently in 2mm MNI space - volume 109 x 91 x 91) doesn’t align with the functional files and I was wondering if anyone has suggestions of how I could find the template that warped my functional scans into MNI152NLin2009cAsym space? or the structural file used in fMRIprep as the MNI152NLin2009cAsym template?
Or whether there is a code that links up with the output of fmriprep and extracts time series from a parcellation file that you feed to the code?

Would greatly appreciate anyone’s advice.

Kind regards,
Natasha

The BOLD and T1w images are in the same space, so you can get your parcellation file sampled to match your BOLD data simply by using the BOLD file as the fixed reference.

antsApplyTransforms -n genericLabel \
    -t <fmriprep>/sub-<label>/anat/sub-<label>_from-MNI152NLin2009cAsym_to-T1w_mode-image_xfm.h5 \
    -i <parcellation> \
    -r <fmriprep>/sub-<label>/func/sub-<label>_task-<label>_space-T1w_desc-preproc_bold.nii.gz \
    -o <out_parcellation>

That should be pretty close to the right invocation. You’ll obviously want to check the alignment in some visual tool, and might need to adjust the command.

You can find all of the available templates here: https://www.templateflow.org/usage/archive/

Thank you Chris!

I have been looking through my outputs from fmriprep, but I cannot find the corresponding /sub-_task-_space-T1w_desc_preproc_bold.nii.gz.
I’m assuming this is a standard output for fmriprep or do I need to specify for this output?
It’s a bit odd because I have run fmriprep on a few datasets, and they only have the /sub-_task-_space-MNI152…

If your outputs are in space-MNI152NLin2009cAsym, then all you need to do is resample the parcellation with the same dimensions and pixel sizes as the BOLD. I think you can do that just by dropping the -t flag in antsApplyTransforms:

antsApplyTransforms -n genericLabel \
    -i <parcellation> \
    -r <fmriprep>/sub-<label>/func/sub-<label>_task-<label>_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz \
    -o <out_parcellation>

But if you don’t need to use the transform, then you’re not stuck with ANTs. You could just as easily use mri_vol2vol (FreeSurfer), flirt (FSL), resample_from_to (nibabel), resample_to_img (nilearn) or some tool from your preferred suite.

1 Like

Thank you Chris!
That has solved my problem.

1 Like