|
2 | 2 | "cells": [ |
3 | 3 | { |
4 | 4 | "cell_type": "markdown", |
5 | | - "id": "3bf392ab", |
| 5 | + "id": "f199bec2", |
6 | 6 | "metadata": {}, |
7 | 7 | "source": [ |
8 | 8 | "# Plotting brain region values on circular flatmap" |
9 | 9 | ] |
10 | 10 | }, |
11 | 11 | { |
12 | | - "cell_type": "code", |
13 | | - "execution_count": null, |
14 | | - "id": "72266ba4", |
| 12 | + "cell_type": "markdown", |
| 13 | + "id": "94c08e66", |
15 | 14 | "metadata": {}, |
16 | | - "outputs": [], |
17 | 15 | "source": [ |
18 | 16 | "This example walks through various ways to overlay brain region values on a circular flatmap" |
19 | 17 | ] |
20 | 18 | }, |
21 | 19 | { |
22 | 20 | "cell_type": "markdown", |
23 | | - "id": "54faf5f5", |
| 21 | + "id": "17fd07ec", |
24 | 22 | "metadata": {}, |
25 | 23 | "source": [ |
26 | 24 | "## The circular flatmap" |
27 | 25 | ] |
28 | 26 | }, |
29 | 27 | { |
30 | 28 | "cell_type": "markdown", |
31 | | - "id": "d5799f85", |
| 29 | + "id": "3ca88864", |
32 | 30 | "metadata": {}, |
33 | 31 | "source": [ |
34 | 32 | "The circular flatmap is obtained by sampling the volume using concentric circles through the brain." |
|
37 | 35 | { |
38 | 36 | "cell_type": "code", |
39 | 37 | "execution_count": null, |
40 | | - "id": "110cd0ce", |
| 38 | + "id": "1178246b", |
41 | 39 | "metadata": {}, |
42 | 40 | "outputs": [], |
43 | 41 | "source": [ |
|
48 | 46 | { |
49 | 47 | "cell_type": "code", |
50 | 48 | "execution_count": null, |
51 | | - "id": "d7ae44f1", |
| 49 | + "id": "490614c3", |
52 | 50 | "metadata": {}, |
53 | 51 | "outputs": [], |
54 | 52 | "source": [ |
|
59 | 57 | }, |
60 | 58 | { |
61 | 59 | "cell_type": "markdown", |
62 | | - "id": "037bf3c3", |
| 60 | + "id": "135dd187", |
63 | 61 | "metadata": {}, |
64 | 62 | "source": [ |
65 | 63 | "This results in a flatmap that can be displayed in the following way" |
|
68 | 66 | { |
69 | 67 | "cell_type": "code", |
70 | 68 | "execution_count": null, |
71 | | - "id": "965f1ab1", |
| 69 | + "id": "8b8c4223", |
72 | 70 | "metadata": {}, |
73 | 71 | "outputs": [], |
74 | 72 | "source": [ |
75 | 73 | "import matplotlib.pyplot as plt\n", |
76 | | - "fig, ax = plt.subplots(figsize=(20,4))\n", |
| 74 | + "fig, ax = plt.subplots(figsize=(18,4))\n", |
77 | 75 | "flmap_cr.plot_flatmap(ax)" |
78 | 76 | ] |
79 | 77 | }, |
80 | 78 | { |
81 | 79 | "cell_type": "markdown", |
82 | | - "id": "5c4317cf", |
| 80 | + "id": "ec15f88c", |
83 | 81 | "metadata": {}, |
84 | 82 | "source": [ |
85 | 83 | "It is also possible to display this flatmap such that each circle is stacked on top of eachother. For this, the **pyramid** flatmap should be used" |
|
88 | 86 | { |
89 | 87 | "cell_type": "code", |
90 | 88 | "execution_count": null, |
91 | | - "id": "072b12d5", |
| 89 | + "id": "7461e3f8", |
92 | 90 | "metadata": {}, |
93 | 91 | "outputs": [], |
94 | 92 | "source": [ |
|
99 | 97 | { |
100 | 98 | "cell_type": "code", |
101 | 99 | "execution_count": null, |
102 | | - "id": "d47484a5", |
| 100 | + "id": "1f78b2ab", |
103 | 101 | "metadata": {}, |
104 | 102 | "outputs": [], |
105 | 103 | "source": [ |
|
109 | 107 | }, |
110 | 108 | { |
111 | 109 | "cell_type": "markdown", |
112 | | - "id": "60589bee", |
| 110 | + "id": "e7af738a", |
113 | 111 | "metadata": {}, |
114 | 112 | "source": [ |
115 | 113 | "## Data preparation" |
116 | 114 | ] |
117 | 115 | }, |
118 | 116 | { |
119 | 117 | "cell_type": "markdown", |
120 | | - "id": "13a160d9", |
| 118 | + "id": "40fa09d0", |
121 | 119 | "metadata": {}, |
122 | 120 | "source": [ |
123 | 121 | "In order to plot brain regions values on the flatmap an array of acronyms and an array of values corresponding to each acronym must be provided. A detailed overview of how to prepare your data can be found here [LINK TO PLOTTING SCALAR]" |
|
126 | 124 | { |
127 | 125 | "cell_type": "code", |
128 | 126 | "execution_count": null, |
129 | | - "id": "86f3d236", |
| 127 | + "id": "20a1db83", |
130 | 128 | "metadata": {}, |
131 | 129 | "outputs": [], |
132 | 130 | "source": [ |
133 | 131 | "import numpy as np\n", |
134 | 132 | "# prepare array of acronyms\n", |
135 | | - "acronyms = np.array(['ACAd1', 'ACAv1', 'AId1', 'AIp1', 'AIv1', 'AUDd1', 'AUDp1','AUDpo1', 'AUDv1', \n", |
136 | | - " 'SSp-m1', 'SSp-n1', 'SSp-tr1', 'SSp-ul1','SSp-un1', 'SSs1', \n", |
137 | | - " 'VISC1', 'VISa1', 'VISal1', 'VISam1', 'VISl1', 'VISli1', 'VISp1', 'VISp2/3', 'VISpl1', 'VISpm1', \n", |
138 | | - " 'SSp-n2/3', 'SSp-tr2/3', 'SSp-ul2/3', 'SSp-un2/3', 'SSs2/3',\n", |
139 | | - " 'VISC2/3', 'VISa2/3', 'VISal2/3', 'VISam2/3', 'VISl2/3','VISli2/3', 'VISp2/3', 'VISpl1', 'VISpl2/3'])\n", |
| 133 | + "acronyms = np.array(['VPM', 'PO', 'LP', 'CA1', 'DG-mo', 'VISa5', 'SSs5'])\n", |
140 | 134 | "# assign data to each acronym\n", |
141 | 135 | "values = np.arange(acronyms.size)" |
142 | 136 | ] |
143 | 137 | }, |
144 | 138 | { |
145 | 139 | "cell_type": "code", |
146 | 140 | "execution_count": null, |
147 | | - "id": "3f7aec63", |
| 141 | + "id": "e6ae51d0", |
148 | 142 | "metadata": {}, |
149 | 143 | "outputs": [], |
150 | 144 | "source": [ |
|
158 | 152 | { |
159 | 153 | "cell_type": "code", |
160 | 154 | "execution_count": null, |
161 | | - "id": "fa067a5f", |
| 155 | + "id": "3724b968", |
162 | 156 | "metadata": {}, |
163 | 157 | "outputs": [], |
164 | 158 | "source": [ |
|
170 | 164 | }, |
171 | 165 | { |
172 | 166 | "cell_type": "markdown", |
173 | | - "id": "14f4b521", |
| 167 | + "id": "74fe528a", |
174 | 168 | "metadata": {}, |
175 | 169 | "source": [ |
176 | 170 | "## Examples" |
|
179 | 173 | { |
180 | 174 | "cell_type": "code", |
181 | 175 | "execution_count": null, |
182 | | - "id": "58f4162e", |
| 176 | + "id": "dfa2d623", |
| 177 | + "metadata": {}, |
| 178 | + "outputs": [], |
| 179 | + "source": [ |
| 180 | + "from ibllib.atlas.plots import plot_scalar_on_flatmap\n", |
| 181 | + "# Plot region values on the left hemisphere of circle flatmap overlaid on brain region boundaries using Allen mapping\n", |
| 182 | + "fig, ax = plt.subplots(figsize=(18,4))\n", |
| 183 | + "fig, ax = plot_scalar_on_flatmap(acronyms, values, hemisphere='left', mapping='Allen', flmap_atlas=flmap_cr, ax=ax)" |
| 184 | + ] |
| 185 | + }, |
| 186 | + { |
| 187 | + "cell_type": "code", |
| 188 | + "execution_count": null, |
| 189 | + "id": "cc78a1c7", |
| 190 | + "metadata": {}, |
| 191 | + "outputs": [], |
| 192 | + "source": [ |
| 193 | + "# Plot region values on the both hemispheres of circle flatmap overlaid on the dwi Allen image using Beryl mapping\n", |
| 194 | + "fig, ax = plt.subplots(figsize=(18,4))\n", |
| 195 | + "fig, ax = plot_scalar_on_flatmap(acronyms_beryl, values_beryl, hemisphere='both', mapping='Beryl', background='image', \n", |
| 196 | + " cmap='Reds', flmap_atlas=flmap_cr, ax=ax)" |
| 197 | + ] |
| 198 | + }, |
| 199 | + { |
| 200 | + "cell_type": "code", |
| 201 | + "execution_count": null, |
| 202 | + "id": "37bf7bd8", |
| 203 | + "metadata": {}, |
| 204 | + "outputs": [], |
| 205 | + "source": [ |
| 206 | + "# Plot region values on the right hemisphere of pyramidal flatmap overlaid on the dwi Allen image using Allen mapping\n", |
| 207 | + "fig, ax = plt.subplots(figsize=(8,8))\n", |
| 208 | + "fig, ax = plot_scalar_on_flatmap(acronyms, values, hemisphere='right', mapping='Allen', background='image', \n", |
| 209 | + " cmap='Reds', flmap_atlas=flmap_py, ax=ax)" |
| 210 | + ] |
| 211 | + }, |
| 212 | + { |
| 213 | + "cell_type": "code", |
| 214 | + "execution_count": null, |
| 215 | + "id": "28f7f30c", |
183 | 216 | "metadata": {}, |
184 | 217 | "outputs": [], |
185 | 218 | "source": [ |
186 | | - "from ibllib.atlas" |
| 219 | + "# Plot two column region values on the both hemispheres of pyramidal flatmap overlaid on brain region boundaries \n", |
| 220 | + "# using Beryl mapping\n", |
| 221 | + "fig, ax = plt.subplots(figsize=(8,8))\n", |
| 222 | + "fig, ax = plot_scalar_on_flatmap(acronyms_beryl, values_beryl_lr, hemisphere='both', mapping='Beryl', \n", |
| 223 | + " background='boundary', cmap='Blues', flmap_atlas=flmap_py, ax=ax)" |
187 | 224 | ] |
188 | 225 | } |
189 | 226 | ], |
|
0 commit comments