Skip to content

Running InVesalius 3 in Linux

Thiago Franco de Moraes edited this page Mar 8, 2023 · 21 revisions

From Packages

Debian and Ubuntu

InVesalius is already packaged and is in the main repos from Debian and Ubuntu. Install it using this command:

sudo apt install invesalius

If you want the most updated packages there is also a PPA to Ubuntu:

sudo add-apt-repository ppa:tfmoraes/invesalius
sudo apt-get update
sudo apt install invesalius

After the installation InVesalius will appear in your system menu. You can also run it from command line:

invesalius3

Other distros

InVesalius is packaged as Flatpak. First you need to add the Flathub repo:

flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

Then install InVesalius:

flatpak install flathub br.gov.cti.invesalius

After the installation InVesalius will appear in your system menu. You can also run it from command line:

flatpak run br.gov.cti.invesalius

From Source code

Use this command to get InVesalius source code from GitHub:

git clone --recurse-submodules https://github.com/invesalius/invesalius3

1. Install Dependencies

1.1 Using PIP packages (recommended)

First you have to install some system packages to compile wxPython and H5py:

  • Fedora (tested on Fedora 34)
sudo dnf -y install \
    gcc-c++ \
    python3-devel \
    freeglut-devel \
    gstreamer1-devel \
    gstreamer1-plugins-base-devel \
    gtk3-devel \
    libjpeg-turbo-devel \
    libnotify-devel \
    libpng-devel \
    libSM-devel \
    libtiff-devel \
    libXtst-devel \
    SDL-devel \
    webkit2gtk3-devel \
    which \
    hdf5-devel
  • Ubuntu (tested on Ubuntu 20.10 and 21.04)
sudo apt install -y \
    freeglut3 \
    freeglut3-dev \
    libgl1-mesa-dev \
    libglu1-mesa-dev \
    libgstreamer-plugins-base1.0-dev \
    libgtk-3-dev \
    libjpeg-dev \
    libnotify-dev \
    libsdl2-dev \
    libsm-dev \
    libtiff-dev \
    libwebkit2gtk-4.0-dev \
    libxtst-dev \
    python3-dev \
    libhdf5-dev \
    build-essential \
    python3-venv
  • Arch
sudo pacman -syu \
    wxgtk3 \
    glu \
    mesa \
    webkit2gtk

It's recommend to create a virtualenv:

# Go to InVesalius folder
cd invesalius3
# Create my_env enviroment
python3 -m venv my_env
# Activate it every time you want to run InVesalius
source my_env/bin/activate
pip install -r requirements.txt

1.2 Using system packages

Debian and Ubuntu (Tested in Ubuntu 20.04)

sudo apt install python3-wxgtk4.0 python3-numpy python3-scipy python3-pil python3-matplotlib python3-skimage python3-nibabel python3-serial python3-psutil python3-vtk7 python3-vtkgdcm python3-gdcm cython3 python3-h5py python3-imageio python3-keras python3-pubsub

Ubuntu don't have PlaidML in their repositories, so install it using pip:

pip3 install --user plaidml-keras

Fedora (Tested in Fedora 32)

sudo dnf install gcc gcc-g++ python3-wxpython4 python3-numpy python3-scipy python3-matplotlib python3-scikit-image python3-nibabel python3-pyserial python3-psutil python3-vtk python3-gdcm python3-Cython python3-h5py python3-pypubsub

Unfortunately, Fedora doesn't have python3-imageio package. But it's possible to install it using pip:

pip3 install --user imageio

Fedora don't have PlaidML in their repositories, so install it using pip:

pip3 install --user plaidml-keras

Arch Linux

sudo pacman -S cython python-pip python-numpy python-scipy python-scikit-learn python-wxpython python-pyserial python-psutil python-h5py python-pypubsub python-mpi4py python-matplotlib vtk clinfo opencl-headers gdal glew hdf5 jsoncpp netcdf pdal pugixml proj

You have to install some packages from AUR, I'm using Pikaur to install them:

pikaur -S --noconfirm gdcm python-nibabel python-scikit-image python-imageio python-plaidml python-plaidml-keras

2. Build the Cython modules

Enter on invesalius3 folder and execute: python3 setup.py build_ext --inplace

3. Running InVesalius

To make InVesalius run just enter in the invesalius folder then:

python3 app.py

You can pass a DICOM folder as parameter to make InVesalius starts with the DICOM loaded.

python3 app.py -i /dicom/folder

It's possible to make InVesalius load a DICOM folder create a surface (mesh) with the given threshold and export the surface to a STL file without loading any GUI:

python3 app.py --no-gui -i /media/thiago/Documentos/dcm/0051 -t 200,3033 -e /tmp/0051.stl