fMRIPrep: how to resample data from T1w space into MNI space

Thank you for your response.

However I have another question, I realize that I need the warp-file of the structural data to MNI152 space (non-linear registration). What file from fmriprep outputs is it?
Thanks :slight_smile:

Hello,

Each subject’s composite nonlinear transform (warp) from subject anatomical space to MNI152 space will be in that subject’s output directory (fmriprep/sub-<id>/<other BIDS identifiers>), in a path like:

anat/sub-<subject_label>_from-T1w_to-MNI152NLin2009cAsym_mode-image_xfm.h5

The inverse transform, should you require it, is located at a similar path:

anat/sub-<subject_label>_from-MNI152NLin2009cAsym_to-T1w_mode-image_xfm.h5

In general, the outputs of fmriprep are documented here.

Hello,

Thanks for your answer @rastko
However ica-aroma requires a .nii image to perform the analysis, I tried using this outputs but didn’t work.

These outputs are already on MNI space:

func/sub-<subject_label>_task-<task_label>_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz

The ica-aroma command is as it follows:

python2.7 ICA_AROMA.py -in func_smoothed.nii.gz( desc-preproc_bold.nii.gz) -out ICA_AROMA -affmat reg/func2highres.mat -warp highres2standard_warp.nii.gz -mc
rest_mcf.par(from confounds text).

What would be the warp image?

In this situation I would use the outputs already on MNI space, and for the warp, an all-zeros XxYxZx3 NIfTI with the same shape and affine of the input.

import numpy as np
import nibabel as nb

im = nb.load('<bids_entities>_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz')
hdr = im.header.copy()
hdr.set_intent(2006)  # Set NIFTI intent code to "FSL_FNIRT_DISPLACEMENT_FIELD"
nb.Nifti1Image(np.zeros(list(im.shape[:3]) + [3], dtype=float), im.affine, hdr).to_filename('zero_warpfield.nii.gz')