Fmriprep --template-resampling-grid

Dear NeuroStars,

I am trying to understand the -template-resampling-grid command of fmriprep (1.1.2). I guess, this is somehow related to the difference between resampling and realignment concepts.

This command:

$ singularity run -B <main_dir> <main_dir/fmriprep-1.1.2.simg> <main_dir/bids_dir> <main_dir/output_A>
participant --participant-label 01 --fs-license-file <$HOME/license.txt> --nthreads 16 --bold2t1w-dof 6 --use-aroma -w <main_dir/work_A> --write-graph --template MNI152NLin2009cAsym --output-space template --template-resampling-grid 2mm

results in EPI images with 2x2x2 mm voxel resolution. But, they are not aligned to MNI152_2mm_brain.nii.gz template.

However, this command:

$ singularity run -B <main_dir> <main_dir/fmriprep-1.1.2.simg> <main_dir/bids_dir> <main_dir/output_B>
participant --participant-label 01 --fs-license-file <$HOME/license.txt> --nthreads 16 --bold2t1w-dof 6 --use-aroma -w <main_dir/work_B> --write-graph --template MNI152NLin2009cAsym --output-space template --template-resampling-grid MNI152_T1_2mm_brain.nii.gz

results in EPI images with 2x2x2 mm voxel resolution. AND, they are aligned to MNI152_2mm_brain.nii.gz template.

If anybody could explain why EPI is not aligned to MNI for the first command, I’d really appreciate.

Thanks a lot!

Hi @sheyma,

Can you show how the results with --output-space template --template-resampling-grid 2mm is not aligned with MNI152_2mm_brain.nii.gz? In principle, fMRIPrep results which name includes space-MNI152NLin2009cAsym should be aligned with such template. I’m guessing that MNI152_2mm_brain.nii.gz corresponds to the brain volume of the ICBM152 linear that you probably got from FSL or SPM. If so, you might expect a different orientation. With the appropriate viewer, the misalignment should be fairly small.

Now I’m reading your second question. So, as you are explicitly passing on the target space (--template-resampling-grid MNI152_T1_2mm_brain.nii.gz), your viewer renders both images aligned because they have exactly the same data grid and associated metadata describing the coordinates system. But it is your viewer which is not displaying the first output correctly.

Cheers,
Oscar

Hi @oesteban,

I cannot really show it. I basically visualized the preprocessed EPI with fslview (4.0.1), and tried to add standard brain MNI152_2mm_brain.nii.gz on top of it (obtained from FSL). There was an error saying “…All overlays must have the same dimension…”

But, I guess, I understood why the two images are not aligned. Preprocessed EPI has 2x2x2 mm resolution, as “–template-resampling-grid” was given as 2mm. And it’s aligned to MNI152NLin2009cAsym space as given with “–template MNI152NLin2009cAsym --output-space template” options.

When I resampled MNI152NLin2009cAsym template to 2x2x2 mm resolution, it was no problem to overlay it on the preprocessed EPI using fslview. However, since the target template was not MNI152_2mm_brain.nii.gz, they don’t overlay.

Cheers to you too,
Şeyma

Hi, the fact that fslview cannot overlay two files with different data matrix grid (ie. different pixel sizes and/or number of pixels) does not mean that their info is not in register (or “aligned”, using your words). You can use the new fsleyes, freeview, mango, etc. to visualize these files.

Also, fMRIPrep comes with FSL 5.0.9, I would suggest you to update your system ;). I’m unclear whether fslview 5+ will be able to open mismatched nifti files.

Oohhh, I see. Thanks for the nice tips on FSL update and registration/realignment.

Usually softwares like freesurfer, fsl etc. are installed by IT in our department. But, I’ll ask them to update at least FSL then.