Skip to content

Commit dff7e5c

Browse files
committed
more brain meshes, cortical plotting finetuning
1 parent 1c3649d commit dff7e5c

12 files changed

Lines changed: 339 additions & 257 deletions

README.md

Lines changed: 35 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -40,32 +40,41 @@ please refer to the [documentation](https://teanijarv.github.io/yabplot/) for mo
4040
import yabplot as yab
4141
import numpy as np
4242

43-
# see available cortical atlases
44-
atlases = yab.get_available_resources(category='cortical')
45-
46-
# see the region names within the aseg atlas
47-
regions = yab.get_atlas_regions(atlas='aseg', category='subcortical')
48-
49-
# plot data on cortical regions
50-
data = np.arange(0, 1, 0.001)
51-
yab.plot_cortical(data=data, atlas='schaefer_1000', figsize=(600, 300),
52-
cmap='viridis', vminmax=[0, 1], style='default',
53-
views=['left_lateral', 'superior', 'right_lateral'])
54-
55-
56-
# plot values for specific subcortical regions
57-
data = {'Left_Amygdala': 0.8, 'Right_Hippocampus': 0.5,
58-
'Right_Thalamus': -0.5, 'Left_Putamen': -1}
59-
yab.plot_subcortical(data=data, atlas='aseg', figsize=(600, 450), layout=(2, 2),
60-
views=['superior', 'anterior', 'left_lateral', 'right_lateral'],
61-
cmap='coolwarm', vminmax=[-1, 1], style='matte')
62-
63-
# plot data on white matter bundles
64-
regions = yab.get_atlas_regions(atlas='xtract_tiny', category='tracts')
65-
data = np.arange(0, len(regions))
66-
yab.plot_tracts(data=data, atlas='xtract_tiny', figsize=(600, 300),
67-
views=['superior', 'anterior', 'left_lateral'], nan_color='#cccccc',
68-
bmesh_type='fsaverage', style='default', cmap='plasma')
43+
# check that you have the latest version
44+
print(yab.__version__)
45+
46+
# see available atlases and brain meshes
47+
print(yab.get_available_resources())
48+
49+
# see the region names for a specific atlas
50+
print(yab.get_atlas_regions(atlas='aseg', category='subcortical'))
51+
52+
# cortical surfaces
53+
atlas = 'aparc'
54+
dmap1 = {'L_lateraloccipital': 0.265, 'L_postcentral': 0.086, ...}
55+
dmap2 = {'L_fusiform': 0.218, 'L_supramarginal': 0.119, ...}
56+
yab.plot_cortical(data=dmap1, atlas=atlas, vminmax=[-0.1, 0.3],
57+
bmesh_type='midthickness', views=['left_lateral', 'left_medial'],
58+
figsize=(600, 300), cmap='viridis', proc_vertices='sharp')
59+
yab.plot_cortical(data=dmap2, atlas=atlas, vminmax=[-0.1, 0.3],
60+
bmesh_type='swm', views=['left_lateral', 'left_medial'],
61+
figsize=(1200, 600), cmap='viridis', proc_vertices='sharp')
62+
63+
# subcortical structures
64+
atlas = 'aseg'
65+
regs = yab.get_atlas_regions(atlas=atlas, category='subcortical')
66+
data = np.arange(1, len(regs)+1)
67+
yab.plot_subcortical(data=data, atlas=atlas, vminmax=[2, 14],
68+
views=['left_lateral', 'superior', 'right_lateral'],
69+
bmesh_alpha=0.1, figsize=(600, 300), cmap='viridis')
70+
71+
# white matter bundles
72+
atlas = 'xtract_tiny'
73+
regs = yab.get_atlas_regions(atlas=atlas, category='tracts')
74+
data = {reg: np.sin(i) for i, reg in enumerate(regs)}
75+
yab.plot_tracts(data=data, atlas=atlas, style='matte',
76+
views=['left_lateral', 'anterior', 'superior'], bmesh_type='pial',
77+
bmesh_alpha=0.1, figsize=(1600, 800), cmap='viridis')
6978

7079
```
7180

docs/assets/examples.png

692 KB
Loading

docs/tutorials/available_atlases.ipynb

Lines changed: 26 additions & 31 deletions
Large diffs are not rendered by default.

docs/tutorials/custom_cortical_atlas.ipynb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@
139139
},
140140
{
141141
"cell_type": "code",
142-
"execution_count": 38,
142+
"execution_count": null,
143143
"id": "63863fc7",
144144
"metadata": {},
145145
"outputs": [
@@ -198,7 +198,7 @@
198198
"\n",
199199
"# run the parser\n",
200200
"lut_path = os.path.join(work_dir, \"brainnetome.txt\")\n",
201-
"parse_brainnetome_xml(aal_xml, lut_path)"
201+
"parse_brainnetome_xml(a_xml, lut_path)"
202202
]
203203
},
204204
{
@@ -217,7 +217,7 @@
217217
},
218218
{
219219
"cell_type": "code",
220-
"execution_count": 39,
220+
"execution_count": null,
221221
"id": "d7aa2945",
222222
"metadata": {},
223223
"outputs": [
@@ -336,11 +336,11 @@
336336
"print(\"--- step 3: processing hemispheres ---\")\n",
337337
"\n",
338338
"# 1. map & refine left hemisphere\n",
339-
"lh_raw = map_volume_to_surface(aal_nii, surf_data['lh']['surf'])\n",
339+
"lh_raw = map_volume_to_surface(a_nii, surf_data['lh']['surf'])\n",
340340
"lh_final = refine_surface_map(lh_raw, surf_data['lh']['surf'], surf_data['lh']['mask'])\n",
341341
"\n",
342342
"# 2. map & refine right hemisphere\n",
343-
"rh_raw = map_volume_to_surface(aal_nii, surf_data['rh']['surf'])\n",
343+
"rh_raw = map_volume_to_surface(a_nii, surf_data['rh']['surf'])\n",
344344
"rh_final = refine_surface_map(rh_raw, surf_data['rh']['surf'], surf_data['rh']['mask'])\n",
345345
"\n",
346346
"# 3. save final csv\n",

docs/tutorials/getting_started.ipynb

Lines changed: 28 additions & 64 deletions
Large diffs are not rendered by default.

docs/tutorials/plot_styling.ipynb

Lines changed: 50 additions & 60 deletions
Large diffs are not rendered by default.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "yabplot"
3-
version = "0.1.4"
3+
version = "0.1.5"
44
description = "yet another brain plot"
55
readme = "README.md"
66
requires-python = ">=3.10"

tests/test_smoke.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ def test_plot_cortical():
2323
"""
2424
Integration test: Downloads 'aparc' and plots it.
2525
"""
26-
yab.plot_cortical(atlas='aparc', display_type='none')
26+
yab.plot_cortical(atlas='aparc', display_type=None)
2727

2828
def test_plot_subcortical():
2929
"""
3030
Integration test: Downloads 'aseg' and plots it.
3131
"""
32-
yab.plot_subcortical(atlas='aseg', display_type='none')
32+
yab.plot_subcortical(atlas='aseg', display_type=None)
3333

3434
def test_plot_tracts():
3535
"""
3636
Integration test: Downloads 'xtract_tiny' and plots it.
3737
"""
38-
yab.plot_tracts(atlas='xtract_tiny', display_type='none')
38+
yab.plot_tracts(atlas='xtract_tiny', display_type=None)

yabplot/data/registry.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,9 @@ tracts-xtract_large.zip sha256:e2d59e9f90b024018788af87e389f93b2fa9ac21360460196
1717
tracts-xtract_medium.zip sha256:f095028d3dfc0f974ebef1feffe4006b5bac1366325a784ea2301c56f583b1e7 https://osf.io/7tbjg/download
1818
tracts-xtract_small.zip sha256:9d3fe2c57acb87e8d13eb40a49a6c2c354dbe1a020122b693e9bf713e57cad5b https://osf.io/bmn3a/download
1919
tracts-xtract_tiny.zip sha256:469f9ed8ed5ceb7f8e17c9a0a92f1491d540814f832ef56441a7539532111f41 https://osf.io/a73x2/download
20-
bmesh-conte69.zip sha256:5ba9ffc89ae7f640590a80fc188d277b1b49a34a0bd99c0c9e5cfb52fc963cac https://osf.io/h4ugr/download
21-
bmesh-fsaverage.zip sha256:bccec9e3fc10ffc9d1cbdb6ad2b0ffd81c93ca0fa8d26fc530d9b4d58dfcd7a0 https://osf.io/sq7am/download
20+
bmesh-inflated.zip sha256:ba72f9e75f16fe767f6bbcec5c98381f6a20b2f5e2092505b4692844a1686461 https://osf.io/kfzjg/download
21+
bmesh-midthickness.zip sha256:ef8209853e1dac8804a60b5cde0b653ef2f6c77b6c7536f7acaa69a46dbb06c0 https://osf.io/xaktf/download
22+
bmesh-pial.zip sha256:5e36ba7883dd2a88485fc45c9166ed48e22db607d45655242961242b51f9f126 https://osf.io/knpg8/download
23+
bmesh-swm.zip sha256:1a516c070cb63557751d841d5cf75772660872b89ec749ee19c23298d77fa807 https://osf.io/hpbc9/download
24+
bmesh-very_inflated.zip sha256:8c33a00c718a47f0af118ce2c5804a2adf13d79be05c4665ca26582e3e8dd977 https://osf.io/xp9jr/download
25+
bmesh-white.zip sha256:b885ac1a4dcdf9e241a97e8d3ca59d7b1c86d8a3ebe17df512993bc5c1c0354a https://osf.io/wfc5t/download

0 commit comments

Comments
 (0)