Skip to content

Commit 7d19c41

Browse files
Merge branch 'master' into dev
2 parents 529dced + 4c81670 commit 7d19c41

37 files changed

+2696
-3026
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,6 @@ We have also built follow-up work that is based on `micro_sam`:
5858
- https://github.com/computational-cell-analytics/medico-sam - improves SAM for medical imaging.
5959
- https://github.com/computational-cell-analytics/peft-sam - studies parameter efficient fine-tuning for SAM.
6060

61-
## Release Oveverview
61+
## Release Overview
6262

6363
You can find an overview of changes introduced in previous releases [here](https://github.com/computational-cell-analytics/micro-sam/blob/master/RELEASE_OVERVIEW.md).

doc/faq.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,24 @@ If you encounter a problem or question not addressed here feel free to [open an
66
## Installation questions
77

88

9+
### 0. I am not familiar with `conda` / `mamba` / `micromamba` and would like to get started with a python package manager.
10+
If you are getting started from scratch, we recommend using `micromamba` to setup your own package manager and creating a new environment with the required dependencies. You can install `micromamba` by following the instructions [here](https://mamba.readthedocs.io/en/latest/installation/micromamba-installation.html) under the `Automatic install` section. If you are using Linux, macOS, or Git Bash on Windows, the simplest way to of installing `micromamba` is to simply execute the installation script below in your preferred shell:
11+
12+
```bash
13+
"${SHELL}" <(curl -L micro.mamba.pm/install.sh)
14+
```
15+
16+
If you are using Windows PowerShell, you should be able to install `micromamba` by running the following command:
17+
18+
```bash
19+
Invoke-Expression ((Invoke-WebRequest -Uri https://micro.mamba.pm/install.ps1 -UseBasicParsing).Content)
20+
```
21+
22+
Once you have `micromamba` installed, you can create a new environment with the required dependencies by following the [installation](https://computational-cell-analytics.github.io/micro-sam/micro_sam.html#installation) instructions for `micro_sam` (remember to replace `conda` by `micromamba` in the installation commands. For example: to check the list of available environments, `conda env list` becomes `micromamba env list`).
23+
24+
If you have any troubles in the aforementioned steps, remember to first check the [official documentation](https://mamba.readthedocs.io/en/latest/installation/micromamba-installation.html) for troubleshooting details.
25+
26+
927
### 1. How to install `micro_sam`?
1028
The [installation](https://computational-cell-analytics.github.io/micro-sam/micro_sam.html#installation) for `micro_sam` is supported in three ways: [from conda](https://computational-cell-analytics.github.io/micro-sam/micro_sam.html#from-conda) (recommended), [from source](https://computational-cell-analytics.github.io/micro-sam/micro_sam.html#from-source) and [from installers](https://computational-cell-analytics.github.io/micro-sam/micro_sam.html#from-installer). Check out our [tutorial video](https://youtu.be/gcv0fa84mCc) to get started with `micro_sam`, briefly walking you through the installation process and how to start the tool.
1129

doc/installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ We do **not support** installing `micro_sam` with pip.
1111

1212
## From conda
1313

14-
`conda` is a python package manager. If you don't have it installed yet you can follow the instructions [here](https://conda-forge.org/download/) to set it up on your system.
14+
`conda` is a python package manager. If you don't have it installed yet you can follow the instructions [here](https://conda-forge.org/download/) or look into our [installation FAQs](https://computational-cell-analytics.github.io/micro-sam/micro_sam.html#faq) to set it up on your system.
1515
Please make sure that you are using an up-to-date version of conda to install `micro_sam`.
1616
You can also use [mamba](https://mamba.readthedocs.io/en/latest/), which is a drop-in replacement for conda, to install it. In this case, just replace the `conda` commands below with `mamba`.
1717

doc/start_page.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ import micro_sam
4242

4343
It is explained in more detail [here](#using-the-python-library).
4444

45+
We also have a quick start notebook [here](https://github.com/computational-cell-analytics/micro-sam/blob/master/notebooks/quick_start.ipynb).
46+
4547
We provide different finetuned models for microscopy that can be used within our tools or any other tool that supports Segment Anything. See [finetuned models](#finetuned-models) for details on the available models.
4648
You can also train models on your own data, see [here for details](#training-your-own-model).
4749

environment.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,6 @@ dependencies:
2727
- tqdm
2828
- timm
2929
- xarray <2025.3.0
30+
- zarr <3.0
3031
- pip:
3132
- git+https://github.com/ChaoningZhang/MobileSAM.git

examples/.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

examples/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ And python scripts for automatic segmentation and tracking:
1010
- `automatic_segmentation.py`: Run automatic segmentation on 2d images.
1111
- `automatic_tracking.py`: Run automatic tracking on 2d timeseries images.
1212

13+
And examples for using the `micro_sam` automatic segmentation feature:
14+
- `quick_start.py`: run the automatic segmentation feature of `micro_sam` on an example 2d image.
15+
- `automatic_segmentation.py`: run the automatic segmentation feature (with an extensive description) of `micro_sam` on some example data.
16+
1317
We provide Jupyter Notebooks for using automatic segmentation and finetuning on some example data in the [notebooks](../notebooks/) folder.
1418

1519
The folder `finetuning` contains example scripts that show how a Segment Anything model can be fine-tuned

examples/quick_start.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
"""This script is a quick start to the automatic instance segmentation feature
2+
supported by the Segment Anything for Microscopy models.
3+
4+
NOTE: You can install `micro_sam` in a conda environment like: `conda install -c conda-forge micro_sam`
5+
"""
6+
7+
import napari
8+
9+
from skimage.data import cells3d
10+
11+
from micro_sam.automatic_segmentation import get_predictor_and_segmenter, automatic_instance_segmentation
12+
13+
14+
# Load an example image from the 'scikit-image' library.
15+
image = cells3d()[30, 0]
16+
17+
# Load the Segment Anything for Microscopy model.
18+
predictor, segmenter = get_predictor_and_segmenter(model_type="vit_b_lm")
19+
20+
# Run automatic instance segmentation (AIS) on our image.
21+
instances = automatic_instance_segmentation(predictor=predictor, segmenter=segmenter, input_path=image)
22+
23+
# Visualize the image and corresponding instance segmentation result.
24+
v = napari.Viewer()
25+
v.add_image(image, name="Image")
26+
v.add_labels(instances, name="Prediction")
27+
napari.run()

finetuning/README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
# Segment Anything Finetuning
22

3-
Code for finetuning Segment Anything data on microscopy data and evaluating the finetuned models.
3+
**Important!!!!!! Read this before using this code or creating an issue**
4+
5+
This folder contains finetuning and evaluation code for applying Segment Anything model to microscopy data using the `micro_sam` library.
6+
This code was used for our experiments in the publication, but it may become outdated due to changes in function signatures etc., and often does not use the functionality that we recommend
7+
to users. We also don't actively maintain the code here.
8+
Please refer to the [example notebooks](https://github.com/computational-cell-analytics/micro-sam/tree/master/notebooks) and [example scripts](https://github.com/computational-cell-analytics/micro-sam/tree/master/examples) for well maintained and documented `micro_sam` examples.
9+
10+
11+
**Important!!!!!! Read this before using this code or creating an issue**
12+
413

514
## Example: LIVECell
615

finetuning/evaluation/cellpose_baseline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from micro_sam.evaluation.evaluation import run_evaluation
1010

1111
# from util import get_paths # for hlrn
12-
from util import get_pred_paths
12+
from util import get_pred_paths
1313

1414

1515
# EXPERIMENT_ROOT = "/scratch/projects/nim00007/sam/experiments/benchmarking/cellpose" # for hlrn

0 commit comments

Comments
 (0)