@animal_warper suddenly fails

Hi all,

I’ve been using @animal_warper with much success for a while now, but yesterday I encountered a weird error.

The first ERROR in the output reads:
** FATAL ERROR: 3dQwarp fails :: source has 0 nonzero voxels (<100)

I backtraced this and it seems that things go wrong at a an early 3dAllineate step for affine registration. The ‘shft’ and ‘psift’ volumes get generated in the ‘intermediate’ folder and look ok, but the ‘pshift_al2std’ and ‘shft_aff’ are empty files and everything after that naturally fails. In the ‘awpy_SUBJECT_pshft’ folder the ‘anat.nii’ file exists, but it’s empty (all zeros).

So, I went back to the 3dAllineate step that generates the ‘shft_aff’ and ran it manually:
3dAllineate -base NMT_v2.0_sym.nii.gz -source *_shft.nii.gz -prefix *_shft_aff.nii.gz

When I look at the files involved, the *_shft.nii.gz has moved away from the NMT volume compared to the original single-subject input. The *_pshft.nii.gz does appear center-aligned, but the resulting *_shft_aff.nii.gz is somewhere in between the original and the *_shft.nii.gz, re-gridded to NMT and thus mostly empty.

Things I tried:

  • manually aligning (translate/rotate) the single-subject to the NMTv2 before running @animal_warper so they start off close >> same results
  • updated afni binaries >> same result
  • ran with -keep_temp option to try to pinpoint the problem
  • tried a volume that previously completed >> same error >> this is particularly confusing; perhaps some other update on the system is causing problems? But what?

I could not attached the log-file as the site wouldn’t allow txt, but here it is.

Any leads on where to look next?

I did a manual translate and rotate again to bring the single subject volume close NMT and now it seems to work (running the 3dQwarp step now and intermediates look good). Still a bit confused about what’s happening, but at least we’re getting there…

Hi, Chris-

Indeed, I suspect coordinates in a galaxy far, far away might be to blame… Esp. if recentering them fixed the issue.

However, it strikes me as a bit odd that that failure didn’t happen earlier in the script, then. (Though, it might have been going awry from the initial step, and only reached a breaking point then.) I will email you about getting the original dset, if that is OK.

thanks,
pt

Thanks Paul, I suspect it’s not the realignment per se, but perhaps something else changes in this step to. If I remember correctly I first tried realigning in fsleyes and got the same error, while after realigning with https://neuroanatomy.github.io/reorient/ things ran without hick-ups. It’s probably something stupid, but it would be good to know what’s happening. I’m prepping an info package for you with exact commands and the original files.

If I do a 3dAllineate on the volume before feeding it into @animal_warper, I still get the same error.


3dAllineate -source SingleSubject.nii.gz -base NMT_v2.0_sym.nii.gz -prefix SingleSubject_al.nii.gz -cmass -warp shift_rotate -overwrite -float -newgrid 0.5

The resulting file looks good and indeed pretty well aligned with the NMT. Within @animal_warper intermediate results, the pshft file also looks good, but the shft volume moves away from the already pretty well aligned input and NMT volumes, so I guess this is where things start to move off the rails…

No leads? I haven’t been able to find the cause myself either and although it is bugging me a bit, the fact that I somehow got it working lowered the urgency for me…

Hi, Chris-

Sorry, been slowed by OHBM preparations, on top of my usual disorganization…

–pt

Hi,
I have had the exact same problem for the past few days: @animal_warper simply fails.
I also tried the above solutions and none worked–even recentering. But it seems to be about centering, which leaves some intermediate datasets void.
Any hints from AFNI experts?
Best,
Tahereh

If anyone is looking for a temporary fix, this worked for me:

  1. Used @Align_Centers to center the dataset to NMT
  2. Used the centered dataset in @animal_warper, with these options: -align_centers_meth OFF \ -aff_move_opt OFF
    The options are explained here: https://afni.nimh.nih.gov/pub/dist/doc/program_help/@animal_warper.html

