home
•

Install requirements¶

qp header

I. General¶

  • A laptop with a decent amount of RAM (16Go bare minimum).
  • We strongly recommend everybody to take a mouse. Using QuPath with a touchpad can be difficult.
  • Make some free space on your disk, the images that we will manipulate will be quite large and QuPath creates some temporary data (like pyramids) that can double or triple the volume of some files.
  • If you have the possibility to get an Eduroam access, activate it before coming.

II. Datasets¶

  • You should download the dataset that we are going to use in the different exercises. It is heavy and the guest internet access won't allow you to download it in time (at least if everybody tries at the same time).
  • You can download the dataset from sDrive: https://sdrive.cnrs.fr/s/wPx4DwMwSPDjyCs.

III. Python¶

1. MiniConda¶

  • To avoid collisions in Python modules, we will use virtual environments.
  • If you are more familiar with a virtual environments manager different of MiniConda, feel free to use it, but the examples in the workshop will be with MiniConda.
  • Start by downloading the version of MiniConda corresponding to your operating system from this page: repo.anaconda.com/miniconda.
  • The way you will have to install it depends on your operating system:

Windows¶

  • What you downloaded should be a ".exe" installer.
  • You can run it, it doesn't require you to be admin on your machine.
  • When you will be asked where to install MiniConda, you can go with the default path, BUT copy the path into notepad or another editor and save it for later.
  • From now on, whenever you will see "open a conda terminal", you should open your program named "Anaconda Prompt".

Mac/Linux¶

  • What you downloaded should be a ".sh" file.
  • Open a terminal (Ctrl + Alt + T on Linux or the application named "Terminal" on Mac).
  • In the terminal, write sh (with a blank space after sh)
  • Drag and drop the ".sh" in the terminal: it should add its full path after the sh .
  • You should have something like sh /home/some/path/to/MiniConda3-latest-xxx.sh.
  • Press Enter and follow the instructions.
  • Close everything and open a new terminal. If the installation is successfull, you should see (base) written on the left of the terminal's prompt.
  • From now on, whenever you will see "open a conda terminal", you should simply open a new terminal.

2. CellPose¶

A. Create the environment¶

  • Start by opening a new conda terminal.
  • We will create a new environment in which we will install CellPose.
  • To create a new environment, use the command: conda create -n cellpose-env -y python=3.12
    • All conda commands start with conda.
    • create means that we want to create a new environment
    • -n means that the next thing that is coming in the command after the next blank space is the name that we want to give to our env.
    • cellpose-env is the name chosen for this env (it is arbitrary, you can use whatever you want).
    • -y means that the command will be executed without user-interaction, all prompts will be answered with yes.
    • python=3.12 means that we don't let MiniConda choose which version of Python to install, we force it to use 3.12.

Note

If it is the first time ever that you use MiniConda, when you launch your first conda create ... the command will be interupted to ask you to accept the terms of services. Conda will show you the commands to accept them. Copy and paste one after the other. They should look something like conda tos accept ...

You must relaunch the environment creation after accepting the TOS.

B. Install CellPose¶

  • Activate the env that you just created by using the command: conda activate cellpose-env.
  • The (base) on the left of the prompt should have been replaced by (cellpose-env).
  • Now we are inside the env and will install CellPose.
  • You can do that using the command:
    • On Mac/Linux: pip install "cellpose[gui]==3.1.1"
    • On Windows: pip install cellpose[gui]==3.1.1
  • What it means: pip means "pip installs packages". It is a small software that installs Python packages for you. install is what we want pip to do (it can install, remove, upgrade, ...). cellpose is the package's name. [gui] is an optional flag asking pip to also install the minimal graphical interface of CellPose if you ever want to use it outside of QuPath. ==3.1.1 means that we force pip to download the version 3.1.1 of CellPose.

3. Install Git¶

  • Git is a version control system for source code.
  • In our case, it will be useful to access some code hosted on GitHub.
  • Start by going to the Git download page: git-scm.com/install.
  • If you indicate your operating system, you will be given the instructions to use.
  • Once you executed the provided instructions, open a new conda terminal.
  • Use the command git --version. If you are shown a version, everything went fine. Otherwise, Git installation failed.

