cellcast: A recast of cell segmentation models
This crate contains the cellcast core Rust library. Cellcast is a recast of cell segmentation models built on the Burn tensor and deep learning framework. The goal of this project is to modernize (i.e. recast) established cell segmentation models with a WebGPU backend. Cellcast aims to make access to cell segmentation models easy and reproducible.
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.2.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 predict_versatile_fluo;
Note: T here can be any numeric value (i.e. u8, i32, f64).
Building from source
You can build the cellcast core library with:
This will compile a cellcast without optimizations. Pass the --release flag to compile an optimized release version (note that compilation time may take upwards
of 10 minutes). Because cellcast is a library, compiling it on it's own isn't very useful. However being able to successfully compile cellcast on your own computer
means that you can change the backend from Wgpu to whatever other supported Burn backend
you want. Recompiling cellcast with a different backend may allow you to take advantage of hardware specific optimizations not available to the Wgpu backend.
Each model defines it's own backend parameters at the start of the file. For example the StarDist2D versatile fluo model defines the Wgpu and NdArray (for CPU inference)
backends like this:
type NdArrayBackend = ;
type WgpuBackend = ;
Change the Wgpu backend to whatever one you want (e.g Cuda) and recompile your Rust project. If you are using cellcast_python, then make the necessary backend
changes to the cellcast core library and recompile the project for python in the cellcast_python crate directory with maturin.
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.