Skip to content

Commit

Permalink
NDPI: fix tile size and precompressed tile reading for extra images
Browse files Browse the repository at this point in the history
  • Loading branch information
melissalinkert committed Apr 12, 2024
1 parent b78a93f commit b94bed3
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions components/formats-gpl/src/loci/formats/in/NDPIReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,14 @@ public byte[] openCompressedBytes(int no, byte[] buf, int x, int y) throws Forma
IFD ifd = ifds.get(ifdIndex);

if (useTiffParser(ifd)) {
return copyTile(ifd, buf, x, y);
try (RandomAccessInputStream s = new RandomAccessInputStream(currentId)) {
tiffParser = new TiffParser(s);
tiffParser.setUse64BitOffsets(true);
return copyTile(ifd, buf, x, y);
}
finally {
tiffParser.getStream().close();
}
}

if (initializedSeries != getCoreIndex() || initializedPlane != no) {
Expand Down Expand Up @@ -352,8 +359,7 @@ public int getOptimalTileWidth() {
IFD ifd = ifds.get(ifdIndex);
try {
if (useTiffParser(ifd)) {
// TODO:
return 1024;
return (int) ifd.getTileWidth();
}

if (initializedSeries != getCoreIndex() || initializedPlane != no) {
Expand All @@ -379,8 +385,7 @@ public int getOptimalTileHeight() {
IFD ifd = ifds.get(ifdIndex);
try {
if (useTiffParser(ifd)) {
// TODO:
return 1024;
return (int) ifd.getTileLength();
}

if (initializedSeries != getCoreIndex() || initializedPlane != no) {
Expand Down

0 comments on commit b94bed3

Please sign in to comment.