diff --git a/README.md b/README.md index 979fb164..820f139e 100644 --- a/README.md +++ b/README.md @@ -189,7 +189,7 @@ OpenEXR images. ## OpenSlide If available, libvips can load OpenSlide-supported virtual slide -files: Aperio, Hamamatsu VMS and VMU, Leica, MIRAX, and Trestle. +files: Aperio, Hamamatsu, Leica, MIRAX, Sakura, Trestle, and Ventana. ## swig, python, python-dev diff --git a/configure.ac b/configure.ac index 3a079bd9..183fac93 100644 --- a/configure.ac +++ b/configure.ac @@ -497,12 +497,19 @@ AC_ARG_WITH([openslide], AS_HELP_STRING([--without-openslide], [build without OpenSlide (default: test)])) if test x"$with_openslide" != x"no"; then - PKG_CHECK_MODULES(OPENSLIDE, openslide >= 3.3.0, - [AC_DEFINE(HAVE_OPENSLIDE,1,[define if you have OpenSlide >= 3.3.0 installed.]) + PKG_CHECK_MODULES(OPENSLIDE, [openslide >= 3.4.0], + [AC_DEFINE(HAVE_OPENSLIDE_3_4,1,[define if you have OpenSlide >= 3.4.0 installed.]) + AC_DEFINE(HAVE_OPENSLIDE,1,[define if you have OpenSlide >= 3.3.0 installed.]) with_openslide=yes PACKAGES_USED="$PACKAGES_USED openslide"], - [AC_MSG_WARN([OpenSlide >= 3.3.0 not found; disabling virtual slide support]) - with_openslide=no + [AC_MSG_NOTICE([OpenSlide >= 3.4.0 not found; checking for >= 3.3.0]) + PKG_CHECK_MODULES(OPENSLIDE, [openslide >= 3.3.0], + [AC_DEFINE(HAVE_OPENSLIDE,1,[define if you have OpenSlide >= 3.3.0 installed.]) + with_openslide=yes + PACKAGES_USED="$PACKAGES_USED openslide"], + [AC_MSG_WARN([OpenSlide >= 3.3.0 not found; disabling virtual slide support]) + with_openslide=no + ]) ]) fi diff --git a/libvips/deprecated/im_openslide2vips.c b/libvips/deprecated/im_openslide2vips.c index a1c27d58..105ea762 100644 --- a/libvips/deprecated/im_openslide2vips.c +++ b/libvips/deprecated/im_openslide2vips.c @@ -98,7 +98,9 @@ static const char *openslide_suffs[] = { ".vms", ".vmu", ".ndpi", /* Hamamatsu */ ".scn", /* Leica */ ".mrxs", /* MIRAX */ + ".svslide", /* Sakura */ ".tif", /* Trestle */ + ".bif", /* Ventana */ NULL }; diff --git a/libvips/foreign/foreign.c b/libvips/foreign/foreign.c index 09e262d9..eb91a9b8 100644 --- a/libvips/foreign/foreign.c +++ b/libvips/foreign/foreign.c @@ -2357,18 +2357,17 @@ vips_openexrload( const char *filename, VipsImage **out, ... ) * * Optional arguments: * - * @layer: load this layer + * @level: load this level * @associated: load this associated image * * Read a virtual slide supported by the OpenSlide library into a VIPS image. - * OpenSlide supports images in Aperio, Hamamatsu VMS, Hamamatsu VMU, MIRAX, - * and Trestle formats. + * OpenSlide supports images in Aperio, Hamamatsu, MIRAX, Sakura, Trestle, + * and Ventana formats. * * To facilitate zooming, virtual slide formats include multiple scaled-down * versions of the high-resolution image. These are typically called - * "levels", though OpenSlide and im_openslide2vips() call them "layers". - * By default, vips_openslideload() reads the highest-resolution layer - * (layer 0). Set @layer to the layer number you want. + * "levels". By default, vips_openslideload() reads the highest-resolution + * level (level 0). Set @level to the level number you want. * * In addition to the slide image itself, virtual slide formats sometimes * include additional images, such as a scan of the slide's barcode. diff --git a/libvips/foreign/openslide2vips.c b/libvips/foreign/openslide2vips.c index 59ccd931..e68c6da8 100644 --- a/libvips/foreign/openslide2vips.c +++ b/libvips/foreign/openslide2vips.c @@ -2,7 +2,7 @@ * * Benjamin Gilbert * - * Copyright (c) 2011-2012 Carnegie Mellon University + * Copyright (c) 2011-2014 Carnegie Mellon University * * 26/11/11 * - initial version @@ -39,6 +39,8 @@ * - use threaded tile cache * 6/8/13 * - always output solid (not transparent) pixels + * 25/1/14 + * - use openslide_detect_vendor() on >= 3.4.0 */ /* @@ -105,13 +107,28 @@ typedef struct { int vips__openslide_isslide( const char *filename ) { +#ifdef HAVE_OPENSLIDE_3_4 + const char *vendor; + int ok; + + vendor = openslide_detect_vendor( filename ); + + /* Generic tiled tiff images can be opened by openslide as well. + * Only offer to load this file if it's not a generic tiff since + * we want vips_tiffload() to handle these. + */ + ok = ( vendor && + strcmp( vendor, "generic-tiff" ) != 0 ); + + VIPS_DEBUG_MSG( "vips__openslide_isslide: %s - %d\n", filename, ok ); + + return( ok ); +#else openslide_t *osr; int ok; ok = 0; - vips_error_freeze(); osr = openslide_open( filename ); - vips_error_thaw(); if( osr ) { const char *vendor; @@ -135,6 +152,7 @@ vips__openslide_isslide( const char *filename ) VIPS_DEBUG_MSG( "vips__openslide_isslide: %s - %d\n", filename, ok ); return( ok ); +#endif } static void diff --git a/libvips/foreign/openslideload.c b/libvips/foreign/openslideload.c index 4d52301b..dc44d037 100644 --- a/libvips/foreign/openslideload.c +++ b/libvips/foreign/openslideload.c @@ -140,7 +140,9 @@ static const char *vips_foreign_openslide_suffs[] = { ".vms", ".vmu", ".ndpi", /* Hamamatsu */ ".scn", /* Leica */ ".mrxs", /* MIRAX */ + ".svslide", /* Sakura */ ".tif", /* Trestle */ + ".bif", /* Ventana */ NULL };