computational-cell-analytics/micro-sam
Segment Anything for Microscopy
micro‑sam – Segment Anything for Microscopy
What it is – micro_sam is an open‑source Python library and a set of napari plugins that bring Meta’s Segment Anything Model (SAM) to biological microscopy. It lets researchers interactively segment 2‑D and 3‑D microscopy images (e.g., cells, mitochondria) and even track objects over time with just a few clicks.
Why it matters – Microscopy data are often large and heterogeneous, making manual annotation tedious. By leveraging SAM’s foundation model and providing microscopy‑specific fine‑tuned weights, micro_sam offers fast, high‑quality masks without the need for large training datasets.
Core capabilities
| Feature | What you get |
|---|---|
| Interactive 2‑D segmentation | Click‑based prompts (points, boxes, brushes) inside napari to obtain cell‑level masks instantly. |
| Interactive 3‑D segmentation | Same prompt workflow extended to volumetric stacks (e.g., electron‑microscopy). |
| Interactive tracking | After segmenting each frame, the plugin can link masks across time, producing cell‑track lineages. |
| Microscopy‑specific fine‑tuned models | Pre‑trained SAM weights adapted for fluorescence, bright‑field, EM, etc.; includes tiny‑ViT models for low‑resource setups. |
| Automatic prompt generation (APG) | Optional module that proposes prompts automatically for fully‑automatic segmentation. |
| Parameter‑efficient fine‑tuning (PEFT‑SAM) | Tools to adapt SAM to new microscopy modalities with minimal GPU memory. |
| Integration with other tools | Compatible with napari, WebKnossos, QuPath; can be called from scripts or notebooks. |
Getting started
- Install – Available on PyPI, conda‑forge, and as a napari plugin:
pip install micro_sam # or conda install -c conda-forge micro_sam - Launch – Open napari and add the
micro‑samplugin (e.g., Plugins → micro‑sam → Interactive 2‑D Segmentation). - Use – Load an image stack, place a few prompts, and press Run to obtain masks. For tracking, run the tracking widget after segmenting each frame.
- Learn more – Full docs, quick‑start video, and a YouTube tutorial series are linked from the README.
Who should use it?
- Cell biologists, neurobiologists, and EM specialists who need fast, reproducible segmentation of cells, organelles, or sub‑cellular structures.
- Image‑analysis core facilities looking for a plug‑and‑play solution that integrates with existing napari workflows.
- Developers interested in extending SAM to new microscopy modalities or building custom fine‑tuning pipelines.
How to contribute
The project welcomes documentation edits, bug fixes, and new features. Contributors should open an issue first, then follow the guidelines in CONTRIBUTING.md. A Code of Conduct is enforced for all participants.
Cite the work
If you use micro_sam in a publication, cite the accompanying Nature Methods paper, the original SAM paper, and any specialized components you employ (Mobile‑SAM, Trackastra, APG, etc.). DOI for the software itself is https://doi.org/10.5281/zenodo.7919746.
Related ecosystem
- Other napari‑SAM plugins:
napari-sam,napari-segment-anything,napari-SAM4IS(mostly 2‑D). - Down‑stream projects built on
micro_sam:patho-sam(histopathology),medico-sam(medical imaging),peft-sam(parameter‑efficient fine‑tuning).
Bottom line – micro_sam turns the powerful, general‑purpose Segment Anything model into a practical, microscopy‑focused tool that works inside the popular napari viewer, enabling fast interactive segmentation and tracking for a wide range of biological imaging data.
Related
- Project
- Project
- Project
- Project
- Project