Getting Started

Installation and first Steps

Prerequisites  

A working Python installation (recommended version 3.10) is required. While the package is compatible with standard Python environments, the use of a Conda-based environment (e.g., Anaconda or Miniconda) is recommended. A more detailed description on how to set up Anaconda can be found here.

Setting up a new Enviroment  

It is recommended to create a dedicated environment to avoid dependency conflicts.

conda create --name spheroidpy python=3.10 # preferred Version
conda activate spheroidpy

Optionally, Jupyter Notebook can be installed if not already available:

conda install jupyter

  Note

SpheroidPy has been developed and optimized for the usage in Jupyter notebook. While this provides the most flexible and interactive workflow, alternative usage (e.g., scripts or other IDEs) is also possible.


Installation  

Before the package can be used, it need to be installed using one of the following methods.

Using PyPI preferred  

SpheroidPy is available on pypi and can be installed using the following command

pip install SpheroidPy
From Source  

Alternatively, the package can be installed directly from source. Therefore, the repository has to be downloaded. After navigating to the folder containing package, it can be installed using

cd path/to/SpheroidPy             # navigate to the parent folder
pip install .                     # install the package

Requirements  

AI-based Segmentation  

SpheroidPy supports several pretrained deep-learning models for automated segmentation. The desired model can be selected in the configuration (defaults to HRNET):

from SpheroidPy.utils.config import Config, AISegmentationType
Config.ai_segmentation = AISegmentationType.HRNET  # or DETECTRON

If the required pretrained weights are not available locally, they are downloaded automatically upon first use.

HRNET  

HRNet is a high-resolution deep learning architecture that maintains detailed spatial information throughout the segmentation process. This makes it particularly well suited for accurate boundary detection and fine-grained segmentation of spheroids and cellular structures. In SpheroidPy, a pretrained model from Lacalle et al., 2021 is used.

Config.ai_segmentation = AISegmentationType.HRNET
Detectron2  

Detectron2 is a deep learning framework developed by Meta AI for object detection and segmentation tasks. SpheroidPy integrates a pretrained model published by Akshay et al., 2023. For a detailed guide how to download and install Detectron2, please follow the linked instructions for MacOS and Windows. The model can be selected using

Config.ai_segmentation = AISegmentationType.DETECTRON