Skip to content
Browse files

support :level,associated in the vips7 openslide

the vips7 stub for openslide now supports :level,associated mode
options, eg:

$ header CMU-2.svs
CMU-2.svs: 19500x7615 uchar, 4 bands, rgb VipsImage (0x236a060)
$ header CMU-2.svs:2
CMU-2.svs:2: 4875x1903 uchar, 4 bands, rgb VipsImage (0x244c060)
$ header CMU-2.svs:,label
CMU-2.svs:,label: 387x463 uchar, 4 bands, rgb VipsImage (0xa2d060)
$ header CMU-2.svs:2,label
CMU-2.svs:2,label: 387x463 uchar, 4 bands, rgb VipsImage (0x1b23060)
  • Loading branch information...
1 parent 7af1fb3 commit 3540e3ef09b8b0701e3a7365c2205f09654ed997 @jcupitt committed Apr 11, 2012
Showing with 34 additions and 2 deletions.
  1. +1 −0 ChangeLog
  2. +21 −2 libvips/deprecated/im_openslide2vips.c
  3. +12 −0 python/try4.py
View
1 ChangeLog
@@ -4,6 +4,7 @@
- fix openslide read: always return png-style rgba, im_argb2rgba() becomes a
NOP
- cast to unsigned int now removes <0 values
+- vips7 interface to openslide now supports :,level,associated options
13/3/12 started 7.28.2
- xres/yres tiffsave args were broken
View
23 libvips/deprecated/im_openslide2vips.c
@@ -2,6 +2,8 @@
*
* 17/12/11
* - just a stub
+ * 11/4/12
+ * - support :level,associated in filenames
*/
/*
@@ -49,11 +51,28 @@
#include <vips/internal.h>
static int
-im_openslide2vips( const char *filename, IMAGE *out )
+im_openslide2vips( const char *name, IMAGE *out )
{
+ char filename[FILENAME_MAX];
+ char mode[FILENAME_MAX];
+ char *p, *q;
+ char *associated;
+ int level;
VipsImage *t;
- if( vips_openslideload( filename, &t, NULL ) )
+ im_filename_split( name, filename, mode );
+ level = 1;
+ associated = NULL;
+ p = &mode[0];
+ if( (q = im_getnextoption( &p )) )
+ level = atoi( q );
+ if( (q = im_getnextoption( &p )) )
+ associated = q;
+
+ if( vips_openslideload( filename, &t,
+ "level", level,
+ "associated", associated,
+ NULL ) )
return( -1 );
if( vips_image_write( t, out ) ) {
g_object_unref( t );
View
12 python/try4.py
@@ -0,0 +1,12 @@
+#!/usr/bin/python
+
+import sys
+from vips8 import vips
+from gi.repository import Vips
+
+a = vips.Image(sys.argv[1])
+b = vips.Image(sys.argv[2])
+
+c = a.join(b, Vips.Direction.HORIZONTAL, expand = True)
+
+c.write_to_file(sys.argv[3])

0 comments on commit 3540e3e

Please sign in to comment.
Something went wrong with that request. Please try again.