— Ashley Towers


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!

Read More

I quite enjoyed this post by Vu Tran at Framebase  about the quickest programmers being the quickest to break out their search engine. It got me thinking; the principle of DRY – Don’t Repeat Yourself is well known. Only have one representation of any rule or truth in your code. Don’t copy and paste. If the world changes, and it frequently does, you only have to update this in one place. Good practice, bordering on basic common sense, and pretty much followed by every programmer worth his salt.

However, there’s a tendency amongst (some – not all!) programmers to reinvent the wheel; to write their own solution to already solved problems. This is also bad. Who knows, maybe even worse? To my knowledge this doesn’t have a pithy acronym. So, I propose for your delectation: DROP. Don’t Repeat Other People.

Don’t reinvent the wheel. Use pre-existing libraries; ideally use open source. There are often situations where an existing library doesn’t quite do what you want, but surely it’s better to add this functionality to an existing, battle hardened, code base than it is to start again? After all, you’ll have to re-implement the basics before you even get as far as writing your “special” bit. Use the hard won experience and lessons of the library developers to your advantage, then stand your special case on top of that.

Read More

This post is a reworked version from my now deceased Posterous blog.

As the title suggests, this is how I got Passenger installed on Ubuntu 11.10 with RVM (with 1.9.2). Hopefully this will save you the numerous blind alleys I went down.


I was getting the following error:

Checking for required software...
GNU C++ compiler... found at /usr/bin/g++
Curl development headers with SSL support... found
OpenSSL development headers... found
Zlib development headers... found
Ruby development headers... found
OpenSSL support for Ruby... not found
RubyGems... found
Rake... found at /home/ashley/.rvm/wrappers/ruby-1.9.2-p290@portfolio/rake
rack... found
Apache 2... found at /usr/sbin/apache2
Apache 2 development headers... found at /usr/bin/apxs2
Apache Portable Runtime (APR) development headers... found at /usr/bin/apr-1-config
Apache Portable Runtime Utility (APU) development headers... found at /usr/bin/apu-1-config

Some required software is not installed.
But don't worry, this installer will tell you how to install them.

Running the suggested “apt-get install libopenssl-ruby” as root didn’t work for reasons that can only be attributed to spite. The ususally successful Google-the-error approach didn’t work either.

Read More