From 837624d737a1da33962468b896682d4bbdaf97f9 Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Tue, 6 Nov 2012 20:44:29 -0500 Subject: [PATCH] aperio: Properly map associated images in single-level slides On single-level Aperio slides, we were dropping the thumbnail and label and mislabeling the macro image as the thumbnail. After encountering exactly one tiled directory, any stripped image would be interpreted as the thumbnail. Instead, interpret only the second TIFF directory as the thumbnail. Reported-and-debugged-by: Kent Johnson --- src/openslide-vendor-aperio.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/openslide-vendor-aperio.c b/src/openslide-vendor-aperio.c index 78b3d897b..3ccda222d 100644 --- a/src/openslide-vendor-aperio.c +++ b/src/openslide-vendor-aperio.c @@ -350,18 +350,19 @@ bool _openslide_try_aperio(openslide_t *osr, TIFF *tiff, TIFFSetDirectory(tiff, 0); i = 0; do { + tdir_t dir = TIFFCurrentDirectory(tiff); if (TIFFIsTiled(tiff)) { - levels[i++] = TIFFCurrentDirectory(tiff); - //g_debug("tiled directory: %d", TIFFCurrentDirectory(tiff)); + levels[i++] = dir; + //g_debug("tiled directory: %d", dir); } else { // associated image - const char *name = (i == 1) ? "thumbnail" : NULL; + const char *name = (dir == 1) ? "thumbnail" : NULL; if (!add_associated_image(osr ? osr->associated_images : NULL, name, tiff, err)) { g_prefix_error(err, "Can't read associated image: "); goto FAIL; } - //g_debug("associated image: %d", TIFFCurrentDirectory(tiff)); + //g_debug("associated image: %d", dir); } // check depth