Skip to main content

Deploy image processing algorithms in FastAPI servers.

Project description

EPFL Center for Imaging logo

🪐 Imaging Server Kit

Deploy image processing algorithms in FastAPI servers and easily run them from Napari, QuPath, and more.

The algorithm servers implement a common set of API endpoints for processing and to document the project. These include:

  • /process: Runs the algorithm
  • /info: Displays documentation about the algorithm usage
  • /sample_images: Provides one or multiple sample images

Usage

Algorithm servers

Set up and run a server with one, or multiple algorithms from the Imaging Server Kit collection (or your own):

  • StarDist: Object detection with star-convex shapes
  • CellPose: A generalist algorithm for cellular segmentation
  • Spotiflow: Accurate and efficient spot detection
  • Rembg: A tool to remove images background
  • LoG detector: Laplacian of Gaussian filter
  • Orientationpy: Measurement of greyscale orientations

All of these algorithm servers can be installed locally or built and run with docker. To use docker and serve multiple algorithms, the recommended way is to edit a docker-compose.yml file and pull server images from registry.rcp.epfl.ch (EPFL users only):

services:
  servers_registry:
    image: mallorywittwerepfl/imaging-server-kit:latest
    ports:
      - "8000:8000"
    command: python3 start_registry.py
  rembg:
    image: registry.rcp.epfl.ch/imaging-server-kit/serverkit-rembg:latest
    depends_on:
      - servers_registry
  skimage-log:
    image: registry.rcp.epfl.ch/imaging-server-kit/serverkit-skimage-log:latest
    depends_on:
      - servers_registry

Start the server with

docker compose up

The server should be accessible at http://localhost:8000.

Build the docker images yourself

To build the algorithm server images yourself (e.g. if you are not from EPFL), see Reference Deployment.

Create a server for your project

To learn how to create a server for your project, see Algorithm Server Template.

Python client

Once the server is running, connect to it and run algorithms from Python:

from imaging_server_kit import Client

client = Client("http://localhost:8000")

print(client.algorithms)
# [`rembg`, `stardist`, `cellpose`]

algo_output = client.run_algorithm(
    algorithm="rembg",
    image=(...),
    rembg_model_name="silueta",
)

Napari plugin

Once the server is running, use the Napari Server Kit plugin to connect to it and run algorithms in Napari.

QuPath extension

Once the server is running, use the QuPath Extension Server Kit to connect to it and run algorithms from within QuPath.

Install locally

Install the imaging-server-kit package with pip:

pip install imaging-server-kit

or clone the project and install the development version:

git clone https://github.com/Imaging-Server-Kit/imaging-server-kit.git
cd imaging-server-kit
pip install -e .

Build with docker

Build the imaging-server-kit docker image for a specific Python version:

docker build --build-arg PYTHON_VERSION=3.9 -t imaging-server-kit:3.9 .

Run build.sh to build docker images for Python 3.9, 3.10, 3.11, GPU and the server kit registry:

bash ./build.sh

Contributing

Contributions are very welcome.

License

This software is distributed under the terms of the BSD-3 license.

Issues

If you encounter any problems, please file an issue along with a detailed description.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

imaging_server_kit-0.0.5.tar.gz (22.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

imaging_server_kit-0.0.5-py3-none-any.whl (22.3 kB view details)

Uploaded Python 3

File details

Details for the file imaging_server_kit-0.0.5.tar.gz.

File metadata

  • Download URL: imaging_server_kit-0.0.5.tar.gz
  • Upload date:
  • Size: 22.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for imaging_server_kit-0.0.5.tar.gz
Algorithm Hash digest
SHA256 41cbf4ac14164aeec07564a905760802c8bae7dddf43ff77d07c68df492c385d
MD5 85bc5716ffe5d43f3408fc99b65373ba
BLAKE2b-256 cd2a17bc696f100763e4e6641a365dfe27507abc66945572df33a9956542c4e9

See more details on using hashes here.

File details

Details for the file imaging_server_kit-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for imaging_server_kit-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 a45cde21b9e431222dd9b0982816396b8ec92758ef7e02cf5401545fbc9ec053
MD5 bd303bbfc99cf4e854e74742d65bcec4
BLAKE2b-256 7bd7cb72a837c0684dfbbab7b0838edc8b413a55b5af429f6a7c9f042bf9eca0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page