diff --git a/components/formats-bsd/src/loci/formats/dicom/DicomTile.java b/components/formats-bsd/src/loci/formats/dicom/DicomTile.java index 569998bc51e..0c67ea8a3d1 100644 --- a/components/formats-bsd/src/loci/formats/dicom/DicomTile.java +++ b/components/formats-bsd/src/loci/formats/dicom/DicomTile.java @@ -47,6 +47,7 @@ public class DicomTile { public Double zOffset; public int channel; public boolean last = false; + public int planeIndex = -1; public boolean isJP2K = false; public boolean isJPEG = false; diff --git a/components/formats-bsd/src/loci/formats/in/DicomReader.java b/components/formats-bsd/src/loci/formats/in/DicomReader.java index d6f3db5dbe4..240b221ab76 100644 --- a/components/formats-bsd/src/loci/formats/in/DicomReader.java +++ b/components/formats-bsd/src/loci/formats/in/DicomReader.java @@ -172,7 +172,6 @@ public int getTileColumns(int no) { public byte[] openCompressedBytes(int no, int x, int y) throws FormatException, IOException { FormatTools.assertId(currentId, true, 1); - // TODO: this will result in a lot of redundant lookups, and should be optimized int tileWidth = getOptimalTileWidth(); int tileHeight = getOptimalTileHeight(); Region boundingBox = new Region(x * tileWidth, y * tileHeight, tileWidth, tileHeight); @@ -860,7 +859,7 @@ else if (child.attribute == OPTICAL_PATH_DESCRIPTION) { for (int p=0; p getTileList(int no, Region boundingBox, boolean firstTileOnly) { - int z = getZCTCoords(no)[0]; - int c = getZCTCoords(no)[1]; - + public List getTileList(int no, Region boundingBox, boolean firstTileOnly) { List tileList = new ArrayList(); if (!tilePositions.containsKey(getCoreIndex())) { LOGGER.warn("No tiles for core index = {}", getCoreIndex()); @@ -1718,14 +1721,10 @@ private List getTileList(int no, Region boundingBox, boolean firstTil } // look for any tiles that match the requested tile and plane - List zs = zOffsets.get(getCoreIndex()); - List tiles = tilePositions.get(getCoreIndex()); - for (int t=0; t getTileList(int no, Region boundingBox, boolean firstTil return tileList; } + private void calculateTilePlaneIndexes() { + List zs = zOffsets.get(getCoreIndex()); + List tiles = getTiles(getCoreIndex()); + for (int t=0; t getTiles() { - return tilePositions.get(0); + return getTiles(0); + } + + public List getTiles(int coreIndex) { + if (tilePositions.containsKey(coreIndex)) { + return tilePositions.get(coreIndex); + } + return new ArrayList(); } public List getZOffsets() { - return zOffsets.get(0); + return getZOffsets(0); + } + + public List getZOffsets(int coreIndex) { + return zOffsets.get(coreIndex); } public int getConcatenationIndex() {