Thanks Taylor. This is super useful!
Actually, I am confused because, to apply an affine transformation, you can simply extract the geometric matrix, multiple by the affine transformation, and then save the new geometric matrix into the header file. In this case, you avoid any resampling and maximally preserve the same resolution and the matrix size of the original file. When doesn't afni implement such regime?? In current 3dAllineate, you have to specify a master grid. Maybe I am wrong here... but it seems to make sense to me.
Thanks anyway.
Ruyuan