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.
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.
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.
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.