From fbe4d63b7e0e53f76fb4866fd3212a94c51dc144 Mon Sep 17 00:00:00 2001 From: Michael Rariden Date: Fri, 12 Jun 2026 18:57:09 -0400 Subject: [PATCH] pad 1 or 2 channel images saved in gui window .stack --- cellpose/gui/io.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cellpose/gui/io.py b/cellpose/gui/io.py index 49029ccf..f5b3b1f4 100644 --- a/cellpose/gui/io.py +++ b/cellpose/gui/io.py @@ -185,9 +185,9 @@ def _initialize_images(parent, image, load_3D=False): parent.stack /= (img_max - img_min) parent.stack *= 255 - if parent.stack.shape[-1] == 2: - parent.stack = np.concatenate((parent.stack, np.zeros((*parent.stack.shape[:-1], 1), dtype="float32")), axis=-1) - print(parent.stack.shape) + stack_chans = parent.stack.shape[-1] + if stack_chans < 3: + parent.stack = np.concatenate((parent.stack, np.zeros((*parent.stack.shape[:-1], 3-stack_chans), dtype="float32")), axis=-1) if load_3D: parent.logger.info(": converted to float and normalized values to 0.0->255.0")