align_epi_anat.py already saves the transformation matrices and concatenates them too. I'm not sure where you want to go with this, but consider the align_epi_anat.py options "-cost lpa" and "-child_epi". Typically, one aligns multiple runs of epi data together and then to an anatomical dataset. The script does this with 3dvolreg, 3dAllineate and cat_matvec, similar to what you have done, but the options have been worked out for most cases to find a good alignment.
Edited 1 time(s). Last edit at 08/07/2013 04:13PM by Daniel Glen.