Merge pull request #100 from bgilbert/openslide-3.4

Updates for OpenSlide 3.4.0
This commit is contained in:
John Cupitt 2014-01-26 02:25:43 -08:00
commit 07a6c74c3b
6 changed files with 42 additions and 14 deletions

View File

@ -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

View File

@ -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

View File

@ -98,7 +98,9 @@ static const char *openslide_suffs[] = {
".vms", ".vmu", ".ndpi", /* Hamamatsu */
".scn", /* Leica */
".mrxs", /* MIRAX */
".svslide", /* Sakura */
".tif", /* Trestle */
".bif", /* Ventana */
NULL
};

View File

@ -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.

View File

@ -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

View File

@ -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
};