Skip to content
/ qubalab Public

Lab for quantitative bioimage analysis experiments in Python

License

Notifications You must be signed in to change notification settings

qupath/qubalab

Repository files navigation

QuBaLab

This is a Python package for exploring quantitative bioimage analysis... especially (but not exclusively) in combination with QuPath (https://qupath.github.io/).

The name comes from Quantitative Bioimage Analysis Laboratory. This is chosen to be reminiscent of QuPath (Quantitative Pathology), but recognizes that neither is really restricted to pathology.

Goals

QuBaLab isn't QuPath - they're just good friends.

  • QuPath is a user-friendly Java application for bioimage analysis, which has some especially nice features for handling whole slide and highly-multiplexed images. But lots of bioimage analysis researcher is done in Python, and is hard to integrate with QuPath.
  • QuBaLab's main aim is to help with this, by providing tools to help exchange data between QuPath and Python without any direct dependency on QuPath and Java. It therefore doesn't require QuPath to be installed, and can be used entirely from Python.

QuBaLab doesn't share code with QuPath, but is uses many of the same conventions for accessing images and representing objects in a GeoJSON-compatible way. By using the same custom fields for things like measurements and classifications, exchanging data is much easier.

Getting started

You can find the documentation on https://qupath.github.io/qubalab-docs/.

This project contains the QuBaLab package in the qubalab folder. Take a look at the Installation section to install it.

Some notebooks present in the notebooks folder show how to use the QuBaLab package. If you want to run them, you can take a look at the Development section. If you just want to go through them, look at the documentation.

Installation

QuBaLab will live on PyPI soon, but for the time being you should install it from GitHub. You can do this directly using:

pip install --upgrade https://github.com/qupath/qubalab/tarball/main

or if you have git installed:

pip install git+https://github.com/qupath/qubalab.git

Development

This part is useful if you want to run the notebooks or contribute to this project.

First, run:

git clone https://github.com/qupath/qubalab.git         # clone this repository
cd qubalab                                              # go to the project directory
python -m venv ./.venv                                  # create a local virual environment
source ./.venv/bin/activate                             # activate the venv
pip install -e ".[dev,test,openslide]"                  # install qubalab (-e means changes are loaded dynamically)
jupyter lab .                                           # to start the Jupyter notebooks
pytest                                                  # to run unit tests

OpenSlide support

OpenSlide support relies on having OpenSlide binaries installed at a system level. Therefore not all aspects of OpenSlide will work consistently across platforms, as the versions available from package managers or from OpenSlide directly may vary between operating systems.