Problem aligning T1w anatomical to EPI with partial coverage

Hi there,

I've been trying to align a subject's T1w anatomical to their EPI (using align_epi_anat.py via afni_proc.py). The alignment finishes successfully but is not anywhere near the right ballpark upon visual check. The EPIs are partial coverage (posterior half of the brain) and 3dinfo does not detect any obliquity in either the T1w or the EPIs. The T1w and EPI volumes do appear to be starting quite far apart.

@djunct_overlap_check \
  -ulay T1w+orig \
  -olay vr_base_min_outlier+orig \
  -prefix img_overlap

I've tried using different cost functions in the call to align_anat_epi.py (like lpa lpc+ZZ) as well as different *moves (like giant_move, ginormous_move) but to no avail. I also tried zero-padding the EPI data, like so

3dZeropad -A 30 -prefix epi1_padded.nii.gz epi1.nii.gz

but that didn't help either.

Do you have any advice that would help bring these volumes into alignment?

Thank you!
Daniel

My most recent call to align_epi_anat.py

align_epi_anat.py -anat2epi -anat mr_T1w+orig                           \
       -save_skullstrip -suffix _al_junk                                \
       -epi vr_base_min_outlier+orig -epi_base 0                        \
       -epi_strip 3dAutomask                                            \
       -cost lpc+ZZ -check_flip -partial_axial -Allineate_opts -twopass \
       -maxrot 30 -maxshf 40                                            \
       -volreg off -tshift off

AFNI version info (afni -ver): 23.3.12

Hi Daniel-

Partial data is tricky!

Generally the most helpful thing that I've found is to use 3drefit or the AFNI nudge plugin to "nudge" the data into rough alignment before running your alignment command. Very old blog post about that here.

Alternatively you could use something like ITK-SNAP to get the EPI and anatomical into roughly the right alignment. This tutorial video by Renzo Huber might be helpful.

To avoid multiple interpolations, I would suggest you save the modified anatomical dataset from ITK-SNAP (not the EPI) and then let AFNI do the rest of the fine EPI-to-anatomical alignment from there (likely without any -big_move or -giant_move) in your later pipeline.

Let me know if you have further questions and can try to debug more from there.

-Pete

Thanks, Pete! I tried the route of using ITK-SNAP to first get the anatomical into rough alignment with the EPI (that video by Renzo Huber was very helpful indeed). I used ITK-SNAP's manual registration tab to visually align the anatomical to a zero-padded and upsampled mean EPI image, then applied the transform and saved the 'resliced' anatomical as a new nifti file. Finally, I passed that new anatomical file to AFNI for the full anatomical-to-EPI alignment (without any big_move or giant_move).

The QC report showed the initial overlap was indeed quite good

However, the final alignment is still quite obviously wrong. The anatomical and EPI volumes appear to be centered over each other rather than aligned properly.

Do you have any other suggestions to help troubleshoot this? Below is the alignment section from my processing script

align_epi_anat.py -anat2epi -anat mr_T1w_resliced+orig \
       -save_skullstrip -suffix _al_junk               \
       -epi vr_base_min_outlier+orig -epi_base 0       \
       -epi_strip 3dAutomask                           \
       -cost lpc+ZZ -check_flip -partial_axial         \
       -volreg off -tshift off

Solid progress! Just to verify - the resliced anatomical in AFNI looks to mostly overlap with the EPI? Sometimes there's an oblique shift that happens.

My feeling is that the -partial_axial option trigging a -cmass centering. You might have more luck with -partial_coronal. And if that fails you could try getting rid of the centering with the option:

-cmass nocmass

If those fail, happy to direct message and see if we can tweak the data into place. Are you eventually planning to use a full afni_proc.py pipeline for these data?

1 Like

Hi Pete, I was able to successfully align all my data using your advice. I think the key points were to get the functional and anatomical volumes manually aligned as closely as possible prior to running the alignment command in afni (easier said than done in some cases!); Also, turn off the centering. I can't thank you enough for your help here!

2 Likes