Skip to main content

a package to quantify atlas registered brain data

Project description

PyNutil

PyNutil is under development.

PyNutil is a Python library for brain-wide quantification and spatial analysis of features in serial section images from mouse and rat brain. It aims to replicate the Quantifier feature of the Nutil software (RRID: SCR_017183). It builds on registration to a standardised reference atlas with the QuickNII (RRID:SCR_016854) and VisuAlign software (RRID:SCR_017978) and feature extraction by segmentation with an image analysis software such as ilastik (RRID:SCR_015246).

For more information about the QUINT workflow: https://quint-workflow.readthedocs.io/en/latest/

Available Atlases

PyNutil can be run using a custom atlas in .nrrd format (e.g. tests/test_data/Allen_mouse_2017_atlas)

Pynutil can also be used with the atlases available in the BrainGlobe_Atlas API.

Installation

Python package

pip install PyNutil

GUI

download the executable for windows and macOS via the github releases tab

image

Usage

PyNutil requires Python 3.8 or above.

As input, PyNutil requires:

  1. An atlas
  2. A corresponding alignment JSON created with the QuickNII or VisuAlign software.
  3. A segmentation file for each brain section with the features to be quantified displayed with a unique RGB colour code (it currently accepts many image formats: png, jpg, jpeg, etc).
from PyNutil import PyNutil

"""
Here we define a quantifier object
The segmentations should be images which come out of ilastik, segmenting objects-of-interest
The alignment json should be from DeepSlice, QuickNII, or VisuAlign, it defines the sections position in an atlas
The colour says which colour is the object you want to quantify in your segmentation. It is defined in RGB
Finally the atlas name is the relevant atlas from brainglobe_atlasapi or a custom atlas in nrrd format.

basic_example.py (brainglobe_atlasapi)
basic_example_custom_atlas.py (custom atlas)

"""
pnt = PyNutil(
    segmentation_folder='../tests/test_data/non_linear_allen_mouse/segmentations/',
    alignment_json='../tests/test_data/non_linear_allen_mouse/alignment.json',
    colour=[0, 0, 0],
    atlas_name='allen_mouse_25um'
)

pnt.get_coordinates(object_cutoff=0)

pnt.quantify_coordinates()

pnt.save_analysis("PyNutil/test_result/myResults")

PyNutil generates a series of reports in the folder which you specify.

Per-Hemisphere Quantification

If you use an atlas which has a hemisphere map (All brainglobe atlases have this, it is a volume in the shape of the atlas with 1 in the lft hemisphere and 2 in the right) PyNutil will generate per-hemisphere quantifications in addition to total numbers. In addition, PyNutil will also genearte additional per-hemisphere point cloud files for viewing in meshview.

Damage Quantification

The QCAlign tool allows you to mark damaged areas on your section. This means that these damaged areas are excluded from your point clouds. In addition, PyNutil will seperately quantify damaged and undamaged areas. Note the undamaged, and damaged column names.

Meshview json files

PyNutil will produce meshview json files. This can be opened in MeshView for the Allen Mouse or for the Waxholm Rat

https://github.com/user-attachments/assets/d3a43ca9-133e-40d1-a1b9-9a359deabf2d

Interpreting the Results

Each column name has the following definition

Column Definition
idx The atlas ID of the region.
name The name of atlas region.
r The amount of red in the RGB value for for the region colour.
g The amount of green in the RGB value for for the region colour.
b The amount of blue in the RGB value for for the region colour.
Region area Area representing the region on the segmentation in pixel values.
Object count Number of objects located in the region. An object is a disconnected group of pixels
Object pixels Number of pixels representing objects in this region.
Object area Area representing objects in this region (object pixels x pixel scale).
Area fraction Ratio of Object pixels to Region pixels (Object pixels / Region pixels).
Left hemi For each of the other columns, what is that value for the left hemisphere alone
Right hemi For each of the other columns, what is that value for the right hemisphere alone
Damaged For each of the other columns, what is that value for the areas marked damaged alone
Undamaged For each of the other columns, what is that value for the areas marked undamaged alone

