StackReg zero padding

I am using stackreg for image registration of a multichannel stack of 512*512 images. I planned to correct images from other channels based on the stackreg transformation matrix output of the reference channel images. But StackReg ouput for the reference channel images are zero padded in some frames. So, although, the transformation matrices are obtained, the images from different channels are not well aligned.
Here is an example,
StackReg does rigid correction on the input image and outputs the below image:

As you can see, it is zero padded in the first few rows and columns of pixels.
So, my workflow is this:

  1. Apply StackReg to a 3d image stack belonging to the reference channel.
  2. Get the transformation matrices for each of the 2d image in the above stack.
  3. Apply the matrices to another 3d image stack of another channel.

I use TransformJ to apply each frame’s transformation matrix obtained from StackReg to other channel’s images.Obviously, the alignment between the images from different channels is not good due to this zero padding issue.
Any idea how to overcome this ?


The creator of the StackReg plugin (Philippe Thévenaz) does not frequent this forum… You might be better off writing to the ImageJ mailing list and CC him directly in your mail.

If you get an answer there… can you report it back here to help others in the future? Would be great!


Try cropping the stack to get rid of the zeros around the edge. The strong edges of the zero padding will no doubt affect the alignment algorighm.


thanks,i did try this briefly, although it turned out more complicated and time consuming than i thought at first.
I think MultiStackReg does something similar as internally it calls StackReg code and TurboReg plugin.It will be helpful to see how MultiStackReg handles this problem of zero padding.

yes,let me try this.thanks