Reputation: 111
I am writing an application that can view and interact with whole-slide images in .svs format using the OpenSlide python library.
Using Flask and the provided web based viewer example, I am able to create a web based application that allows me to interact with the data.
However, my final application should not be web based. I am struggling to find a solution on how to display and interact with openslide images in a simple GUI (e.g. PyQt).
Thank you very much!
Upvotes: 4
Views: 3943
Reputation: 65
this is an old post so it may not be relevant anymore but I wrote a PyQt application that uses openslide. Getting it to compile was an absolute nightmare, especially on windows - as you have to include all of the open slide binaries, but it is doable.
I compiled it using pyinstaller, where you can include the openslide dylib file in the command to do the compilation. Below are the commands I would use for each OS to get pyinstaller to work:
# DEPLOY MAC
# sudo pyinstaller -F --windowed -p /Users/callum/callum/QuArray/scripts --add-data "/Users/callum/callum/QuArray/scripts:scripts" --add-binary "/Users/callum/Library/Application Support/pyinstaller/bincache00_py37_64bit/libopenslide.0.dylib:." --icon=scripts/icons/icon.icns QuArray.py
# Windows
# pyinstaller -F --windowed -p C:/Users/callum/QuArray/scripts --add-data "C:/Users/callum/QuArray/scripts;scripts" --icon=scripts/icons/icon.ico QuArray.py
# Linux
# pyinstaller -F -p ~/Documents/QuArray/scripts/ --add-data "scripts:scripts" QuArray.py
As you should expect, linux was the easiest as it doesn't even need the "--add-binary" option! Windows was of course the most annoying as you need to move all of the dylib files into the working directory...
If you are still working on it then good luck!
Upvotes: 0
Reputation: 11190
I made a tiny demo program using GTK to display a slide image using libvips and openslide:
https://github.com/libvips/vipsdisp-tiny
It's only 300 lines of code. It's asynchronous, so you can scroll around the image and the display will be updated in the background by a threadpool as chunks of the slide are decompressed.
It's in C, but it should be pretty easy to rework in Python.
There's a complete viewer program here:
https://github.com/jcupitt/vipsdisp
It looks like this:
It has a range of useful features, eg. range scaling, log scaling, support for a wide range of formats, format conversion, etc.
Upvotes: 5