Whole z-stack alignment across time? (ie stackreg, but on a z-stack)

I am looking for a plugin or solution to align a z-stack of images across time. Normally, I use StackReg on a z-projection and that works great. In this case however, I want to have all slices of the stack registered across time (the image is eventually going to Imaris, which uses the z-stack information). For example, I have a 13 z-step by 30 timepoint z-stack, where I want to correct for drift across time in all slices. Doing stackreg on each z-slice independently probably isn’t a great idea as there won’t be much structural information to use toward the edges of the stack. Note that I don’t need something to align slices in z at one time point; essentially what I want is to apply StackReg of the z-projection to each z-level of the stack across time (or some better computational method).Some things I’ve come across so far include:

-correct_3d_drift plugin, which I think theoretically does what I want, though the results on my stack weren’t great for xy drift correction. I may have included too many of the edge z-slices.
-multistackreg. I think this will do what I want as it’s essentially stackreg that saves out the transform, so I could write a macro that uses MultiStackReg on the z-projection to get the transform, then makes substacks at each z-slice of the original z-stack, applies the transform to each one, then re-stacks the slices.
-Poorman3DReg, looks like an old plugin and when I tried it it wouldn’t work on my computer, but theoretically this does what I’ve described with StackReg + apply to each z level.

Any input for existing solutions that would work better (or faster!) than this would be appreciated. Thanks.

1 Like

Hi @fredtbn1gs

I introduce an Image Plugin “CoordinateShift”.
I hope you give it a try.


Thanks. I’m not sure I understand how to make it do what I’m looking for. If I load a z-stack in the format of say, [t1 (z1-z13)] [t2 (z1-z13)] …[t30 (z1-z13)] it’s straightforward to hyperstack it correctly (c=1, t=30, z=13). Then to do the registration the way I’m looking for I’m not sure what I need to do. I assume click shift, but it’s not clear how to that works on the stack. Is there more documentation somewhere? Thanks.

@fredtbn1gs ,

It’s a feature not described in the video.
I’ll write the procedure I envision, so please try it.

1, open the image as Hyperstack.(czt stacks)

2, click Project-Z button,

3, click Shift button,
if the registration is not good, you can retry, please click “Clear_All” and change Subpixel Value (1 to 10), or change selected ROI region and so on. Then click “Shift” again. *The projection is also canceled, so retry from 2.

4, If the registration is good, click “Split-Z” button. (The projection is released while maintaining the same shift amount for all z.)

I think this will achieve the purpose, how about it?
And, If you will upload a sample data, I can try.


How is the shift calculated in your plugin? Is it using stackreg or something similar?

Were you able to align your images?

I’m not sure what method stackreg is using, but it’s probably a different methdo. The accuracy seems to be higher in StackReg, but our method seems to be faster if the image is well aligned with our method.