Skip to content

Repository files navigation

bootstrapper

ci

Bootstrapper makes dense 3D instance segmentations of microscopy volumes from sparse 2D labels.

An unannotated EM volume, sparse 2D annotations on one of its sections, and the dense 3D segmentation that Bootstrapper makes from them

Install

You need uv, a C/C++ compiler, and a GPU for training.

git clone --branch v1.0.0 https://github.com/ucsdmanorlab/bootstrapper.git
cd bootstrapper
uv sync --locked
source .venv/bin/activate    # or put uv run --project <bootstrapper folder> before each command

Watershed (method = "ws") and bs utils merge need the waterz extra, which builds funlib.segment against the Boost headers. Install Boost first: sudo apt install libboost-dev on Ubuntu, or brew install boost and export CPATH=$(brew --prefix)/include on macOS. Then run uv sync --locked --extra waterz. The interactive SAM tool needs the sam extra. Run uv sync --locked --extra sam, and add --extra waterz to keep the waterz extra. Then start the tool with python -i ng_interactive_sam.py <zarr image array>. Add --anon to read a public S3 bucket without AWS credentials. For example, open this cryo-electron tomogram from the CryoET Data Portal dataset 10169 on CPU:

CUDA_VISIBLE_DEVICES= python -i ng_interactive_sam.py --anon s3://cryoet-data-portal-public/10169/cwl2011-10-23-1/Reconstructions/VoxelSpacing20.000/Tomograms/100/cwl2011-10-23-1.zarr/2

Keep the /2 level to load the small array (68 × 256 × 256 voxels). Set the image layer's display range to 33 to 476, because the default float range shows this image as white. The image must follow docs/inputs.md. Bootstrapper rounds fractional OME voxel sizes and offsets to whole nanometers with a warning, and it does not change the source metadata.

Use

A Bootstrapper round trains a model on your labels and segments the volume. The next round can train on that segmentation. Each round is a folder, here round_01.

bs prepare round_01    # asks about your image and your labels
bs run round_01        # trains, predicts and segments
bs view round_01       # prints a link that shows the result in a browser

Your data shows how to give Bootstrapper images and labels, including OME-Zarr inputs. Installation covers system requirements and optional extras. The reference pages cover CLI commands, configuration files, and the Python API.

Example

The figure above shows a run of these commands on CREMI A, with 151 objects traced on one section. The download is 3.9 GB, and 60 MB of it stays on disk. Training takes 23 minutes on one RTX 4090. The CREMI tutorial covers each step, with screenshots, evaluation, and a second training round.

curl -L "https://zenodo.org/records/21223591/files/data.tar?download=1" | tar xf - --strip-components=1 data/cremi_a
bs prepare round_01 --raw cremi_a/volume_1.zarr/raw --labels sparse_labels --labelled sparsely
bs run round_01

How it works

flowchart LR
  A[your 2D labels] --> B[2D network]
  B --> C[2D-to-3D network]
  C --> D[3D segmentation]
  D -. next round .-> E[3D network]
Loading

Each step of a round is a commented file in round_01/, and bs <command> --help lists every option.

Paper

The results in the paper were produced with Bootstrapper v0.3.2. bootstrapper_nm_capsule reruns the experiments with v1.0.0. For questions, contact vvenu@utexas.edu. If you use Bootstrapper, please cite the preprint:

@article {Thiyagarajan2024.06.14.599135,
	author = {Thiyagarajan, Vijay Venu and Sheridan, Arlo and Harris, Kristen M. and Manor, Uri},
	title = {A general method for bootstrapping dense 3D segmentations from sparse 2D annotations},
	journal = {bioRxiv},
	year = {2026},
	doi = {10.1101/2024.06.14.599135},
	URL = {https://doi.org/10.1101/2024.06.14.599135},
}

Funding

Chan-Zuckerberg Imaging Scientist Award DOI https://doi.org/10.37921/694870itnyzk from the Chan Zuckerberg Initiative DAF, an advised fund of Silicon Valley Community Foundation (funder DOI 10.13039/100014989).

NSF NeuroNex Technology Hub Award (1707356), NSF NeuroNex2 Award (2014862)

NSF NeuroNex

Releases

Packages

Used by

Contributors

Languages