Different anat to func alignment results with different orientations of func data.

Hi,

I am using align_epi_anat.py to align the anatomical image (anat) to the EPI images (func) as a intermediate step of warping the func data to the standard space. I noticed that the different orientations of the input func data to align_epi_anat.py would make different outputs, i.e. different aligned anat image and different transform matrices. I did some search online about why that would happen, but I didn’t find any similar issues posted before. Please let me know if I missed something.

Here is the more detailed description of the issue. After dicom reconstruction, the orientation of my func data is RAI, and the orientation of my anat data is LPI. Let [func] be the name of my func data and [anat] be the name of my anat data, I used the following command to align the anat to the func:

align_epi_anat.py -anat [anat] -epi [func] -epi_base 0 -anat2epi -suffix _al -anat_has_skull no -volreg off -tshift off -Allineate_opts -warp shift_rotate -cost lpc+ZZ

The output transform matrix (with the suffix *aff12.1D) I got is the following:

3dAllineate matrices (DICOM-to-DICOM, row-by-row):

  0.999877   -0.00685082    -0.0141272     -0.834526    0.00702079      0.999903     0.0120176      0.136856     0.0140435    -0.0121153      0.999828     -0.433617

Then, I re-orient the fun data by using the command 3dresample:
3dresample -oriet LPI -prefix [func_rs] -input [func]
I aligned the anat to the re-oriented func using the same command:

align_epi_anat.py -anat [anat] -epi [func_rs] -epi_base 0 -anat2epi -suffix _al -anat_has_skull no -volreg off -tshift off -Allineate_opts -warp shift_rotate -cost lpc+ZZ

The output transform matrix (with the suffix *aff12.1D) I got is the following:

3dAllineate matrices (DICOM-to-DICOM, row-by-row):

  0.999988    -0.0030592   -0.00391642      -1.38792    0.00307867      0.999983    0.00497563      0.400688    0.00390113   -0.00498763       0.99998     -0.494812

I have two questions here:

  1. Why changing the orientation of the func data would affect the output of the alignment?
  2. Dose it mean we need to make the func data and the anat data have the same orientation before doing the alignment?

Thanks in advance.

Sincerely,
Yixiang

Hi, Yixiang-

Thanks for noticing+mentioning this.

It turns out that some resamplings were not being done correctly. There was effectively a perturbation in a subset of them at a scale that wasn’t visually obvious in a dset (and hence unnoticed). That has been fixed, and we rebuilt the binaries last night.

So, if you run the following to update your AFNI binaries:


@update.afni.binaries -d

… that should resolve this issue. (Please let us know if it doesn’t…)

Again, thanks for pointing this out!

–pt

Hi Taylor

Thank you very much for fixing that! I updated the AFNI and ran the aligment again. This time, the transform matrices I got were very similar (but not identical). Just to double check, is the slight difference expected?

With func data in RAI and anat data in LPI, the output transform matrix (with the suffix *aff12.1D) I got is the following:

3dAllineate matrices (DICOM-to-DICOM, row-by-row):

  0.999988   -0.00304018   -0.00376777      -1.39793    0.00306135      0.999979    0.00562626      0.387321    0.00375059   -0.00563773      0.999977     -0.501152

With func data in LPI and anat data in LPI, the output transform matrix (with the suffix *aff12.1D) I got is the following:

3dAllineate matrices (DICOM-to-DICOM, row-by-row):

  0.999988   -0.00306805   -0.00372596      -1.39896    0.00308895      0.999979    0.00561664      0.387924    0.00370865   -0.00562809      0.999977     -0.502632

Sincerely,
Yixiang

Hi, Yixiang-

Yes, very similar but not exactly the same would be expected, probably from most re-runs of alignment—it is a stochastic process, meaning randomness is involved.

These close numbers such the result is stable: most differences are in the 4th decimal place or higher. Recall also that the voxel/grid size is of order 1, so very much larger than this. Based on the high similarly, I think if you overlay the output results, they should be essentially the same here (if not indistinguishable).

–pt

Hi Taylor

Thank you for your reply! I looked at the aligned anatomical images, and they are very close (the image intensity is ~700 and the difference is abouy ~0.1).

Sincerely,
Yixiang