The box for the AFNI warped datasets (+acpc or +tlrc) is computed in afni.c function
AFNI_init_warp(). In particular, cf. lines 9047-9210. The actual new (nx,ny,nz) values are at lines 9204-9206 in the current source code (assignments to variables cleverly named
new_nx, etc.).
Perhaps there is a rounding issue -- some datasets computing new_ny as 275.99 and some as 276.01 -- and then the truncation to int is causing the discrepancy? Some quickie debug printouts should settle that issue with your datasets. The calculation in line 9205 is
new_ny = (xnew_top.xyz[1] - xnew_bot.xyz[1])/resam_vox + 1.5 ;
where
resam_vox is the grid spacing desired in the new dataset, and the
xnew_*.xyz[1] values are the min and max voxel center y-coordinates (-y=A, +y=P; for the new +acpc dataset these values are from the ATLAS_ALIGNBOX_* constants, as you deduced, my dear Watson). We would want in the ideal world
(new_ny-1)*resam_vox==(xnew_top.xyz[1] - xnew_bot.xyz[1]); the extrac +0.5 is to convert the (implicit) cast from float to int in the assignment into a rounding operation.
bob cox