A simple Python-based tool for finding brain atlas regions based on MNI coordinates.
Project description
mni-to-atlas
A simple Python-based tool for finding brain atlas regions based on MNI coordinates, with basic plotting abilities to show the sagittal, coronal, and axial views of the coordinates on the atlas.
The following atlases are currently supported:
- Automated anatomical labelling atlas [1]
- Automated anatomical labelling 3 atlas (1mm3 voxel version) [2]
- Human Connectome Project extended parcellation atlas [3]
If there is an atlas you would like to see added, please open an issue.
Example screenshot of the plotting:
Requirements:
See here for the list of requirements.
Use Example:
- Install the package into the desired environment using pip
pip install mni-to-atlas. - Import the
AtlasBrowserclass into your workspace. - Create an instance of the
AtlasBrowserclass and specify an atlas to use (can be "AAL", "AAL3", or "HCPEx"). - Provide MNI coordinates to the
AtlasBrowserobject to find the corresponding atlas regions. The brain regions for these coordinates are then returned as a list of strings.- The coordinates should be an (n x 3) array, where each row contains an x-, y-, and z-axis MNI coordinate.
- By default, plotting the coordinates is not performed, however this can be changed by setting
plot = Truein thefind_regionsmethod. In this case, a figure will be generated for each set of coordinates.
In case your MNI coordinates do not correspond to a defined atlas region (e.g., the coordinates correspond to electrodes above the brain surface), the project_to_nearest method can be used to project the coordinates to the nearest defined atlas region, before finding the brain regions.
# Import the AtlasBrowser class
from mni_to_atlas import AtlasBrowser
import numpy as np
# Instantiate the AtlasBrowser class and specify the atlas to use
atlas = AtlasBrowser("AAL3")
# Define MNI coordinates as an (n x 3) array
coordinates = np.array([[-24, -53, 73],
[-25, 20, 70]])
# Find the brain regions at the MNI coordinates (plotting is optional)
regions = atlas.find_regions(coordinates, plot=True)
assert regions == ["Parietal_Sup_L", "Undefined"]
# Project 'undefined' coordinates to the nearest defined atlas region
projected_coords = atlas.project_to_nearest(coordinates)
projected_regions = atlas.find_regions(projected_coords)
assert np.all(projected_coords == np.array([[-24, -53, 73], [-24, 18, 66]]))
assert projected_regions == ["Parietal_Sup_L", "Frontal_Sup_2_L"]
References:
- Tzourio-Mazoyer et al. (2002) DOI: 10.1006/nimg.2001.0978
- Rolls et al. (2020) DOI: 10.1016/j.neuroimage.2019.116189
- Huang et al. (2022) DOI: 10.1007/s00429-021-02421-6
Project details
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.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mni_to_atlas-1.2.0.tar.gz.
File metadata
- Download URL: mni_to_atlas-1.2.0.tar.gz
- Upload date:
- Size: 675.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d5fef2759f5de6cb59f2d1afec2f14e3ea2fcff03aae5c3b05989996d0b303e
|
|
| MD5 |
27bd481a398a2eadd175405837d2e92c
|
|
| BLAKE2b-256 |
aaf6248994208ea7db9dc902871778f497a30255eeb11e3d2402102bc99997b4
|
Provenance
The following attestation bundles were made for mni_to_atlas-1.2.0.tar.gz:
Publisher:
release.yml on tsbinns/mni_to_atlas
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mni_to_atlas-1.2.0.tar.gz -
Subject digest:
3d5fef2759f5de6cb59f2d1afec2f14e3ea2fcff03aae5c3b05989996d0b303e - Sigstore transparency entry: 734829531
- Sigstore integration time:
-
Permalink:
tsbinns/mni_to_atlas@2b38f2606026bad33f4ce677ffb10b9f3f2a2bef -
Branch / Tag:
refs/tags/v1.2.0 - Owner: https://github.com/tsbinns
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2b38f2606026bad33f4ce677ffb10b9f3f2a2bef -
Trigger Event:
release
-
Statement type:
File details
Details for the file mni_to_atlas-1.2.0-py3-none-any.whl.
File metadata
- Download URL: mni_to_atlas-1.2.0-py3-none-any.whl
- Upload date:
- Size: 663.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1134401959bb689d990a0b37171b4f64f88e2188589c1d9721f68ae7b5c44753
|
|
| MD5 |
4c0044bf279f83d67c0e180dba9909c0
|
|
| BLAKE2b-256 |
3e0e988220d19a4537e0d05ca3e6134101fdb78018ef3a748abbaa50d5ac0df3
|
Provenance
The following attestation bundles were made for mni_to_atlas-1.2.0-py3-none-any.whl:
Publisher:
release.yml on tsbinns/mni_to_atlas
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mni_to_atlas-1.2.0-py3-none-any.whl -
Subject digest:
1134401959bb689d990a0b37171b4f64f88e2188589c1d9721f68ae7b5c44753 - Sigstore transparency entry: 734829569
- Sigstore integration time:
-
Permalink:
tsbinns/mni_to_atlas@2b38f2606026bad33f4ce677ffb10b9f3f2a2bef -
Branch / Tag:
refs/tags/v1.2.0 - Owner: https://github.com/tsbinns
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2b38f2606026bad33f4ce677ffb10b9f3f2a2bef -
Trigger Event:
release
-
Statement type: