# cuisto: A Python package to quantify neurohistological data from QuPath and ABBA

Guillaume Le Goc, Alexis D'humières, Antoine Lesage, Julien Bouvier

► To cite this version:

Guillaume Le Goc, Alexis D'humières, Antoine Lesage, Julien Bouvier. cuisto: A Python package to quantify neurohistological data from QuPath and ABBA. Journal of Open Source Software, 2025, 10 (111), pp.7906. 10.21105/joss.07906. hal-05199559

HAL Id: hal-05199559

https://hal.science/hal-05199559v1

Submitted on 5 Aug 2025

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
# cuisto: A Python package to quantify neurohistological data from QuPath and ABBA

Guillaume Le Goc¹, Alexis d'Humières¹, Antoine Lesage¹, and Julien Bouvier¹¶

1 Université Paris-Saclay, CNRS, Institut des Neurosciences Paris-Saclay, 91400, Saclay, France ¶
Corresponding author

DOI: 10.21105/joss.07906

## Software

- Review 🐰

- Repository 🐰

- Archive 🐰

Editor: Adam Tyson 🐰

## Reviewers:

- @IgorTatarnikov

- @PolarBean

Submitted: 29 January 2025

Published: 03 July 2025

## License

Authors of papers retain copyright and release the work under a Creative Commons Attribution 4.0 International License (CC BY 4.0).

## Summary

Fluorescent labeling techniques, including immunohistochemistry and endogenously fluorescent proteins, are key assets in neuroscience. Combined to genetic toolboxes, they enable the anatomical identification of specific neurons and neuronal processes, shedding light on neural networks organization and linking behavior to brain structures. Advances in imaging techniques and numerical tools have enabled the creation of volumetric, annotated, whole-brain atlases of various animal models (Kleven et al., 2023; Kunst et al., 2019; Lazcano et al., 2021; Wang et al., 2020) facilitating brain-wide mapping of labeled elements to a reference three-dimensional space. In this framework, a common task is to count, in the reference brain regions, objects of interest (be it whole cells, nuclei, axons, synaptic puncta...) detected in 2D histological slices imaged with fluorescence microscopy.

Multiple software solutions exist to perform image analysis for object detection, and tools to register 2D slices to 3D reference atlases are also available. The cuisto package aims at bridging these pieces of software together to provide a streamlined process, from raw images to quantification figures. It harnesses the output of the bioimage analysis software QuPath (Bankhead et al., 2017) used together with the registration toolbox ABBA (Chiaruttini et al., 2025). Designed with users who have minimal programming knowledge in mind, it is configurable and intended to be atlas- and staining-agnostic to cover various use-cases, and provides utility scripts that can be used throughout the analysis pipeline. Furthermore, extensive documentation is provided, and includes 1) the installation of the various pieces of software used upstream of the cuisto package, 2) ABBA and QuPath tutorials, 3) in-depth explanation of the data formatting requirements and 4) hands-on examples with Python scripts and Jupyter notebooks.

## Statement of need

As the task of counting objects in brain regions from fluorescent microscopy images is widespread, several toolboxes have been developed for brain-wide object quantification such as the QUINT workflow (Yates et al., 2019). The pipeline relies on QuickNII and VisuAlign (Puchades et al., 2019) for the registration and Ilastik (Berg et al., 2019) for the segmentation. While effective for specific tasks, such as counting punctal objects, its architecture offers limited flexibility, making it hard to take shortcuts during the workflow, and it is not interoperable with other computational neuroanatomical tools, notably reference atlases provided by BrainGlobe (Claudi et al., 2020). The latter does provide numerous tools to perform brain-wide cell counting (Tyson et al., 2021, 2022) but is primarily designed for native 3D data (such as obtained from light sheet imaging of optically cleared tissue). This approach is however not readily accessible to all laboratories and may show variable efficacy depending on the fluorophore used, the
intended resolution, or the targeted brain structures.