Feature Requests

We are open to feature requests 😊 Simply open an issue in the github describing the feature you would like to see.

Acknowledgements

PyNutil is developed at the Neural Systems Laboratory at the Institute of Basic Medical Sciences, University of Oslo, Norway with support from the EBRAINS infrastructure, and funding support from the European Union’s Horizon 2020 Framework Programme for Research and Innovation under the Framework Partnership Agreement No. 650003 (HBP FPA).

Contributors

Harry Carey, Sharon C Yates, Gergely Csucs, Arda Balkir, Ingvild Bjerke, Rembrandt Bakker, Nicolaas Groeneboom, Maja A Puchades, Jan G Bjaalie.

Licence

GNU General Public License v3

Related articles

Yates SC, Groeneboom NE, Coello C, et al. & Bjaalie JG (2019) QUINT: Workflow for Quantification and Spatial Analysis of Features in Histological Images From Rodent Brain. Front. Neuroinform. 13:75. https://doi.org/10.3389/fninf.2019.00075

Groeneboom NE, Yates SC, Puchades MA and Bjaalie JG. Nutil: A Pre- and Post-processing Toolbox for Histological Rodent Brain Section Images. Front. Neuroinform. 2020,14:37. https://doi.org/10.3389/fninf.2020.00037

Puchades MA, Csucs G, Lederberger D, Leergaard TB and Bjaalie JG. Spatial registration of serial microscopic brain images to three-dimensional reference atlases with the QuickNII tool. PLosONE, 2019, 14(5): e0216796. https://doi.org/10.1371/journal.pone.0216796

Carey H, Pegios M, Martin L, Saleeba C, Turner A, Everett N, Puchades M, Bjaalie J, McMullan S. DeepSlice: rapid fully automatic registration of mouse brain imaging to a volumetric atlas. BioRxiv. https://doi.org/10.1101/2022.04.28.489953

Berg S., Kutra D., Kroeger T., Straehle C.N., Kausler B.X., Haubold C., et al. (2019) ilastik:interactive machine learning for (bio) image analysis. Nat Methods. 16, 1226–1232. https://doi.org/10.1038/s41592-019-0582-9

Contact us

Report issues here on Github or email: support@ebrains.eu

Project details


Download files

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

Source Distribution

pynutil-0.2.24.tar.gz (34.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pynutil-0.2.24-py3-none-any.whl (35.4 kB view details)

Uploaded Python 3

File details

Details for the file pynutil-0.2.24.tar.gz.

File metadata

  • Download URL: pynutil-0.2.24.tar.gz
  • Upload date:
  • Size: 34.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pynutil-0.2.24.tar.gz
Algorithm Hash digest
SHA256 266f178c122548750d18565b695a639be7c4bb53f556547ed583fd5a56884451
MD5 7434dce5111ff91edf7c6c1de3cecd34
BLAKE2b-256 e92c936370a173d6a7526bf8febdb4800b216186c2f29c0a9670a1c314d15ab9

See more details on using hashes here.

Provenance

The following attestation bundles were made for pynutil-0.2.24.tar.gz:

Publisher: publish-to-pypi.yml on Neural-Systems-at-UIO/PyNutil

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pynutil-0.2.24-py3-none-any.whl.

File metadata

  • Download URL: pynutil-0.2.24-py3-none-any.whl
  • Upload date:
  • Size: 35.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pynutil-0.2.24-py3-none-any.whl
Algorithm Hash digest
SHA256 e51e8e34e4d8668d0a95915162fc237b7e11df0fc290382913f36fc82cd83a2a
MD5 eb2391f0915f2d92947758e3261267ff
BLAKE2b-256 4cb594769474ae9aa6f8d126f58172a92298d8641db89cda436accb0d6e614ac

See more details on using hashes here.

Provenance

The following attestation bundles were made for pynutil-0.2.24-py3-none-any.whl:

Publisher: publish-to-pypi.yml on Neural-Systems-at-UIO/PyNutil

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page