StackReg Registration creates black borders which complicates image segmentation

Hi all. Im successfully implementing StackReg through matlab on my data, and its working very well to counter movement in XY and Z dimensions during acquisition of a single time point. The problem is that in doing so it creates changing black borders around the image, which make too high a contrast for the later steps of segmentation. Is there a way to turn these black pixels to grey? Or other solutions for this?

Place the stack before registration in the center of a wider/higher stack and see what colour works best for you. After registration clip to the original size if necessary. Alternatively get the transformation matrix (see this post) and use that to do your own transformation with desired colours as fill.

1 Like