Best,
Tahereh

Hello,
I am also facing the same problem
I will try your fix tomorrow, thank you
As far as I remember this recent modification was made to automatically recenter the anatomical image to the template
Something might be wrong with it.
Also, I was wondering if the scaling or shearing performed in align_epi_anat.py would modify any volume quantification performed when using VBM with on the extracted Jacobian? should I use rigid_body to avoid any quantification problem?
Thank you
Cheers
Clem

Hi, Clement-

Is your VBM run in standard space, or in subject space?

If in standard space ,all non-rigid alignment would change VBM measures, wouldn’t they, not just the affine?

If in subject space… no issues.

–pt

thanks, Paul!

I was using the shft_WARP provided by animal_warper, so I should use _shft_base2osh_WARP (this is the only WARP in the indiv space) instead in 3dNwarpFuncs? and then send the Jacobian in the template space?

I am trying to identify more precisely what is wrong with @animal_warper, I will give updates if I managed to find it, do you have any suggestions?

I just find something not normal with aff_move_opt. It seems that you can only use one option and not combine multiple one

Hello,
So, I actually find that the mistake was coming on my side (my study template was not centred on 0).
Animal_warper seems to have worked without problems on 90 macaques images… I still need to validate that precisely =)

Note that, I previously skullstrip and centred on 0 my original anatomical images before passing them into animal_warper

Just to clarify my previous question,
I plan to measure the Jacobian with 3dNwarpFuncs (from individual space to template).

Based on Paul message, I am now confused about the correct WARP for this analysis in order the measure the deformations:
Is it:
_shft_WARP.nii.gz (which would make sense to me)
or
_shft_WARP.nii.gz concatenated with _composite_linear_to_template.1D
or
_shft_base2osh_WARP (this is the only WARP in the indiv space)

or something else?

thanks!
Clément

Update,
I actually still have the problem (a few co-registration misalignments) of macaques anatomical T1 to the template (out of 90 success, not bad!)
to resume:

  • something not normal with aff_move_opt. It seems that you can only use one option and not combine multiple ones.
  • _shft.nii.gz = far from the BASE. The orientation (mostly in SI axis in my case) is not correct (not sure actually what is the command is producing this image).
    The mistake seems to happen when to orientation in the SI axis is far from the base despite that the two images are centred.
  • _shft_aff.nii.gz is almost well aligned to BASE but the little mistake generates big misalignments in the end.
  • in my case, the misalignment is in the occipital areas

I can provide images if needed

Tks!

Hi, Clément-

I’m a little confused about what you are after here.

The affine file contains parameters for global translation, rotation, shear and scaling. The WARP file contains the local displacements that get applied voxel-by-voxel.

If you want the full warp from your input dset to the template space, you want to combine *_composite_linear_to_template.1D and *_shft_WARP.nii.gz. This is what is input into afni_proc.py in most situations, as described in the help.

For the Jacobean, you certainly don’t want the global translation and rotation included (those are the rigid body parts of the transform). I guess the question is do you want the global shear and scaling from the affine, as well as the local displacements from the WARP, or just local displacements themselves?

–pt

For the Jacobean, you certainly don’t want the global translation and rotation included (those are the rigid body parts of the transform).

Sure this is what I thought, but I was confused when you said: If in subject space… no issues.

do you want the global shear and scaling from the affine, as well as the local displacements from the WARP, or just local displacements themselves?
I will try both. Thank you, but I guess that what is commonly used is _shft_WARP.nii.gz right?

Any thoughts concerning animal_warper issues?

Maybe I am confused about what the various threads were discussing. There are separate issues:

  • having alignment troubles—how to fix alignment.
  • after good alignment, deciding which affine+nonlinear files to use to apply the transformation to other datasets or for other calculations.
  • calculating a Jacobian from from an existing (good) alignment.

It would probably be best to have separate threads about separate issues.

–pt

Ok no problem, I see that the discussion is expending a little too much =)