3dQwarp -minpatch stops short of value

Hi AFNI Experts,
I’m using AFNI’s latest linux_openmp64 binary (19.1.08 ‘Caligula’). I ran a warp field at minpatch 11 and later used that warp field as an iniwarp parameter in 3dQwarp (via auto_warp.py by specifying options). My commands are registered and the output notes reflect all parameters were passed without issue.

3dQwarp -prefix anat.rw.qw ./anat.rw.qw.nii -inilev 9 -minpatch 7 -iniwarp /home/projects/TEST/test001/anat.rw.qw_WARP.nii -base ./base.rw.nii -source ./anat.rw.nii

It ran Lev9 - minpatch 13x17x13 Start cost 3.0602 -->End cost 1.0543
Then Lev10 - minpatch 11x11x11 Start cost 1.0543 → .46729

The warp stops here and saves out even though it did not get to 7mm patch. Is there a minimum cost function value that supercedes going to the next level (ie if .46729 is low enough it autostops short of the patch size) or is there something else potentially wrong or is the problem that if I use an initial warp field that it cannot optimize that more than the level the initial warp was created on?

I also tried inilev 10 and 11 and no difference…still stops early. Any help would be much appreciated.


Hi AFNI Experts,
I checked with AFNI version 18_2_13 (version without -lite flag) and it works fine, so it seems like with the new version (19.1.08) the minpatch willl not go to a lower resolution than what the iniwarp ended at, but still outputs a warp file. Hope this helps in the troubleshooting.


I don’t know why this is happening. I will have to try it myself. I made some changes to 3dQwarp recently, but I cannot imagine which one could cause this effect.

Since it takes a while to run 3dQwarp (as you know), it will be a little while before I can get back. And at this moment, I am in Lucca teaching AFNI, so that will slow things down as well.

So your problem is due to a change I made in the stopping criterion, that overlooked using a large maxlev. I have fixed that in the source code. But until AFNI is rebuilt, you can work around this by using the ‘-minpatch’ option to say what the smallest patch size you want is. Use ‘-inilev’ as before to specify where to start.

** bob cox

Hi Bob,
Thanks for the fix.


The source code has been rebuilt, so the fixed version should be available.