The QuPath software provides a full-featured, user-friendly interface to perform image quantification while being extensible and scriptable. It is being actively developed and is supported by a vibrant community (more than 4k topics tagged with "qupath" on the image.sc forum and more than 4k citations). This software supports a variety of segmentation strategies, from basic thresholding to pixel classification and advanced deep learning methods such as CellPose (Stringer et al., 2021), StarDist (Schmidt et al., 2018) and InstanSeg (Goldsborough et al., 2024). The Fiji (Schindelin et al., 2012) plugin Aligning Big Brain and Atlases (ABBA) allows for semi-automated registration of whole-brain 2D sections to a 3D atlas in an intuitive and interactive graphical user interface using native full-resolution multichannel images, providing both automatic in-plane registration through elastix (Klein et al., 2010) and manual adjustment with BigWarp (Bogovic et al., 2016). It also supports the deep-learning-based automatic registration tool DeepSlice (Carey et al., 2023) and can be interfaced with BrainGlobe atlases. Furthermore, it integrates seamlessly with QuPath, to both import images and export back the registration results as annotations in QuPath for further quantification.

Yet, to our knowledge, no streamlined pipeline existed to bridge the image processing and
registration with the region-based quantification and data visualization. The present work is
two-fold:

1. Provide step-by-step guides to install and use QuPath and ABBA to quantify and format data for counting objects in a reference brain, providing automation scripts where necessary.

2. Provide a downstream Python package to use the raw counting data exported from QuPath to summarize and display derived metrics with minimal coding knowledge, while being modular enough to fit more advanced users' needs.

Specifically, guides are provided to align 2D histological slices to volumetric reference atlases with ABBA and detect objects of interest in QuPath. cuisto includes an image processing module to segment objects from the prediction maps generated with QuPath's pixel classifier, supporting punctal objects, polygons, and fibers. Guides further cover how to quantify those in the registered atlas regions (either object counting for punctual objects or cumulative length for fiber-like objects), format the data to be used by cuisto, and finally export the results as tabular data (or json files for fiber-like objects).

Subsequently, cuisto is used to collect the data from different subjects, pool them based
on the atlas region names, and derive quantifying metrics from the raw count or cumulative
length. Those metrics include, for each atlas region:

- the raw measurement,

- the areal density, i.e. the raw measurement divided by the region area, and

- the relative density, i.e. the areal density as a fraction of the total density.

Furthermore, cuisto leverages the atlas coordinates of each object of interest to compute
and display spatial distributions in the reference atlas space. 2D projection heatmaps are also
generated and overlaid on the atlas region contours.

cuisto processing and display is configured with human-readable configuration files that
support up to two hemispheres and any number of detection channels to be able to compare
different biological markers. Ultimately, this package aims to be versatile: while it was designed
around BrainGlobe atlases, those are not mandatory and the user can use it with custom
annotated regions instead — as long as the format requirements are met.

It is worth mentioning that BraiAn (Chiaruttini et al., 2025), a toolbox following a similar
purpose, was released during the development of the present work, but also provides a Java
API for the QuPath side, while cuisto provides simpler, standalone QuPath scripts.

