diff --git a/components/formats-gpl/src/loci/formats/in/OIRReader.java b/components/formats-gpl/src/loci/formats/in/OIRReader.java index cb5b0883427..7fae5bc34f2 100644 --- a/components/formats-gpl/src/loci/formats/in/OIRReader.java +++ b/components/formats-gpl/src/loci/formats/in/OIRReader.java @@ -195,7 +195,7 @@ public byte[] openBytes(int no, byte[] buf, int x, int y, int w, int h) lastChannel = zct[1]; // Gets all the PixelBlock potentially contained within c, z and t - PixelBlock[] blocks = cztToPixelBlocks.get(new CZTKey((zct[1] % channels.size()), zct[0], zct[2])); + PixelBlock[] blocks = cztToPixelBlocks.get(new CZTKey(zct[1], zct[0], zct[2])); if ((blocks == null) || (blocks.length == 0)) { LOGGER.warn("No pixel blocks for plane #{}", no); @@ -412,8 +412,9 @@ else if (!checkSuffix(id, "oir")) { for (String uid: pixelBlocks.keySet()) { int z = getZ(uid)-minZ; int t = getT(uid)-minT; - int c = getC(uid); + int c = getC(uid) + getL(uid); // Channel index or lambda index (We suppose there's no multichannel + lambda); int b = getBlock(uid); + CZTKey key = new CZTKey(c,z,t); if (!cztToPixelBlocks.containsKey(key)) cztToPixelBlocks.put(key, new PixelBlock[maxNumberOfBlocks]); PixelBlock pb = pixelBlocks.get(uid); @@ -1536,6 +1537,14 @@ private int getBlock(String uid) { return Integer.parseInt(uid.substring(index + 1)); } + private int getL(String uid) { + // for example l001z001t001_0_1_93e4632f-0342-4d98-bdc1-4ce305b92525_46 + // Assumes l is always first is the uid... + if (!uid.startsWith("l")) return 0; + // ... and has 3 digits + return Integer.parseInt(uid.substring(1, 4)) - 1; + } + private boolean isCurrentFile(String file) { String currentPath = new Location(currentId).getAbsolutePath(); return currentPath.equals(new Location(file).getAbsolutePath());