Combining fMRIprep BOLD to T1 transformation with T1 to T2 fsl flirt transformation

Dear fMRIPrep Experts,

I have used fMRIprep for preprocessing of rsfMRI data. My input data to fMRIprep for preprocessing includes whole brain EPI and subject’s T1. And now I want to register fMRIprep output BOLD which has been registered to T1, to subject’s T2 image. Subject’s T2 image is not whole brain and I have segmentations in T2 space that I would like to use. I am trying to combine transformation that fMRIprep outputs, sub-participant _ses-02_task-rest_from-scanner_to-T1w_mode-image_xfm.txt, with a transformation that I have computed using fsl flirt for taking T1 to T2 space, to create a transformation that takes rsfMRI to T2 space. However, the fMRIprep xfm.txt format looks different and convert_xfm gives me an error when I feed these 2 transformations to it. Is there any command or method in fMRIprep that I could use to convert fmri prep transformations to fsl transformation conventions?

Kind regards,

Mahta

Hi,
I run into the same problem how to read the xfm txt file.
You can convert the file with

https://nipreps.org/niworkflows/api/niworkflows.interfaces.nitransforms.html?highlight=xfm#niworkflows.interfaces.nitransforms.concatenate_xfms

to a Freesurfer lta file and with lta_convert to fsl.

Dear Joerg,
Thanks for answering my question. I really appreciate it.

I tried converting the sub-participant _ses-02_task-rest_from-scanner_to-T1w_mode-image_xfm.txt with niworkflows.interfaces.nitransforms.concatenate_xfms in python.
But I was really confused how to use it. I was wondering if you have any examples of commands that you used before. Again many thanks.

Kind regards,
Mahta

Dear Matha,
I use it to convert a Freesurfer label to the EPI space.

concat = ConcatenateXFM()
concat.inputs.out_fmt = ‘fs’
concat.inputs.in_xfm = [‘sub-01_run-1_from-fsnative_to-T1w_mode-image_xfm.txt’,‘sub-01_ses-01_task-foo_run-1_from-T1w_to-scanner_mode-image_xfm.txt’]
concat.inputs.reference = ‘sub-01_ses-01_task-foo_run-1_boldref.nii.gz’
concat.inputs.moving = ‘sub-01/mri/aparc+aseg.mgz’

out = concat.run()

out_lta = out.outputs.lta

I use the lta with applyVolTransform()

Joerg