4. SAM server¶

A. Create the environment¶

  • To use SAM, we will create an environment containing a server through which SAM's API is exposed.
  • Start by opening a new conda terminal.
  • Create a new environment with the command: conda create -n samapi -y python=3.12.
  • Activate the environment with conda activate samapi.
  • The (base) should have become (samapi) at this point.

B. Install SAM¶

  • Start by installing PyTorch with the command: pip install "torch==2.7.0" torchvision --index-url https://download.pytorch.org/whl/cu126.
  • If you are on Windows, you have a side dependency to install using the command: pip install triton-windows.
  • You can now install SAM server from GitHub using Git and pip: pip install git+https://github.com/ksugar/samapi.git

IV. QuPath¶

1. StarDist¶

a. The plugin¶

  • Download the JAR corresponding to the StarDist plugin for QuPath.
  • Open QuPath.
  • Drag and drop the JAR into QuPath.
  • If everything went well, in the "Extensions" entry from the top-bar menu, you should see StarDist.

b. The models¶

  • StarDist is just the architecture and the algorithms, which is not very useful without some pretrained models (unless you want to train one by yourself).
  • These are not things to install, these are simply files to keep somewhere and we will have to provide one of them to StarDist depending on what we want to do.
  • You must download the three models:
    • dsb2018_heavy_augment
    • dsb2018_paper
    • he_heavy_augment

2. CellPose¶

a. The plugin¶

  • CellPose runs as a Python software that we installed in the "Python" section. Yet, we need a way to get this software to communicate with QuPath so we can use it from QuPath.
  • We need to install the bridge between CellPose and QuPath.
  • To do so, start by downloading the ZIP from the release list of CellPose for QuPath.
  • Unzip it wherever you want.
  • Inside it, you should find a JAR and a PY. The PY is useless, we will only use the JAR.
  • Open QuPath. Then, drag and drop the JAR in QuPath.
  • If everything went fine, you should see CellPose in the "Extension" menu from the top-bar.

b. Configuration¶

  • We just installed the bridge.
  • One end of the bridge is QuPath so there is not problem about that. The other end should be CellPose but we don't know where it is (yet).
  • The first step is to locate the Python that CellPose is using. Doing that depends on the OS.
  • On Mac/Linux:
    • open a new conda terminal.
    • activate CellPose's env using conda activate cellpose-env.
    • launch the command: which python.
    • it should show you a path which is the one we are interested in.
  • On Windows:
    • when you installed MiniConda, you were asked to write down where it is installed.
    • open the folder in which you installed MiniConda.
    • In there, you should have an envs folder.
    • Within envs, you should have a cellpose-env folder.
    • Within the cellpose-env folder, you should have a "python.exe" file.
    • It's the path of this file (including the ".exe") that we want.

Warning

Be careful, by default, file extensions are hidden on Windows: you won't see the ".exe" in Python's file. On Mac and Linux, binaries don't have any particular extensions.

  • In QuPath, in the top-bar menu, go to "Edit" > "Preferences".
  • You should have a "CellPose" section in there.
  • In the CellPose 'python.exe' location, paste the path of Python.
    • On Windows: you should replace \ with / and have "python.exe" not just "python".

3. InstanSeg¶

  • Open QuPath and from the top-bar menu, go to "Extensions" > "Extension manager" to open the extensions manager.
  • In the list, find InstanSeg and use the QP install install button to launch the installation.

4. SAM¶

  • Download the JAR corresponding to the SAM extension.
  • Drag and drop the JAR into QuPath.
  • If everything went well, you should see it in the "Extensions" menu.
  • This extension is not transparent, each time before launching SAM in QuPath you need to:
    • open a new conda terminal.
    • activate SAM API env with conda activate samapi.
    • launch the server with uvicorn samapi.main:app --workers 2.

V. Excel / LibreOffice Calc¶

  • You should have either one installed but we will use LibreOffice Calc in the examples.