3dAllineate fails - called from align_epi_anat.py

I was running a script generated by afni_proc.py for some 7T scan data and the script fails at the align_epi_anat.py step. Here is the command:

align_epi_anat.py -anat2epi -anat anatSS.XXX+orig
-save_skullstrip -suffix _al_junk
-anat_has_skull no
-epi vr_base_min_outlier+orig -epi_base 0
-epi_strip 3dAutomask
-volreg off -tshift off

The anat is the mprage results from running SSWarper and is deskulled. This is the failure message:

** FATAL ERROR:^[[0m 3dAllineate fails :: base image has only 0 nonzero voxels (< 100)

I saw an older post with a similar message which was due to a center misalignment so here are the 3dinfo on the 2 input images:

3dinfo anatSS.XXX+orig.HEAD |grep extent
++ 3dinfo: AFNI version=AFNI_22.0.09 (Feb 10 2022) [64-bit]
R-to-L extent: -64.036 [R] -to- 91.214 [L] -step- 0.750 mm [208 voxels]
A-to-P extent: -106.600 [A] -to- 96.763 [P] -step- 0.637 mm [320 voxels]
I-to-S extent: -101.546 [I] -to- 101.817 [S] -step- 0.637 mm [320 voxels]

3dinfo vr_base_min_outlier+orig.HEAD |grep extent
++ 3dinfo: AFNI version=AFNI_22.0.09 (Feb 10 2022) [64-bit]
R-to-L extent: -78.663 [R] -to- 83.837 [L] -step- 2.500 mm [ 66 voxels]
A-to-P extent: -126.300 [A] -to- 91.700 [P] -step- 2.000 mm [110 voxels]
I-to-S extent: -109.816 [I] -to- 108.184 [S] -step- 2.000 mm [110 voxels]

The 2 centers for the scans do not seem to be that far out center. I did notice a tilt difference between the anat and vr_base image.

I am not sure how to resolve this.

If the data is very oblique, then the grid of the input anatomical dataset may not show any voxels once it is moved to the EPI grid. You may want to use -giant_move or provide a -master_anat dataset. For -master_anat, you can provide special strings like MIN_DXYZ, BASE or the name of a dataset that is approximately on the grid of the EPI dataset with the anatomical resolution. One way to do this is with :

3dWarp -card2oblique myEPIdset.nii.gz -prefix myAnatOb.nii.gz myAnat.nii.gz

then use -master_anat myAnatOb.nii.gz

Another way is to throw out all the obliquity altogether with 3drefit -deoblique on the datasets. So there are at least three approaches. Let me know which one works for you.

Perhaps consider “3drefit -oblique_recenter” rather than “3drefit -deoblique”.
This command will probably more closely (and appropriately) match the centers without resampling the data.

But make backup copies of the datasets first, since 3drefit is meant to alter the current dataset.

  • rick

The “3drefit -oblique_recenter” or “3drefit -deoblique” command should be run on the starting original images not the computed one (vr_base_min_outlier) is that correct? Thanks for the suggestions.

Mike

I ran 3drefit -oblique_recenter on the EPI starting image and something does not look right to me.

3dinfo ANA+orig.HEAD|grep extent (Modified EPI image - ran 3drefit)
++ 3dinfo: AFNI version=AFNI_22.0.09 (Feb 10 2022) [64-bit]
R-to-L extent: 82.500 [L] -to- 245.000 [L] -step- 2.500 mm [ 66 voxels]
A-to-P extent: -124.000 [A] -to- 94.000 [P] -step- 2.000 mm [110 voxels]
I-to-S extent: -110.000 [I] -to- 108.000 [S] -step- 2.000 mm [110 voxels]

3dinfo orig/ANA+orig.HEAD |grep extent (Unmodified EPI image)
++ 3dinfo: AFNI version=AFNI_22.0.09 (Feb 10 2022) [64-bit]
R-to-L extent: -78.663 [R] -to- 83.837 [L] -step- 2.500 mm [ 66 voxels]
A-to-P extent: -126.300 [A] -to- 91.700 [P] -step- 2.000 mm [110 voxels]
I-to-S extent: -109.816 [I] -to- 108.184 [S] -step- 2.000 mm [110 voxels]

The R-to-L extent in the “corrected” one looks incorrect to me.

As a test, what happens if you use “3drefit -oblique_origin” on a copy of the original dataset?

This is what I got:

3dinfo ANA+orig.HEAD|grep extent
++ 3dinfo: AFNI version=AFNI_22.0.09 (Feb 10 2022) [64-bit]
R-to-L extent: -226.044 [R] -to- -63.544 [R] -step- 2.500 mm [ 66 voxels]
A-to-P extent: -134.651 [A] -to- 83.349 [P] -step- 2.000 mm [110 voxels]
I-to-S extent: -109.816 [I] -to- 108.184 [S] -step- 2.000 mm [110 voxels]

I tried adding the “-giant_move” to the align_epi_anat.py script and that seemed to allow the EPI to align to the anat properly.

Mike

Great! Thanks for the follow-up.