Pipeline to detect individual nuclei in crowded immunofluorescence images. Effective in 2D embryo sections and single-z plane images. Additionally, a range of tools are available for estimating 3D nuclei in whole-embryo, organoid, or embryo model confocal microscopy stacks.
Please find installation notes below. To detect nuclei in your own image of interest I recommend you first following one of the two example notebooks.
2D notebook example: Nucleus_Predict_2D. Example images here and here.
3D notebook example: Nucleus_Predict_3D.
Please note, we mostly tested:
- DAPI nuclear stains
- Resolutions of 3.5 to 6 pixels/μm (typically with 40-60X objectives on a Leica SP8/ Zeiss LSM710)
- The size of the images should be a multiple of 128, e.g. 1024x2084. There is a check in the pipeline for this.
Ideally, a 256x256 pixels crop of your images should look similar to the images the network was trained on. See below some examples.
This table shows the main datasets used to train and validate our models. These are available here.
#images | #instances | size | comments | |
---|---|---|---|---|
nucleus_train | 6 | 221 | 256*256 | in vitro hESC assay |
nucleus_val (validation) | 4 | 141 | 256*256 | in vitro hESC assay |
kromp_ 2019 | 52 | 1,704 | 640*512 | curated from Kromp et al. (2019) |
segm_512 | 3 | 566 | 512*512 | in vitro hESC assay |
SC_human | 4 | X | 256*256 | Spinal Cord sections |
SC_mouse | 6 | X | 256*256 | Spinal Cord sections |
SC_sections (validation) | 5 | X | 256*256 | Spinal Cord sections |
Distribution of the maximum length of the nuclei in the different datasets.
Make sure you have access to GPU. This package uses python 3.9.
Download PyTorch models for Nucleus at https://zenodo.org/records/11388472/files/Nucleus_models.gz?download=1
git clone https://github.com/tiagu/Nucleus
uv venv nucleus-2 --seed --python python3.9
source nucleus-2/bin/activate
uv pip install torch==1.10 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu113
uv pip install --upgrade pip
# deal with new incompatible versions
uv pip install Pillow==9.5 jupyterlab
uv pip install numpy==1.21.6 contourpy matplotlib scikit-image scipy pandas opencv-python tqdm
python -m pip install detectron2==0.6 -f https://dl.fbaipublicfiles.com/detectron2/wheels/cu113/torch1.10/index.html
For slurm users, please see run_nucleus.sh on utils folder.