It took a while before I recognized that the stack dimensions are different (was this intentional?).
- 768x768
- 640x640
That’s why the ROI location is different in the second stack.
If you scale the second stack to 768x768 the locations should be equal
(However don’t do this because you change the original image data with scaling).
A simple macro correction (for the second stack) would be to correct the ROI location and size with the calculated different scale factor. Something like (select the first stack - adapt for yourself)
corr=640/768;//Calculate the correction! X,Y image size are equal!
roiManager("select", 0);//Select the first ROI!
Roi.getBounds(x,y,width,height);//Get the coordinates of the ROI!
run("Scale... ", "x="+corr+" y="+corr+" centered");//Scale the images!
setSelectionLocation(x*corr, y*corr);//Correct the location!
roiManager("add");//Add the correction to the Manager for the second stack!