From 19cecbd9ea58acbae7340f29dca089775d1f8cb7 Mon Sep 17 00:00:00 2001 From: Joris Van Meenen <56682641+JorisVanMeenen@users.noreply.github.com> Date: Sun, 29 Oct 2023 19:57:55 +0100 Subject: [PATCH] Update ImagesToStack.java to retain all overlays when not all images are the same size Previously it was not possible to combine multiple images of different sizes and overlays into a stack with this function. All but the overlay of the first image was lost when doing this. Now intuitive behaviour is implemented to retain all overlays when using the copy method (center or top-left). Application: e.g. labelled cells (via overlay) in a temporal stack of stitched images that slightly vary in image dimensions over time. --- ij/plugin/ImagesToStack.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ij/plugin/ImagesToStack.java b/ij/plugin/ImagesToStack.java index ec0f37295..3487212b6 100644 --- a/ij/plugin/ImagesToStack.java +++ b/ij/plugin/ImagesToStack.java @@ -199,6 +199,15 @@ private ImagePlus convert(ImagePlus[] images, int count) { } ip2.insert(ip, xoff, yoff); ip = ip2; + Overlay overlay2 = images[i].getOverlay(); + if (overlay2!=null) { + overlay2.translate(xoff, yoff); + for (int j=0; j