diff --git a/cellpose/models.py b/cellpose/models.py index e6329ec5..c10aab87 100644 --- a/cellpose/models.py +++ b/cellpose/models.py @@ -155,6 +155,7 @@ def eval(self, x, batch_size=8, channels=None, channel_axis=None, invert=False, tic0 = time.time() channels = [0, 0] if channels is None else channels + models_logger.warning("channels not specified, using [0,0] (grayscale + no nuclei)") diam0 = diameter[0] if isinstance(diameter, (np.ndarray, list)) else diameter estimate_size = True if (diameter is None or diam0 == 0) else False @@ -539,6 +540,9 @@ def _run_cp(self, x, compute_masks=True, normalize=True, invert=False, niter=Non masks = utils.stitch3D(masks, stitch_threshold=stitch_threshold) masks = utils.fill_holes_and_remove_small_masks( masks, min_size=min_size) + elif nimg > 1: + models_logger.warning("3D stack used, but stitch_threshold=0 and do_3D=False, so masks are made per plane only") + flow_time = time.time() - tic if nimg > 1: diff --git a/cellpose/transforms.py b/cellpose/transforms.py index 0d5f994e..46d36608 100644 --- a/cellpose/transforms.py +++ b/cellpose/transforms.py @@ -520,9 +520,9 @@ def convert_image(x, channels, channel_axis=None, z_axis=None, do_3D=False, ncha % (nchan, nchan)) x = x[..., :nchan] - if not do_3D and x.ndim > 3: - transforms_logger.critical("ERROR: cannot process 4D images in 2D mode") - raise ValueError("ERROR: cannot process 4D images in 2D mode") + #if not do_3D and x.ndim > 3: + # transforms_logger.critical("ERROR: cannot process 4D images in 2D mode") + # raise ValueError("ERROR: cannot process 4D images in 2D mode") if nchan is not None and x.shape[-1] < nchan: x = np.concatenate((x, np.tile(np.zeros_like(x), (1, 1, nchan - 1))),