Fmriprep normalization with ANTs, transformation matrix

Hi,

I’ve run the fmriprep workflows using all the default settings on a dataset that includes both anatomical and functional images, with the only changes being “no freesurfer”, and I required fmri output in both native space and in MNI. I have all the output now with slightly modified versions of the bold_space_T1w_preprocess images where I regressed out the confound estimates and kept only the residuals from that regression.

Ideally I would like to run nilearn spotlight analyses on this data using behavioral outcomes, get accuracy maps in native space, and then transform these accuracy maps to MNI space for group level analyses. I was wondering what piece of the fmriprep output I would use to extract a transformation matrix for normalization (what I usually have as a .mat file) and apply it to the images. From what I have, it looks like the only candidate is “sub-01_T1w_target-MNI152NLin2009cAsym_warp.h5”, etc.

Can I use this .h5 file to transform the outputs from the analyses of functional images in native space to MNI? Is there an ANTs command that I could input the functional results and this .h5 file to make this happen? Or did I forget to include some additional command to fmriprep to save the transformations from ANTs separately (as their manual says those are saved as .mat files). If that is the case and I messed up, is there a way I could produce those .mat files without running the whole pipeline again or another reasonable workaround you can imagine?

Thanks!
Yavuz

There’s what the structure of my .h5 files look like:

|   |group             |name                    |otype       |dclass |dim      |
|:--|:-----------------|:-----------------------|:-----------|:------|:--------|
|0  |/                 |HDFVersion              |H5I_DATASET |STRING |1        |
|1  |/                 |ITKVersion              |H5I_DATASET |STRING |1        |
|2  |/                 |OSName                  |H5I_DATASET |STRING |1        |
|3  |/                 |OSVersion               |H5I_DATASET |STRING |1        |
|4  |/                 |TransformGroup          |H5I_GROUP   |       |         |
|5  |/TransformGroup   |0                       |H5I_GROUP   |       |         |
|6  |/TransformGroup/0 |TransformType           |H5I_DATASET |STRING |1        |
|7  |/TransformGroup   |1                       |H5I_GROUP   |       |         |
|8  |/TransformGroup/1 |TranformFixedParameters |H5I_DATASET |FLOAT  |3        |
|9  |/TransformGroup/1 |TranformParameters      |H5I_DATASET |FLOAT  |12       |
|10 |/TransformGroup/1 |TransformType           |H5I_DATASET |STRING |1        |
|11 |/TransformGroup   |2                       |H5I_GROUP   |       |         |
|12 |/TransformGroup/2 |TranformFixedParameters |H5I_DATASET |FLOAT  |18       |
|13 |/TransformGroup/2 |TranformParameters      |H5I_DATASET |FLOAT  |25590063 |
|14 |/TransformGroup/2 |TransformType           |H5I_DATASET |STRING |1        |

Ideally I would like to run nilearn spotlight analyses on this data using behavioral outcomes, get accuracy maps in native space, and then transform these accuracy maps to MNI space for group level analyses. I was wondering what piece of the fmriprep output I would use to extract a transformation matrix for normalization (what I usually have as a .mat file) and apply it to the images. From what I have, it looks like the only candidate is “sub-01_T1w_target-MNI152NLin2009cAsym_warp.h5”, etc.

.h5 files are ANTs composite transforms. They can be applied using AntsApplyTransforms tool (using the MNI152NLin2009cAsym atlas as a reference).

1 Like

So would the following command work?:

antsApplyTransforms -i sub-35_task-discount_bold_space_T1w_accMap.nii.gz -t sub-01_T1w_target-MNI152NLin2009cAsym_warp.h5 -r MNI152NLin2009cAsym -o sub-35_task-discount_bold_space_MNI152NLin2009cAsym_accMap.nii.gz

Theoretically, but the reference image needs to be an existing file not a label. You can find the atlas here.

1 Like