Skip to main content

yet another brain plot

Project description

yabplot: yet another brain plot

logo

PyPI version Docs Tests

yabplot is a Python library for creating beautiful, publication-quality 3D brain visualizations. it supports plotting cortical regions, subcortical structures, and white matter bundles.

the idea is simple. while there are already amazing visualization tools available, they often focus on specific domains—using one tool for white matter tracts and another for cortical surfaces inevitably leads to inconsistent styles. i wanted a unified, simple-to-use tool that enables me (and hopefully others) to perform most brain visualizations in a single place. recognizing that neuroscience evolves daily, i designed yabplot to be modular: it supports standard pre-packaged atlases out of the box, but easily accepts any custom parcellation or tractography dataset you might need.

features

  • pre-existing atlases: access many commonly used atlases (schaefer2018, brainnetome, aparc, aseg, musus100, xtract, etc) on demand.
  • simple to use: plug-n-play functions for cortex, subcortex, and tracts with a unified API.
  • custom atlases: easily use your own parcellations, segmentations (.nii/.gii), or tractograms (.trk).
  • flexible inputs: accepts data as dictionaries (for partial mapping) or arrays (for strict mapping).

installation

uv add yabplot

or

pip install yabplot

dependencies: python 3.11 with ipywidgets, nibabel, pandas, pooch, pyvista, scikit-image, trame, trame-vtk, trame-vuetify

quick start

please refer to the documentation for more comprehensive guides.

import yabplot as yab
import numpy as np

# see available cortical atlases
atlases = yab.get_available_resources(category='cortical')

# see the region names within the aseg atlas
regions = yab.get_atlas_regions(atlas='aseg', category='subcortical')

# plot data on cortical regions
data = np.arange(0, 1, 0.001)
yab.plot_cortical(data=data, atlas='schaefer_1000', figsize=(600, 300),
                  cmap='viridis', vminmax=[0, 1], style='default',
                  views=['left_lateral', 'superior', 'right_lateral'])


# plot values for specific subcortical regions
data = {'Left_Amygdala': 0.8, 'Right_Hippocampus': 0.5, 
        'Right_Thalamus': -0.5, 'Left_Putamen': -1}
yab.plot_subcortical(data=data, atlas='aseg', figsize=(600, 450), layout=(2, 2),
                     views=['superior', 'anterior', 'left_lateral', 'right_lateral'], 
                     cmap='coolwarm', vminmax=[-1, 1], style='matte')

# plot data on white matter bundles
regions = yab.get_atlas_regions(atlas='xtract_tiny', category='tracts')
data = np.arange(0, len(regions))
yab.plot_tracts(data=data, atlas='xtract_tiny', figsize=(600, 300), 
                views=['superior', 'anterior', 'left_lateral'], nan_color='#cccccc', 
                bmesh_type='fsaverage', style='default', cmap='plasma')

examples

acknowledgements

yabplot relies on the extensive work of the neuroimaging community. if you use these atlases in your work, please cite the original authors.

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

yabplot-0.1.0.tar.gz (17.4 kB view details)

Uploaded Source

Built Distribution

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

yabplot-0.1.0-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file yabplot-0.1.0.tar.gz.

File metadata

  • Download URL: yabplot-0.1.0.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for yabplot-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f3e789d767264e277919164d697457a08171a5ce73152162f3eb3abc3759f1e9
MD5 fbd19be2794f6224e7f267bd47c03f0c
BLAKE2b-256 1b8749c40c751007330a9dfc611c32d53bbd7d863505d9bbfaa28d2e365f4a58

See more details on using hashes here.

Provenance

The following attestation bundles were made for yabplot-0.1.0.tar.gz:

Publisher: publish.yml on teanijarv/yabplot

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

File details

Details for the file yabplot-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: yabplot-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for yabplot-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cf66ddf4e09e8006e344c48b7ef855b607202329387516135079ce24859187dc
MD5 b951228c0c7805bfac00f7a8369b8c24
BLAKE2b-256 909cec08fedd777adf0dd539b1ef7227ff67df53f6d6dc84d5cee0dfc17ccc73

See more details on using hashes here.

Provenance

The following attestation bundles were made for yabplot-0.1.0-py3-none-any.whl:

Publisher: publish.yml on teanijarv/yabplot

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