The prerequisites for TIAToolbox installation are OpenSlide binaries and OpenJPEG version 2.3.0 or above. Please follow the instructions below to install the prerequisite software according to your platform.
On Linux, the prerequisite software can be installed using the following command:
$ apt-get -y install libopenjp2-7-dev libopenjp2-tools openslide-tools
The same command is used when working on the Colab or Kaggle platforms. When working on Google Colab, we remove the packages datascience
and albumentations
because they conflict and produce an error message.
- Download OpenSlide binaries from this page. Extract the folder and add the
bin
andlib
subdirectories to the Windows system path. If you are using a conda environment, you can also copy thebin
andlib
subdirectories to[Anaconda Installation Path]/envs/[tiatoolbox-environment]/Library/
. - Install OpenJPEG. The easiest way to install OpenJPEG is through conda:
C:\> conda install -c conda-forge openjpeg
On macOS, there are two popular package managers, homebrew and macports.
$ brew install openjpeg openslide
$ port install openjpeg openslide
Please note that TIAToolbox is tested for Python versions 3.9, 3.10, 3.11, and 3.12.
To install TIAToolbox, run this command in your terminal after you have installed the prerequisite software:
$ pip install tiatoolbox
This is the preferred method to install TIAToolbox, as it will always install the most recent stable release.
To upgrade an existing version of TIAToolbox to the latest stable release, run this command in your terminal:
$ pip install --ignore-installed --upgrade tiatoolbox
If you already have a Python environment set up with all the prerequisite software and dependencies installed and you would like to keep the existing versions of these dependencies, run this command in your terminal:
$ pip install --no-deps tiatoolbox
If you don't have pip installed, this Python installation guide can guide you through the process.
After installing Anaconda (or miniconda / mamba), you can install TIAToolbox using the following command:
$ conda install -c conda-forge tiatoolbox
or
$ mamba install tiatoolbox
Please note that conda-forge installation support is limited on Windows as OpenSlide binaries are not supported on official conda channels. An alternate way to install using conda on Windows could be to install it in WSL2 with CUDA support. In some cases, WSL2 runs faster on Python code, and therefore we recommend this option.
The sources for TIAToolbox can be downloaded from the GitHub repo.
You can either clone the public repository:
$ git clone https://github.com/TissueImageAnalytics/tiatoolbox.git
Or download the tarball:
$ curl -OJL https://github.com/TissueImageAnalytics/tiatoolbox/tarball/master
Once you have a copy of the source, you can install it with:
$ python setup.py install
To run TIAToolbox in an isolated environment, use our Docker image. We host different Dockerfiles in our GitHub repository tiatoolbox-docker. Please report any issues related to the Docker image in the repository tiatoolbox-docker.
After installing Docker (or Docker Desktop), you can use our TIAToolbox image in three different ways.
TIAToolbox provides pre-built Docker containers which can be downloaded using the instructions below:
- Pull the Image From GitHub Container Registry:
$ docker pull ghcr.io/tissueimageanalytics/tiatoolbox:latest
- Use the Pre-Built Docker Image as a Base Image in a Dockerfile:
FROM ghcr.io/tissueimageanalytics/tiatoolbox:latest
- Navigate to the Dockerfile that you want to use, based on the Python version and Operating System that you prefer.
- Build the Docker image:
$ docker build -t <IMAGE_NAME> .
- Check that the image has been created:
$ docker images
- Deploy the image as a Docker container:
$ docker run -it --rm --name <CONTAINER_NAME> <IMAGE_NAME>
- Connect to the running container:
$ docker exec -it <CONTAINER_NAME> bash
To add your own script and run it through the Docker container, first copy your script into the Docker environment and then execute it:
COPY /path/to/<script>.py .
CMD ["python3", "<script>.py"]