Advanced cell segmentation with StarDist
If you haven’t installed Napari, please do so before proceeding with this tutorial. If you just want to practice this tutorial, install the following minimal installation:
conda create -n napari_bioimage_analysis -y python=3.9 mamba
conda activate napari_bioimage_analysis
mamba install -y napari napari-assistant napari-simpleitk-image-processing stardist-napari
StarDist: A deep learning-based cell segmentation tool
Another versatile and powerful segmentation tool is StarDistꜛ. StarDist is based on a combined method of neural networks and probability density estimation. It utilizes a neural network to identify the positions of cell nuclei and perform an initial segmentation. Subsequently, a probability density estimation is applied to the initial segmentation to generate precise cell contours. StarDist is particularly useful for segmenting heavily overlapping or densely packed cells. In this tutorial, we will use StarDist for segmenting fine cell structures such as nuclei.
Using StarDist in Napari
StarDist comes with the stardist-napariꜛ Napari plugin. Its usage is as straightforward as for any other Napari plugin. Simply open the StarDist plugin widget via the Plugins
menu, select the input image layer, select the appropriate model for your underlying image (2D or 3D) and specify the axes of your image. When you are done, just the Run
button. The run button is grayed out when one or more properties are not set correctly.
The segmentation result will be displayed as new layers in the layer list and you can evaluate the segmented image parts with the Measurement
function from the Tools->Measurement tables
menu (see “Feature extraction” in Chapter “Image segmentation and feature extraction”).
Comparing StarDist with Cellpose
While Cellpose is also able to segment cell nuclei, for the underlying image, StarDist achieves a better segmentation result:
This is due to the fact that StarDist is trained on a larger and more diverse data set. However, StarDist is not able to segment the cytoplasm of the cells. In general, the segmentation performance also dependents on the underlying image complexity, thus, one should not commit to only one method, but try different methods and compare the results.
Further readings
- GitHub repository of the Napari StarDist pluginꜛ including a detailed documentation
- GitHub repository of StarDistꜛ
- StarDist’s Napari hub pageꜛ
- StarDist tutorial on multi-class classificationꜛ
- Uwe Schmidt, Martin Weigert, Coleman Broaddus, and Gene Myers. Cell Detection with Star-convex Polygons. International Conference on Medical Image Computing and Computer-Assisted Intervention (MICCAI), Granada, Spain, September 2018.
- Martin Weigert, Uwe Schmidt, Robert Haase, Ko Sugawara, and Gene Myers. Star-convex Polyhedra for 3D Object Detection and Segmentation in Microscopy. The IEEE Winter Conference on Applications of Computer Vision (WACV), Snowmass Village, Colorado, March 2020
Acknowledgements
The data file used in this tutorial is an excerpt from the example data set of Napari PartSeg pluginꜛ