cellcast: A recast of cell segmentation models
Usage
Using cellcast with Rust
To use cellcast in your Rust project add it to your crate's dependencies and import the desired models.
[]
= "0.1.0"
The example below demonstrates how to use cellcast and the StarDist 2D versatile fluo segmentation model with Rust.
This example assumes you have the appropriate dependencies and helper functions to load your data as an
Array2<T> type:
use Array2;
use stardist_2d_versatile_fluo;
Using cellcast with Python
You can use cellcast with Python by using the cellcast_python crate. Pre-compiled releases are available on PyPI as the cellcast package
and can be easily installed with pip:
The cellcast Python package currently supports the following architectures:
| Operating System | Architecture |
|---|---|
| Linux | amd64 |
| macOS | intel, arm64 |
| Windows | amd64 |
These binaries are compiled for Python 3.10, 3.11, 3.12, 3.13 and 3.14.
The example below demonstrates how to use cellcast and the StarDist 2D versatile fluo segmentation model with Python.
Note that this example assumes you have access to 2D data and tifffile installed in your Python
environment with cellcast:
# load 2D data for inference
=
# run stardist inference and produce instance segmentations
=
Building from source
You can build the entire cellcast project from the root of this repository with:
This will compile a non-optimized cellcast binaries. Pass the --release flag to
compile optimized binaries (note that compilation time may take upwards of 10 minutes).
Build cellcast_python from source
To build and install cellcast for Python from source first install the Rust toolchain from rust-lang.org.
Next create a Python environment (we recommend using uv) with the maturin development tool in the "cellcast_python" directory:
This will create the environment for you with maturin. Next activate your environment and install the cellcast library with:
)
This will compile cellcast as a non-optimized binary with debug symbols. This decreases compile time by skipping compiler optimizations
and retaining debug symbols. To build optimized binaries of cellcast you must pass the --release flag. Note that this significantly increases
compilation times to ~6-7 minutes.
)
You can also run uv sync in the "cellcast_python" directory to create a Python environment and compile cellcast. Note that this installation
path uses the --release flag to compile cellcast, expect longer compile and installation times.
License
Cellcast itself is a dual-licensed project with your choice of:
- MIT License (see LICENSE-MIT)
- The Unlicense (see LICENSE-UNLICENSE)
These licenses only apply to the cellcast project and do not apply to the individual models supported by cellcast. You can find each model's associated license listed in the MODEL-LICENSES file.