The documentation and the examples provide toy data, derived from datasets acquired on mice
models. All procedures were approved by the French Ethical Committee ("Comité d'éthique
en Expérimentation Animale", CEEA #59, authorization 2020-022410231878) and conducted
in accordance with EU Directive 2010/63/EU.

## Acknowledgements

We would like to thank the original author of QuPath, Peter Bankhead, and all contributors. We also thank the original author of ABBA, Nicolas Chiaruttini, especially for his support on ABBA-Python. We thank all contributors of the BrainGlobe Initiative. We're grateful to member of the lab Patricia del Cerro de Pablo for her early feedback. This work has received funding from the European Research Council (ERC) under the European Union's Horizon Europe research and innovation program (grant agreement No 101089318), the Fondation pour la Recherche Médicale (FRM EQU202203014620 and ECO202206015594), the CNRS and the University Paris-Saclay.

## References

Bankhead, P., Loughrey, M. B., Fernández, J. A., Dombrowski, Y., McArt, D. G., Dunne, P. D., McQuaid, S., Gray, R. T., Murray, L. J., Coleman, H. G., James, J. A., Salto-Tellez, M., & Hamilton, P. W. (2017). QuPath: Open source software for digital pathology image analysis. *Scientific Reports*, 7(1), 16878. https://doi.org/10.1038/s41598-017-17204-5

Berg, S., Kutra, D., Kroeger, T., Straehle, C. N., Kausler, B. X., Haubold, C., Schiegg, M., Ales, J., Beier, T., Rudy, M., Eren, K., Cervantes, J. I., Xu, B., Beuttenmueller, F., Wolny, A., Zhang, C., Koethe, U., Hamprecht, F. A., & Kreshuk, A. (2019). Ilastik: Interactive machine learning for (bio)image analysis. *Nature Methods*, 16(12), 1226-1232. https://doi.org/10.1038/s41592-019-0582-9

Bogovic, J. A., Hanslovsky, P., Wong, A., & Saalfeld, S. (2016). Robust registration of calcium images by learned contrast synthesis. *2016 IEEE 13th International Symposium on Biomedical Imaging (ISBI)*, 1123-1126. https://doi.org/10.1109/ISBI.2016.7493463

Carey, H., Pegios, M., Martin, L., Saleeba, C., Turner, A. J., Everett, N. A., Bjerke, I. E., Puchades, M. A., Bjaalie, J. G., & McMullan, S. (2023). DeepSlice: Rapid fully automatic registration of mouse brain imaging to a volumetric atlas. *Nature Communications*, 14(1), 5884. https://doi.org/10.1038/s41467-023-41645-4

Chiaruttini, N., Castoldi, C., Requie, L. M., Camarena-Delgado, C., Dal Bianco, B., Gräff, J., Seitz, A., & Silva, B. A. (2025). ABBA+BraiAn, an integrated suite for whole-brain mapping, reveals brain-wide differences in immediate-early genes induction upon learning. *Cell Reports*, 44(7), 115876. https://doi.org/10.1016/j.celrep.2025.115876

Claudi, F., Petrucco, L., Tyson, A., Branco, T., Margrie, T., & Portugues, R. (2020). BrainGlobe Atlas API: A common interface for neuroanatomical atlases. *Journal of Open Source Software*, 5(54), 2668. https://doi.org/10.1101/joss.02668

Goldsborough, T., O'Callaghan, A., Inglis, F., Leplat, L., Filby, A., Bilen, H., & Bankhead, P. (2024). A novel channel invariant architecture for the segmentation of cells and nuclei in multiplexed images using InstanSeg. *bioRxiv*. https://doi.org/10.1101/2024.09.04.611150

Klein, S., Staring, M., Murphy, K., Viergever, M. A., & Pluim, J. (2010). Elastix: A Toolbox for Intensity-Based Medical Image Registration. *IEEE Transactions on Medical Imaging*, 29(1), 196-205. https://doi.org/10.1109/TMI.2009.2035616

Kleven, H., Bjerke, I. E., Clascá, F., Groenewegen, H. J., Bjaalie, J. G., & Leergaard, T. B. (2023). Waxholm Space atlas of the rat brain: A 3D atlas supporting data analysis and integration. *Nature Methods*, 20(11), 1822-1829. https://doi.org/10.1038/s41592-023-02034-3
Kunst, M., Laurell, E., Mokayes, N., Kramer, A., Kubo, F., Fernandes, A. M., Förster, D., Dal Maschio, M., & Baier, H. (2019). A Cellular-Resolution Atlas of the Larval Zebrafish Brain. *Neuron*, **103**(1), 21–38.e5. https://doi.org/10.1016/j.neuron.2019.04.034

Lazcano, I., Cisneros-Mejorado, A., Concha, L., Ortiz-Retana, J. J., Garza-Villarreal, E. A., & Orozco, A. (2021). MRI- and histologically derived neuroanatomical atlas of the Ambystoma mexicanum (axolotl). *Scientific Reports*, **11**(1), 9850. https://doi.org/10.1038/s41598-021-89357-3

Puchades, M. A., Csucs, G., Ledergerber, D., Leergaard, T. B., & Bjaalie, J. G. (2019). Spatial registration of serial microscopic brain images to three-dimensional reference atlases with the QuickNII tool. *PLOS ONE*, **14**(5), e0216796. https://doi.org/10.1371/journal.pone.0216796

Schindelin, J., Arganda-Carreras, I., Frise, E., Kaynig, V., Longair, M., Pietzsch, T., Preibisch, S., Rueden, C., Saalfeld, S., Schmid, B., Tinevez, J.-Y., White, D. J., Hartenstein, V., Eliceiri, K., Tomancak, P., & Cardona, A. (2012). Fiji: An open-source platform for biological-image analysis. *Nature Methods*, **9**(7), 676–682. https://doi.org/10.1038/nmeth.2019

Schmidt, U., Weigert, M., Broaddus, C., & Myers, G. (2018). Cell Detection with Star-Convex Polygons. In A. F. Frangi, J. A. Schnabel, C. Davatzikos, C. Alberola-López, & G. Fichtinger (Eds.), *Medical Image Computing and Computer Assisted Intervention – MICCAI 2018* (Vol. 11071, pp. 265–273). Springer International Publishing. https://doi.org/10.1007/978-3-030-00934-2_30

Stringer, C., Wang, T., Michaelos, M., & Pachitariu, M. (2021). Cellpose: A generalist algorithm for cellular segmentation. *Nature Methods*, **18**(1), 100–106. https://doi.org/10.1038/s41592-020-01018-x

Tyson, A. L., Rousseau, C. V., Niedworok, C. J., Keshavarzi, S., Tsitoura, C., Cossell, L., Strom, M., & Margrie, T. W. (2021). A deep learning algorithm for 3D cell detection in whole mouse brain image datasets. *PLOS Computational Biology*, **17**(5), e1009074. https://doi.org/10.1371/journal.pcbi.1009074

Tyson, A. L., Vélez-Fort, M., Rousseau, C. V., Cossell, L., Tsitoura, C., Lenzi, S. C., Obenhaus, H. A., Claudi, F., Branco, T., & Margrie, T. W. (2022). Accurate determination of marker location within whole-brain microscopy images. *Scientific Reports*, **12**(1), 867. https://doi.org/10.1038/s41598-021-04676-9

Wang, Q., Ding, S.-L., Li, Y., Royall, J., Feng, D., Lesnar, P., Graddis, N., Naeemi, M., Facer, B., Ho, A., Dolbeare, T., Blanchard, B., Dee, N., Wakeman, W., Hirokawa, K. E., Szafer, A., Sunkin, S. M., Oh, S. W., Bernard, A., ... Ng, L. (2020). The Allen Mouse Brain Common Coordinate Framework: A 3D Reference Atlas. *Cell*, **181**(4), 936–953.e20. https://doi.org/10.1016/j.cell.2020.04.007

Yates, S. C., Groeneboom, N. E., Coello, C., Lichtenthaler, S. F., Kuhn, P.-H., Demuth, H.-U., Hartlage-Rübsamen, M., Roßner, S., Leergaard, T., Kreshuk, A., Puchades, M. A., & Bjaalie, J. G. (2019). QUINT: Workflow for Quantification and Spatial Analysis of Features in Histological Images From Rodent Brain. *Frontiers in Neuroinformatics*, **13**, 75. https://doi.org/10.3389/fninf.2019.00075