Merge remote-tracking branch 'origin/master' into colour
This commit is contained in:
commit
59513b6869
@ -482,11 +482,11 @@ 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.2.5,
|
||||
[AC_DEFINE(HAVE_OPENSLIDE,1,[define if you have OpenSlide >= 3.2.5 installed.])
|
||||
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.2.5 not found; disabling virtual slide support])
|
||||
[AC_MSG_WARN([OpenSlide >= 3.3.0 not found; disabling virtual slide support])
|
||||
with_openslide=no
|
||||
])
|
||||
fi
|
||||
@ -748,7 +748,7 @@ accelerate loops with orc: $with_orc
|
||||
ICC profile support with lcms: $with_lcms
|
||||
file import with OpenEXR: $with_OpenEXR
|
||||
file import with OpenSlide: $with_openslide
|
||||
(requires openslide-3.2.5 or later)
|
||||
(requires openslide-3.3.0 or later)
|
||||
file import with matio: $with_matio
|
||||
file import with cfitsio: $with_cfitsio
|
||||
text rendering with pangoft2: $with_pangoft2
|
||||
|
@ -4,6 +4,8 @@
|
||||
* - just a stub
|
||||
* 11/4/12
|
||||
* - support :level,associated in filenames
|
||||
* 20/9/12
|
||||
* - add Leica filename suffix
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -93,6 +95,7 @@ im_openslide2vips( const char *name, IMAGE *out )
|
||||
static const char *openslide_suffs[] = {
|
||||
".svs", /* Aperio */
|
||||
".vms", ".vmu", ".ndpi", /* Hamamatsu */
|
||||
".scn", /* Leica */
|
||||
".mrxs", /* MIRAX */
|
||||
".tif", /* Trestle */
|
||||
NULL
|
||||
|
@ -2,7 +2,7 @@
|
||||
*
|
||||
* Benjamin Gilbert
|
||||
*
|
||||
* Copyright (c) 2011 Carnegie Mellon University
|
||||
* Copyright (c) 2011-2012 Carnegie Mellon University
|
||||
*
|
||||
* 26/11/11
|
||||
* - initial version
|
||||
@ -31,6 +31,9 @@
|
||||
* - small cleanups
|
||||
* 11/4/12
|
||||
* - fail if both level and associated image are specified
|
||||
* 20/9/12
|
||||
* - update openslide_open error handling for 3.3.0 semantics
|
||||
* - switch from deprecated _layer_ functions
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -108,6 +111,9 @@ vips__openslide_isslide( const char *filename )
|
||||
*/
|
||||
vendor = openslide_get_property_value( osr,
|
||||
OPENSLIDE_PROPERTY_NAME_VENDOR );
|
||||
|
||||
/* vendor will be NULL if osr is in error state.
|
||||
*/
|
||||
if( vendor &&
|
||||
strcmp( vendor, "generic-tiff" ) != 0 )
|
||||
ok = 1;
|
||||
@ -148,6 +154,7 @@ readslide_new( const char *filename, VipsImage *out,
|
||||
{
|
||||
ReadSlide *rslide;
|
||||
int64_t w, h;
|
||||
const char *error;
|
||||
const char *background;
|
||||
const char * const *properties;
|
||||
|
||||
@ -169,12 +176,19 @@ readslide_new( const char *filename, VipsImage *out,
|
||||
rslide->osr = openslide_open( filename );
|
||||
if( rslide->osr == NULL ) {
|
||||
vips_error( "openslide2vips",
|
||||
"%s", _( "failure opening slide" ) );
|
||||
"%s", _( "unsupported slide format" ) );
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
error = openslide_get_error( rslide->osr );
|
||||
if( error ) {
|
||||
vips_error( "openslide2vips",
|
||||
_( "opening slide: %s" ), error );
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
if( level < 0 ||
|
||||
level >= openslide_get_layer_count( rslide->osr ) ) {
|
||||
level >= openslide_get_level_count( rslide->osr ) ) {
|
||||
vips_error( "openslide2vips",
|
||||
"%s", _( "invalid slide level" ) );
|
||||
return( NULL );
|
||||
@ -192,9 +206,9 @@ readslide_new( const char *filename, VipsImage *out,
|
||||
vips_demand_hint( out, VIPS_DEMAND_STYLE_THINSTRIP, NULL );
|
||||
}
|
||||
else {
|
||||
openslide_get_layer_dimensions( rslide->osr,
|
||||
openslide_get_level_dimensions( rslide->osr,
|
||||
level, &w, &h );
|
||||
rslide->downsample = openslide_get_layer_downsample(
|
||||
rslide->downsample = openslide_get_level_downsample(
|
||||
rslide->osr, level );
|
||||
vips_image_set_int( out, "slide-level", level );
|
||||
vips_demand_hint( out, VIPS_DEMAND_STYLE_SMALLTILE, NULL );
|
||||
|
@ -6,6 +6,9 @@
|
||||
* - convert "layer" to "level" where externally visible
|
||||
* 11/4/12
|
||||
* - convert remaining uses of "layer" to "level"
|
||||
* 20/9/12
|
||||
* - add Leica filename suffix
|
||||
* - drop glib log handler (unneeded with >= 3.3.0)
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -131,16 +134,10 @@ vips_foreign_load_openslide_load( VipsForeignLoad *load )
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
static void
|
||||
vips_foreign_load_openslide_error_handler( const char *domain,
|
||||
GLogLevelFlags level, const char *message, void *data )
|
||||
{
|
||||
vips_error( "openslide", "%s", message );
|
||||
}
|
||||
|
||||
static const char *vips_foreign_openslide_suffs[] = {
|
||||
".svs", /* Aperio */
|
||||
".vms", ".vmu", ".ndpi", /* Hamamatsu */
|
||||
".scn", /* Leica */
|
||||
".mrxs", /* MIRAX */
|
||||
".tif", /* Trestle */
|
||||
NULL
|
||||
@ -194,12 +191,6 @@ vips_foreign_load_openslide_class_init( VipsForeignLoadOpenslideClass *class )
|
||||
VIPS_ARGUMENT_OPTIONAL_INPUT,
|
||||
G_STRUCT_OFFSET( VipsForeignLoadOpenslide, associated ),
|
||||
NULL );
|
||||
|
||||
/* Catch just openslide errors.
|
||||
*/
|
||||
g_log_set_handler( "Openslide",
|
||||
G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING,
|
||||
vips_foreign_load_openslide_error_handler, NULL );
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user