From 1bf9c71108db931bb850a79dc1b50d1245b75266 Mon Sep 17 00:00:00 2001 From: Melissa Linkert Date: Tue, 12 May 2020 22:09:18 -0500 Subject: [PATCH 1/2] Pad tile height if needed Tiles in the bottom row will now be the same size as all other tiles. See https://github.com/glencoesoftware/bioformats2raw/issues/35 --- .../pyramid/PyramidFromDirectoryWriter.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/glencoesoftware/pyramid/PyramidFromDirectoryWriter.java b/src/main/java/com/glencoesoftware/pyramid/PyramidFromDirectoryWriter.java index e75359b..3a78585 100755 --- a/src/main/java/com/glencoesoftware/pyramid/PyramidFromDirectoryWriter.java +++ b/src/main/java/com/glencoesoftware/pyramid/PyramidFromDirectoryWriter.java @@ -709,15 +709,17 @@ private void convertPyramid(PyramidSeries s) Slf4JStopWatch t1 = new Slf4JStopWatch("writeTile"); try { if (tileBytes != null) { - if (region.width == descriptor.tileSizeX) { + if (region.width == descriptor.tileSizeX && + region.height == descriptor.tileSizeY) + { writeTile(s, currentPlane, tileBytes, currentIndex, currentResolution); } else { - // pad the tile to the correct width + // pad the tile to the correct width and height int paddedHeight = tileBytes.length / region.width; byte[] realTile = - new byte[descriptor.tileSizeX * paddedHeight]; + new byte[descriptor.tileSizeX * descriptor.tileSizeY]; int totalRows = region.height; int inRowLen = tileBytes.length / totalRows; int outRowLen = realTile.length / totalRows; From e55066cf8128b394bad70a4ec9e6e32b56dea1ee Mon Sep 17 00:00:00 2001 From: Chris Allan Date: Sun, 17 May 2020 16:23:42 +0100 Subject: [PATCH 2/2] Remove unused variable, update comment --- .../glencoesoftware/pyramid/PyramidFromDirectoryWriter.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/com/glencoesoftware/pyramid/PyramidFromDirectoryWriter.java b/src/main/java/com/glencoesoftware/pyramid/PyramidFromDirectoryWriter.java index 3a78585..fcaa43a 100755 --- a/src/main/java/com/glencoesoftware/pyramid/PyramidFromDirectoryWriter.java +++ b/src/main/java/com/glencoesoftware/pyramid/PyramidFromDirectoryWriter.java @@ -716,8 +716,7 @@ private void convertPyramid(PyramidSeries s) currentIndex, currentResolution); } else { - // pad the tile to the correct width and height - int paddedHeight = tileBytes.length / region.width; + // padded tile, use descriptor X and Y tile size byte[] realTile = new byte[descriptor.tileSizeX * descriptor.tileSizeY]; int totalRows = region.height;