How to apply atlas masks to normalized EPI images in SPM

Dear Experts,

I successfully normalized EPI images to spm12\toolbox\OldNorm\EPI.nii.
Based on some literature, normalization should work also without anatomical images and the results look good.

If I check the result with ‘MRIcro’ or the SPM tool ‘Check Reg’ by comparing it to an atlas, everything looks good:

However, the images are not exactly in the same space, especially since there is more empty space around the AAL3 atlas. Therefore, I cannot apply the masks to the data in a straightforward manner.

My question is probably rather simple: How do I now use Matlab/SPM (ideally in a scripted manner) to apply masks of the differen regions to the data?

Thank you!

Would this help?

Thank you!

This script does not look like it is doing any sort of transformation. In this image I highlight Index 19 of AAL3 and it should end up at the border of the brain, not inside of it:

To again illustrate the problem again, here you see my data and the AAL3 atlas:

So you can see how much more empty space there is around the atlas than around spm12\toolbox\OldNorm\EPI.nii (which I used for normalization).

And I am looking for a way to apply the rois from the atlas to this data.