-
Notifications
You must be signed in to change notification settings - Fork 12
/
plot_prob_atlas.py
122 lines (104 loc) · 3.54 KB
/
plot_prob_atlas.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
"""
Visualizing 4D probabilistic atlas maps
=======================================
This example shows how to visualize probabilistic atlases made of 4D images.
There are 3 different display types:
1. "contours", which means maps or ROIs are shown as contours delineated by \
colored lines.
2. "filled_contours", maps are shown as contours same as above but with \
fillings inside the contours.
3. "continuous", maps are shown as just color overlays.
A colorbar can optionally be added.
The :func:`nilearn.plotting.plot_prob_atlas` function displays each map
with each different color which are picked randomly from the colormap
which is already defined.
See :ref:`plotting` for more information to know how to tune the parameters.
"""
# %%
# Load 4D probabilistic atlases
from nilearn import datasets, plotting
# Allen RSN networks
allen = datasets.fetch_atlas_allen_2011()
# ICBM tissue probability
icbm = datasets.fetch_icbm152_2009()
# Smith ICA BrainMap 2009
smith_bm20 = datasets.fetch_atlas_smith_2009(resting=False, dimension=20)[
"maps"
]
# %%
# Visualization
# "contours" example
plotting.plot_prob_atlas(allen.rsn28, title="Allen2011")
# "continuous" example
plotting.plot_prob_atlas(
(icbm["wm"], icbm["gm"], icbm["csf"]), title="ICBM tissues"
)
# "filled_contours" example. An optional colorbar can be set.
plotting.plot_prob_atlas(
smith_bm20,
title="Smith2009 20 Brainmap (with colorbar)",
colorbar=True,
)
plotting.show()
# %%
# Other probabilistic atlases accessible with nilearn
# ---------------------------------------------------
#
# To save build time, the following code is not executed. Try running it
# locally to get the same plots as above for each of the listed atlases.
#
# .. code-block:: default
#
# # Harvard Oxford Atlas
# harvard_oxford = datasets.fetch_atlas_harvard_oxford("cort-prob-2mm")
# harvard_oxford_sub = datasets.fetch_atlas_harvard_oxford("sub-prob-2mm")
#
# # Smith ICA Atlas and Brain Maps 2009
# smith_rsn10 = datasets.fetch_atlas_smith_2009(
# resting=True, dimension=10
# )["maps"]
# smith_rsn20 = datasets.fetch_atlas_smith_2009(
# resting=True, dimension=20
# )["maps"]
# smith_rsn70 = datasets.fetch_atlas_smith_2009(
# resting=True, dimension=70
# )["maps"]
# smith_bm10 = datasets.fetch_atlas_smith_2009(
# resting=False, dimension=10
# )["maps"]
# smith_bm70 = datasets.fetch_atlas_smith_2009(
# resting=False, dimension=70
# )["maps"]
#
# # Multi Subject Dictionary Learning Atlas
# msdl = datasets.fetch_atlas_msdl()
#
# # Pauli subcortical atlas
# subcortex = datasets.fetch_atlas_pauli_2017()
#
# # Dictionaries of Functional Modes (“DiFuMo”) atlas
# dim = 64
# res = 2
# difumo = datasets.fetch_atlas_difumo(
# dimension=dim, resolution_mm=res, legacy_format=False
# )
#
# # Visualization
# atlas_types = {
# "Harvard_Oxford": harvard_oxford.maps,
# "Harvard_Oxford sub": harvard_oxford_sub.maps,
# "Smith 2009 10 RSNs": smith_rsn10,
# "Smith2009 20 RSNs": smith_rsn20,
# "Smith2009 70 RSNs": smith_rsn70,
# "Smith2009 10 Brainmap": smith_bm10,
# "Smith2009 70 Brainmap": smith_bm70,
# "MSDL": msdl.maps,
# "Pauli2017 Subcortical Atlas": subcortex.maps,
# f"DiFuMo dimension {dim} resolution {res}": difumo.maps,
# }
#
# for name, atlas in sorted(atlas_types.items()):
# plotting.plot_prob_atlas(atlas, title=name)
#
# plotting.show()
# sphinx_gallery_dummy_images=3