Skip to content

Cell Segmentation Guide

This guide helps you choose the optimal segmentation method for your bacterial images and achieve the best possible cell detection results.

🎯 Overview

napari-mAIcrobe offers four main segmentation approaches:

Method Type Training Required Speed Accuracy
⭐ StarDist Deep Learning ✅ Custom model Medium High
🔬 Cellpose Deep Learning ❌ Pre-trained Medium High
🧠 U-Net Deep Learning ✅ Custom model Medium High
⚡ Thresholding Classical ❌ None Fast Medium

⭐ StarDist Models

Best for: Star-convex shaped cells (most bacteria)

Key Features - Purpose: Deep learning-based segmentation for star-convex shapes - Performance: High accuracy for bacterial cells - Requirement: Custom trained model needed

Getting Started 1. Train with our example notebook: mAIcrobe/notebooks/StarDistSegmentationTraining.ipynb 2. See StarDist training examples in the official repo

Note: mAIcrobe doesn't include pre-trained StarDist models—you must provide your own.


🔬 Cellpose Models

Best for: General cell segmentation across diverse cell types

  • Purpose: Universal deep learning segmentation model
  • Ready to use: Pre-trained cyto3 model included
  • Versatile: Trained on diverse cell types and imaging modalities

Usage: Select "CellPose cyto3" in the segmentation widget.


🧠 U‑Net Models

Best for: Custom applications with specific imaging conditions

  • Format: Keras model files (.keras)
  • Model output: 0 background, 1 boundary, 2 interior
  • mAIcrobe converts to individual cell labels via watershed

Training resources: ZeroCostDL4Mic; Watershed via scikit-image.


⚡ Thresholding-Based Methods

Best for: Quick analysis without training requirements

Available Methods - Isodata Thresholding (global) - Local Average Thresholding (adaptive)

Processing Pipeline 1. Threshold → Binary image 2. Distance transform → Separate touching cells 3. Watershed → Individual cell labels


📏 Validation and Quality Control

Manual Validation Checklist - Sample size: Check 50–100 cells randomly - Visual inspection: under/over-segmentation, boundary accuracy, missing cells

Automated Quality Indicators - Cell count consistency across similar images (±10%) - Reasonable size distribution, few outliers


🧭 Choosing the Right Method

Your Situation Recommended Method
Quick start, no training Cellpose cyto3
Very fast, simple images Isodata thresholding
Best accuracy, have training data StarDist (custom)
Specific imaging conditions U-Net (custom)
Uneven illumination Local average thresholding

Next: Learn how to analyze your segmented cells in the Cell Analysis Guide.