— Ashley Towers

Publishing Aperio SVS Virtual Microscopy Images to the web using VIPS, OpenSlide and OpenSeadragon

I have spent a chunk of today figuring out how to take virtual microscopy slides from our Aperio Slide Scanner, saved as svs files, and make them viewable in a web browser. Scanscope already includes a flash based viewer, however, this isn’t any good if you don’t have flash installed or can’t install flash (e.g. if you are trying to view the slides on a phone or tablet). Aperio also have an iOS app for viewing slides, but again this is far from ideal and a bad answer to the problem. I wanted the slides to be viewable with nothing more than a modern web browser.

After some digging around it appeared that it should be possible, I found:

  1. OpenSlide - a C library that was able to convert between proprietary SVS files and a number of open tiled image formats
  2. OpenSeadragon - an open source and pure Javascript viewer for zoomable images.

However, knowing all the parts were available was one thing; getting them to work together took some experimentation! So this post is the distilled version of the steps that got everything working together for me.

All of these steps assume you are working on a Mac and work as of today (15th Jan 2014). You might be able to get use them as inspiration for other platforms but you’re on your own!

Install Homebrew

If you haven’t already got it, install Homebrew I believe the packages below are available via MacPorts but I haven’t verified this.

Install VIPS

The first step is to install VIPS. VIPS  is a command line image processing utility that is able to use OpenSlide and will handle the image conversion for us. To install it fire up a terminal and execute the following command:

brew install https://raw.github.com/jcupitt/homebrew-science/3fda4568544a67743b2a880ad1c5f844b4ff3515/vips.rb --with-openslide

This will take quite a while as it builds and installs VIPS and all its dependencies. If you have any problems, the full VIPS build/install instructions are available on their Wiki.

The next step is to use VIPS to convert the SVS image in to a format that OpenSeadragon can understand.

Converting SVS to DZI

To convert your SVS file to a DZI file execute the following command:

vips dzsave /path/to/your/image.svs /path/to/output/directory

For example running the following:

vips dzsave ~/mucocoele.svs ~/webMucocoele

Will create a file called mucocoele.dzi and a folder called mucocoele_files. Both of these are required.

NB if your source svs image is large this conversion can take a long time!

NB.2 if you receive a “VipsForeignLoad” error then you probably didn’t include the “–with-openslide” parameter when installing VIPS. You’ll need to brew uninstall it and rebuild including the parameter.

Putting your image on the web

With your DZI file and folder of tiles created, the next step is to get them on the web.

  1. Create a folder in a public folder on your web server (e.g. in htdocs)
  2. Copy both the .dzi file and _files folder you created with VIPS in to your newly created folder
  3. Follow the instructions on the OpenSeadragon getting started guide to create a simple html file remembering to substitute the name of your dzi image file in to the tileSources parameter.
  4. Fire up your web browser and navigate to the page!
  5. Bask in the glory of Microscopy slides on the web!

If you’d like a quick start, I have produced a very simple self contained working example which you can just drop in to your public web folder which is available here: Zip File or Github

Hope this helps!

0 comments
Submit comment