MCPcopy Index your code
hub / github.com/MIC-DKFZ/napari-sam

github.com/MIC-DKFZ/napari-sam @v0.4.13

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.4.13 ↗ · + Follow
56 symbols 174 edges 5 files 5 documented · 9%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Segment Anything Model (SAM) in Napari

License Apache Software License 2.0 PyPI Python Version tests codecov napari hub

Segment anything with our Napari integration of Meta AI's new Segment Anything Model (SAM)!

SAM is the new segmentation system from Meta AI capable of one-click segmentation of any object, and now, our plugin neatly integrates this into Napari.

We have already extended SAM's click-based foreground separation to full click-based semantic segmentation and instance segmentation!

At last, our SAM integration supports both 2D and 3D images!


Everything mode Click-based semantic segmentation mode Click-based instance segmentation mode

SAM in Napari demo

https://user-images.githubusercontent.com/3471895/236152620-0de983db-954b-4480-97b9-901ee82f8edd.mp4


Installation

The plugin requires python>=3.8, as well as pytorch>=1.7 and torchvision>=0.8. Please follow the instructions here to install both PyTorch and TorchVision dependencies. Installing both PyTorch and TorchVision with CUDA support is strongly recommended.

Install Napari via pip:

pip install napari[all]

You can install napari-sam via pip:

pip install git+https://github.com/facebookresearch/segment-anything.git
pip install napari-sam

To install latest development version :

pip install git+https://github.com/MIC-DKFZ/napari-sam.git

Usage

Start Napari from the console with:

napari

Then navigate to Plugins -> Segment Anything (napari-sam) and drag & drop an image into Napari. At last create, a labels layer that will be used for the SAM predictions, by clicking in the layer list on the third button.

You can then auto-download one of the available SAM models (this can take 1-2 minutes), activate one of the annotations & segmentation modes, and you are ready to go!

Contributing

Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.

License

Distributed under the terms of the Apache Software License 2.0 license, "napari-sam" is free and open source software

Issues

If you encounter any problems, please file an issue along with a detailed description.

Acknowledgements

napari-sam is developed and maintained by the Applied Computer Vision Lab (ACVL) of Helmholtz Imaging and the Division of Medical Image Computing at the German Cancer Research Center (DKFZ).

Core symbols most depended-on inside this repo

_save_history
called by 6
src/napari_sam/_widget.py
update_bbox_layer
called by 5
src/napari_sam/_widget.py
get_layer_names
called by 4
src/napari_sam/_widget.py
_check_activate_btn
called by 3
src/napari_sam/_widget.py
do_bbox_click
called by 3
src/napari_sam/_widget.py
update_points_layer
called by 3
src/napari_sam/_widget.py
get_cached_weight_types
called by 3
src/napari_sam/_widget.py
normalize
called by 3
src/napari_sam/utils.py

Shape

Method 47
Function 5
Class 4

Languages

Python100%

Modules by API surface

src/napari_sam/_widget.py51 symbols
src/napari_sam/utils.py4 symbols
src/napari_sam/slicer.py1 symbols

For agents

$ claude mcp add napari-sam \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page