EPI->T1 (subject) transform

Hello,

I am looking for the EPI->T1 transform. Specifically, I am looking for the transform from the first run’s EPI reference image to the the subject’s anatomical. I came across this post but I am still a little confused. I was hoping someone could clarify.

In the workdir, I see several transforms in the folder …/bold_reg_wf/bbreg_wf/:

bbregister/
fsl2itk_fwd/
lta2fsl_fwd/

Are these different formats of the same transform, or altogether different transforms? I see there is a folder named “compare_transforms” so I am guessing the latter - the above are compared and then the “best” one is selected?

Is this “best transform” stored in the /mri_coreg/ folder?

Cheers!

(Apologies for reposting this from my reply to the linked post, but there was no follow up there, maybe because that post was outdated.)

Hi Dror,

I suspect your last post got drowned in notifications over the holidays. Sorry. Thanks for opening a new one.

There are three equivalent transforms (I think I have the extensions correct):

  • LTA (FreeSurfer): lta_concat/*.lta
  • FSL: lta2fsl_fwd/*.mat
  • ITK: fsl2itk_fwd/*.txt

You should not use the mri_coreg or bbregister results directly, since they don’t account for differences between FreeSurfer’s T1.mgz and fMRIPrep’s output desc-preproc_T1w.nii.gz. Further, we also check whether the boundary-based refinement (bbregister) is too far from the initial, rigid coregistration (mri_coreg). If the disparity is too great, we fall-back to the initial coregistration (see EPI to T1w registration. Because of this, it’s not clear which one will be correct.

Fortunately lta_concat combines the selected transform with the update to account for FreeSurfer-fMRIPrep differences, solving both problems.

Best
Chris

Cheers Chris.

However something seems to be off - most likely my understanding.

A bit more background.

I run fmriprep using --output-spaces func. I do all my analysis in that space. For visualization, I project on to the subject’s cortex (using pycortex). For this I need to know the transform from the EPI to the subjects own anatomical image.

Am I correct in saying that this transform is located here:

work_dir/fmriprep_wf/single_subject_001_wf/func_preproc_ses_1_task_perceptDecouple_acq_TR1000_run_1_wf/bold_reg_wf/bbreg_wf/lta_concat/out.lta

When I try to visualize this using tkregister with the command

tkregister2 --mov /fmriprep/sub-001/ses-1/func/sub-001_ses-1_task-perceptDecouple_acq-TR1000_run-1_boldref.nii.gz --reg /work_dir//fmriprep_wf/single_subject_001_wf/func_preproc_ses_1_task_perceptDecouple_acq_TR1000_run_1_wf/bold_reg_wf/bbreg_wf/lta_concat/out.lta --sd /fmriprep/freesurfer/ --surf

It is clearly off. Looks like an orientation mismatch to me:

However if I use the transform in mri_coreg it looks reasonable.

(

Also, the subject report looks good, so I don’t think there is a problem with the estimation of the transform itself.

tkregister2 is something of black magic to me, and I can’t give you good suggestions. As a vague guess, it’s possible that you need to invert the registration, as most transforms can be conceived of forwards or backwards. If you’d like to work with it, the FreeSurfer list is going to have much better feedback than I can give.

What I would do is to resample with mri_vol2surf, and see what that gets you. I’ve found the logic of these tools very predictable. Hopefully you have some simple result where you expect to see a big blob that you can project and make sure it appears correct on the surface?

I see. Thanks for the suggestion. I might try the FreeSurfer list.

Could I just get you to clarify one thing - what did you mean by

You should not use the mri_coreg or bbregister results directly, since they don’t account for differences between FreeSurfer’s T1.mgz and fMRIPrep’s output desc-preproc_T1w.nii.gz .

Are these two anatomicals not aligned with each other?

Typically they are, but if users provide pre-run FreeSurfer directories, we can’t guarantee that, so we also perform a registration to account for any differences.

It is very often the identity transform, but we don’t assume it. That bit us a while back when users might have multiple T1w images, which might be combined differently depending on the order they are entered into FreeSurfer.

Cheers Chris.

My call to tkregister2 was incorrect (I did not correctly use the lta flag). The transform looks alright with the correct args. The documentation on tkregister2 is a bit confusing, so for others’ benefit the transform can be assessed using the following tkregisterfv call:

tkregisterfv --mov /fmriprep/sub-001/ses-1/func/sub-001_ses-1_task-perceptDecouple_acq-TR1000_run-1_boldref.nii.gz --targ /fmriprep/sub-001/anat/sub-001_desc-preproc_T1w.nii.gz --reg /work_dir/fmriprep_wf/single_subject_001_wf/func_preproc_ses_1_task_perceptDecouple_acq_TR1000_run_1_wf/bold_reg_wf/bbreg_wf/concat_lta/out.lta --surf /fmriprep/sub-001/anat/sub-001_hemi-L_pial.surf.gii

I am still a bit confused though. If I manually use bbreg to estimate a transform from the boldref to the subjecst T1 it looks like this (.dat format).

2.000000
2.000000
0.150000
-1           -1.04e-04       9.15e-05     -1.76e-01 
9.15e-05      2.45e-05       1             5.5e+00 
1.03e-04     -1              2.45e-05     -7.15e-01 
0             0              0             1 

So it looks like this does some permutation of the dims.

The transform in lta_concat does not show this permutation (.dat format):

0.999998
1.000000
0.100000
-1             -5.49e-03     8.01e-03      1.49e-01 
-5.40e-03       1            1.03e-02     -1.44e+00 
 8.06e-03      -1.02e-02     1            -5.54e-01 
 0              0            0             1

Where is this difference coming from?

One thing I noticed is that the func bold_ref images (e.g. /fmriprep/sub-001/ses-1/func/sub-001_ses-1_task-perceptDecouple_acq-TR1000_run-1_boldref.nii.gz) use radiological convention, while the subj anatomical T1 (preproc_T1w) (as well as the bold T1 ref (space-T1w_boldref) use neurological convention.

Perhaps this difference in convention is taken into account in the manual bbreg I preformed but not in lta_concat?