use openslide_detect_vendor() on OpenSlide 3.4.0
It is much more efficient than openslide_open(). It also fixes a bug: If openslide_open() failed, we had no way of knowing whether it was an interesting failure (for relevant slide formats) or an uninteresting one (for a generic TIFF). So, the is_a method would always return false in this case. This could cause unexpected results; for example, on MIRAX slides, VIPS would open the .mrxs file itself (a JPEG thumbnail) and the user would be left wondering where all their pixels went. Now, if there is an interesting failure, is_a will succeed but header/load will fail.
This commit is contained in:
parent
2e8d014811
commit
ebf4fb807b
15
configure.ac
15
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
|
||||
|
||||
|
@ -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,6 +107,23 @@ 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;
|
||||
|
||||
@ -133,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
|
||||
|
Loading…
Reference in New Issue
Block a user