From c7e51381281e3dc8251b2e47bc8dd68d6e99f35c Mon Sep 17 00:00:00 2001 From: Melissa Linkert Date: Tue, 28 Jan 2025 16:25:31 -0600 Subject: [PATCH] InCell: allow mix of 2D and 3D channels to be treated as a Z stack --- .../formats-gpl/src/loci/formats/in/InCellReader.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/components/formats-gpl/src/loci/formats/in/InCellReader.java b/components/formats-gpl/src/loci/formats/in/InCellReader.java index 2c8cdd988ac..ffc46025192 100644 --- a/components/formats-gpl/src/loci/formats/in/InCellReader.java +++ b/components/formats-gpl/src/loci/formats/in/InCellReader.java @@ -464,7 +464,8 @@ protected void initFile(String id) throws FormatException, IOException { } int expectedSeries = totalImages / (getSizeZ() * getSizeC() * getSizeT()); if (expectedSeries > 0) { - seriesCount = (int) Math.min(seriesCount, expectedSeries); + LOGGER.warn("Using series count {} but plane count indicates {}", + seriesCount, expectedSeries); } } else seriesCount = totalImages / (getSizeZ() * getSizeC() * getSizeT()); @@ -791,7 +792,7 @@ class MinimalInCellHandler extends BaseHandler { private int wellRow, wellCol; private int nChannels = 0; private boolean doT = true; - private boolean doZ = true; + private Boolean doZ = null; private Image lastImage = null; @Override @@ -908,7 +909,11 @@ else if (qName.equals("Wavelength")) { String fusion = attributes.getValue("fusion_wave"); if (fusion.equals("false")) ms0.sizeC++; String mode = attributes.getValue("imaging_mode"); - if (mode != null) { + + // different wavelengths (channels) may have different imaging modes + // we want to allow a Z stack if one or more "3-D" imaging modes + // are encountered, even if some are variations on "2-D" + if (mode != null && (doZ == null || !doZ)) { doZ = mode.equals("3-D"); } }