add OpenSlide properties to image metadata

This commit is contained in:
Benjamin Gilbert 2011-11-27 16:03:57 -05:00
parent 94912aba27
commit a9933071ec
1 changed files with 9 additions and 0 deletions

View File

@ -9,6 +9,7 @@
* 27/11/11 * 27/11/11
* - fix black background in transparent areas * - fix black background in transparent areas
* - no need to set *stop on fill_region() error return * - no need to set *stop on fill_region() error return
* - add OpenSlide properties to image metadata
*/ */
/* /*
@ -61,6 +62,7 @@ static int
load_header( openslide_t *osr, VipsImage *out ) load_header( openslide_t *osr, VipsImage *out )
{ {
int64_t w, h; int64_t w, h;
const char * const *properties;
openslide_get_layer0_dimensions( osr, &w, &h ); openslide_get_layer0_dimensions( osr, &w, &h );
if( w < 0 || h < 0 ) { if( w < 0 || h < 0 ) {
@ -73,8 +75,15 @@ load_header( openslide_t *osr, VipsImage *out )
_( "image dimensions overflow int" )); _( "image dimensions overflow int" ));
return( -1 ); return( -1 );
} }
vips_image_init_fields( out, (int) w, (int) h, 4, VIPS_FORMAT_UCHAR, vips_image_init_fields( out, (int) w, (int) h, 4, VIPS_FORMAT_UCHAR,
VIPS_CODING_NONE, VIPS_INTERPRETATION_RGB, 1.0, 1.0 ); VIPS_CODING_NONE, VIPS_INTERPRETATION_RGB, 1.0, 1.0 );
for( properties = openslide_get_property_names(osr);
*properties != NULL; properties++ )
vips_image_set_string( out, *properties,
openslide_get_property_value( osr, *properties ));
return( 0 ); return( 0 );
} }