1

I'm trying to create .dzi file from a .svs file (downloaded from openslide.org test biomedical data). We found couple of libs including vips, php-vips and openslide's own lib openslide written in python scripting, c## as well as the one in php: (https://github.com/BlakSneil/Openslide-PHP-Bindings)

Openslide-php-bindings seemed most easy of all, so i downloaded and tried it out, but i was unable to get any headway in creating the .dzi file from a .svs file. On testing the script it threw up this error.

( ! ) Fatal error: Uncaught Error: Call to undefined function openslide_open() in C:\wamp\www\xxxxxx

any help from you guys would be great, as i'm totally stuck on how to get this .svs file converted to .dzi for days on end.

Edit: as per jcuppit, we are trying php-vips. Based on https://github.com/libvips/php-vips installation instructions, tried to install php-vips on our linux centos aws ec2 server, we encountered this error in cli

[root@xx /]# yum install libvips-dev
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: d36uatko69830t.cloudfront.net
 * epel: mirrors.piconets.webwerks.in
 * extras: d36uatko69830t.cloudfront.net
 * remi: mirror.23media.com
 * remi-php55: mirror.23media.com
 * remi-php56: mirror.23media.com
 * remi-safe: mirror.23media.com
 * updates: d36uatko69830t.cloudfront.net
No package libvips-dev available.
Error: Nothing to do

Ahamed Husain
  • 299
  • 1
  • 3
  • 12
  • I think that it's best for you to open an issue on the repository and see if the author is still around to help you. In any case, you should add more details on how you are running the script to help in finding the cause. – Yuri-M-Dias Mar 03 '20 at 18:13

1 Answers1

0

In php-vips you'd do this:

$image = Vips\Image::newFromFile("some-slide-image.svs");
$image->dzsave("my-pyramid-name");

Docs here:

https://libvips.github.io/libvips/API/current/Making-image-pyramids.md.html

However, php-vips won't work on Windows, which seems to be the platform you are using.

If you can't change platform, your best bet would be to shell out to vips.exe and do it on the command-line instead. Download the libvips Windows build from here:

https://github.com/libvips/libvips/releases

You need vips-dev-w64-all-8.9.1.zip to get openslide support.

Try running it in the terminal to make sure it's working:

vips.exe dzsave some-slide-image.svs my-pyramid-name

Then just run that from php.

You'll find pyramid creation is very slow on Windows because the Windows file system hates many small files in one directory. You'll see a dramatic speedup if you write to a large zip file instead. Try:

vips.exe dzsave some-slide-image.svs my-pyramid-name.zip

Now dzsave will create an uncompressed zip file containing all the tiles. You'll find it's three or four times faster, and the zip is obviously easier to manage.

jcupitt
  • 10,213
  • 2
  • 23
  • 39
  • Thanks for replying. On desktop, i'm using windows 32 bit for which i'm unable to find a latest version of libvips. So i'm proceeding to try this code on my server which is based on linux centos in aws ec2. Shall update you. – Ahamed Husain Mar 06 '20 at 05:28
  • unable to install libvips-dev, do see the edited question – Ahamed Husain Mar 06 '20 at 06:49
  • Yes, the win build is 64 bit. I would test libvips first to make sure it can solve your problem before investing a lot of time in installation. Find a win10 machine or try a modern linux. If you do want to go ahead, think about how you will manage deployment, since you will have to build from source if you want to run it on amazonlinux2. There's a dockerfile here that shows the build process: https://github.com/jcupitt/docker-builds/tree/master/libvips-amazonlinux2 you'll need to modify that to add at least openslide-devel and libgsf-devel. – jcupitt Mar 06 '20 at 09:39
  • What do you mean by modern linux ? – Ahamed Husain Mar 06 '20 at 13:50
  • Oh just one with a recently updated set of packages, eg. current ubuntu etc. – jcupitt Mar 07 '20 at 17:40
  • Viewed the dockerfile and the commands in it. Will running all those commands get vips up in my aws ec2 linux centos server ? What do you mean by modifications by the way. It will be very useful, if you could guide me through this process. – Ahamed Husain Mar 11 '20 at 03:42
  • stackoverfflow comments are not a good way to debug complex things. Please open an issue on the libvips tracker and I'll try to help. https://github.com/libvips/libvips/issues – jcupitt Mar 11 '20 at 09:32
  • i'm sorry, shall open github account and ticket on libvips and revert to you. – Ahamed Husain Mar 11 '20 at 13:53
  • Just for update, we have raised the ticket on github. https://github.com/libvips/libvips/issues/1577 – Ahamed Husain Mar 14 '20 at 16:02