Skip to content

Commit 19cecbd

Browse files
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.
1 parent 05cbc4f commit 19cecbd

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ij/plugin/ImagesToStack.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,15 @@ private ImagePlus convert(ImagePlus[] images, int count) {
199199
}
200200
ip2.insert(ip, xoff, yoff);
201201
ip = ip2;
202+
Overlay overlay2 = images[i].getOverlay();
203+
if (overlay2!=null) {
204+
overlay2.translate(xoff, yoff);
205+
for (int j=0; j<overlay2.size(); j++) {
206+
Roi roi = overlay2.get(j);
207+
roi.setPosition(i+1);
208+
overlay.add((Roi)roi.clone());
209+
}
210+
}
202211
break;
203212
case SCALE_SMALL: case SCALE_LARGE:
204213
ip.setInterpolationMethod((bicubic?ImageProcessor.BICUBIC:ImageProcessor.BILINEAR));

0 commit comments

Comments
 (0)