Skip to main content

Automated 3D cell detection and registration of whole-brain images

Project description

Python Version PyPI Downloads Wheel Development Status Travis Coverage Status Dependabot Status Code style: black Gitter DOI Contributions Website Twitter


Whole-brain cell detection, registration and analysis.

Cellfinder is a collection of tools from the Margrie Lab and others at the Sainsbury Wellcome Centre for the analysis of whole-brain imaging data such as serial-section imaging and lightsheet imaging in cleared tissue.

The aim is to provide a single solution for:

  • Cell detection (initial cell candidate detection and refinement using deep learning).
  • Atlas registration (using amap)
  • Analysis of cell positions in a common space

Installation is with pip install cellfinder.

Basic usage:

cellfinder -s signal_images -b background_images -o output_dir --metadata metadata

Full documentation can be found here.

This software is at a very early stage, and was written with our data in mind. Over time we hope to support other data types/formats. If you have any questions or issues, please get in touch by email, gitter or by raising an issue.



cellfinder takes a stitched, but otherwise raw whole-brain dataset with at least two channels:

  • Background channel (i.e. autofluorescence)
  • Signal channel, the one with the cells to be detected:

raw Raw coronal serial two-photon mouse brain image showing labelled cells

Cell candidate detection

Classical image analysis (e.g. filters, thresholding) is used to find cell-like objects (with false positives):

raw Candidate cells (including many artefacts)

Cell candidate classification

A deep-learning network (ResNet) is used to classify cell candidates as true cells or artefacts:

raw Cassified cell candidates. Yellow - cells, Blue - artefacts

Registration and segmentation (amap)

Using amap, cellfinder aligns a template brain and atlas annotations (e.g. the Allen Reference Atlas, ARA) to the sample allowing detected cells to be assigned a brain region.

This transformation can be inverted, allowing detected cells to be transformed to a standard anatomical space.

raw ARA overlaid on sample image

Analysis of cell positions in a common anatomical space

Registration to a template allows for powerful group-level analysis of cellular disributions. (Example to come)


(more to come)

Tracing of inputs to retrosplenial cortex (RSP)

Input cell somas detected by cellfinder, aligned to the Allen Reference Atlas, and visualised in brainrender along with RSP.


Data courtesy of Sepiedeh Keshavarzi and Chryssanthi Tsitoura. Details here

Additional tools

cellfinder is packaged with neuro which provides additional tools for the analysis of visualisation of whole-brain imaging data. See the documentation for details.

Heatmaps of detected cells:


Mapping non-cellular volumes in standard space:

Virus injection site within the superior colliculus.

(Data courtesy of @FedeClaudi and brainrender) injection

Mapping of probe tracks in standard space:

Neuropixels probe in primary visual cortex.

(Data courtesy of @velezmat). injection

Citing cellfinder

If you find cellfinder useful, and use it in your research, please cite this repository:

Adam L. Tyson, Charly V. Rousseau, Christian J. Niedworok and Troy W. Margrie (2020). cellfinder: automated 3D cell detection and registration of whole-brain images. doi:10.5281/zenodo.3665329

If you use any of the image registration functions in cellfinder, please also cite amap.

Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for cellfinder, version 0.3.14rc7
Filename, size File type Python version Upload date Hashes
Filename, size cellfinder-0.3.14rc7-cp36-cp36m-manylinux2014_x86_64.whl (2.4 MB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size cellfinder-0.3.14rc7-cp36-cp36m-win_amd64.whl (359.0 kB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size cellfinder-0.3.14rc7-cp37-cp37m-manylinux2014_x86_64.whl (2.4 MB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size cellfinder-0.3.14rc7-cp37-cp37m-win_amd64.whl (359.2 kB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size cellfinder-0.3.14rc7.tar.gz (606.2 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page