Skip to content

Commit 6eae83d

Browse files
committed
Merge branch 'release/v0.3.0'
2 parents 7d06c0e + ce20f83 commit 6eae83d

File tree

107 files changed

+8027
-3837
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+8027
-3837
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ atlas_B2.npz
7878
atlas_B3.npz
7979
AAL_label_bck.npz
8080
# *.todo
81+
Inflated.npz
82+
WhiteMatter.npz
83+
Sphere.npz
8184

8285
docs/generated/
8386
docs/auto_examples/

docs/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
_build
2+
_build

docs/brain.rst

+241-28
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,266 @@
11
.. _Brain:
22

33
Brain
4-
======
4+
=====
55

6-
Description
7-
-----------
8-
9-
.. figure:: picture/example.png
10-
:align: center
11-
12-
Brain is a flexible graphical user interface for 3D visualizations on an MNI brain. It can be use to display deep sources, brodmann areas, materialize connectivity... This module use `vispy <http://vispy.org/>`_ and can be imported as follow :
6+
*Brain* is a flexible graphical user interface for 3D visualizations on an MNI brain. It can be use to display deep sources, connectivity, region of interest... This module can be imported as follow :
137

148
.. code-block:: python
159
1610
from visbrain import Brain
1711
18-
Visit this page for a set of `examples <https://github.com/EtienneCmb/visbrain/tree/master/examples/brain>`_.
12+
Visit this page for a set of `examples <http://visbrain.org/auto_examples/index.html#brain-examples>`_.
1913

20-
Objects
21-
-------
14+
Main features
15+
-------------
2216

23-
There's four fundamental objects in Brain :
17+
GUI description
18+
~~~~~~~~~~~~~~~
2419

25-
* The main brain, which can be generated using one of the three possible template or simply pass vertices / faces of your own template.
26-
* Sources, which can represent deep electrodes, EEG / MEG captors or source localization...
27-
* Connectivity, in order to materialize a connexion strength between those sources (like coherence, amplitude-amplitude coupling...)
28-
* ROI (Region Of Interest), which are brain sub-structures (Brodmann areas or AAL)
20+
The *Brain* graphical user interface is subdivided into three main parts :
2921

22+
* **Main canvas** where the brain is displayed
23+
* **Menu** (*Save/load GUI config, take a screenshot*)
24+
* **Settings panel**
3025

31-
.. figure:: picture/objects.png
32-
:align: center
26+
* Settings tab (*background color, object opacity and slice, light, screenshot properties*)
27+
* Brain tab (*brain template, ROI, cross-sections, volume*)
28+
* Sources tab (*source's properties, text, cortical projection and repartition, time-series, pictures*)
29+
* Connect tab (*connectivity settings*)
30+
* Cbar tab (*colorbar properties of the selected object*)
31+
32+
.. note::
33+
34+
If you want to save the current GUI state (i.e. all buttons properties) and retrieve it later, use the menu File/Save/GUI config and File/Load/GUI config or the associated *Brain* method.
35+
36+
**Examples**
37+
* :ref:`sphx_glr_auto_examples_brain_13_load_gui_config.py`
3338

39+
**API**
40+
* :ref:`LoadSaveConfig`
3441

3542
Color
36-
-----
43+
^^^^^
3744

3845
Brain can manage several types of color inputs. All possible colors can be a matplotlib color name ('olive', 'slateblue'...), an hexadecimal type ('#9b59b6', '#3498db', '#95a5a6'...*) or an array of RGB or RGBA colors ((1., 0., 0.), (.1, .1, .1)...).
3946

40-
The colormap can be personalized using five variables :
47+
MNI templates
48+
~~~~~~~~~~~~~
49+
50+
.. figure:: picture/picbrain/brain_templates.png
51+
:align: center
52+
53+
By default, *Brain* comes with three brain templates respectively B1 (with cerebellum), B2 and B3 (smoothest). But this list can be extended using those following functions :
54+
55+
* :ref:`ConvertMeshData` : convert vertices and faces to be compatibles with *Brain*
56+
* :ref:`AddBrainTemplate` and :ref:`RemoveBrainTemplate` : using converted vertices and faces, add/remove the template to visbrain
57+
58+
Further brain templates can be downloaded `here <https://drive.google.com/open?id=0B6vtJiCQZUBvd0xfTHJqcHg2bTA>`_.
59+
60+
.. note::
61+
62+
**Examples**
63+
* :ref:`sphx_glr_auto_examples_brain_11_convert_mesh_data.py`
64+
* :ref:`sphx_glr_auto_examples_brain_02_add_brain_template.py`
65+
66+
**API**
67+
* :ref:`BrainClass`
68+
* :ref:`BrainApi`
69+
70+
Sources
71+
~~~~~~~
72+
73+
.. figure:: picture/picbrain/brain_sources.png
74+
:align: center
75+
76+
Sources can be added to the scene using (x, y, z) MNI coordinates and comes with a relatively large number of properties (radius, color, shape...). Source's array of coordinates must be have a shape of (N, 3) with **N** the number of sources. In addition, several objects can be attached to sources :
77+
78+
* **Text :** add a text to each source.
79+
* **Source's data :** must be (N,) vector of data (for instance beta power, entropy, amplitude...). The radius of each source is then proportional to the data attached to it. This activity can be projected onto the brain surface using the cortical projection.
80+
* **Connectivity :** must be a (N, N) upper triangular array describing how to connect sources
81+
* **Time-series and/or pictures** : finally, it's also possible to visualize signals (such as time-series, spectral signals...) and 2-D pictures (time-frequency maps, comodulogram...)
82+
83+
.. note::
84+
85+
**Examples**
86+
* :ref:`sphx_glr_auto_examples_brain_03_sources.py`
87+
* :ref:`sphx_glr_auto_examples_brain_09_add_multiple_objects.py`
88+
89+
**API**
90+
* :ref:`BrainClass`
91+
* :ref:`SourcesApi`
4192

42-
* clim : define the colorbar limits (like (-10, 10) or (-245, 7)...). The clim parameter must be a tuple/list of two floats. Every values over or under the colorbar limits will clip.
43-
* vmin / under : vmin is a float and under is a color. The vmin parameter can be defined in order to control the color of data that is under vmin.
44-
* vmax / over : vmax is a float and over is a color. The over parameter can be defined in order to control the color of data that is over vmax.
93+
Cortical projection and repartition
94+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4595

46-
.. figure:: picture/colormap.png
96+
.. figure:: picture/picbrain/brain_projection.png
4797
:align: center
4898

99+
Cortical projection of source's activity (Left) and source's repartition (Right).
100+
101+
* **Cortical projection :** correspond to the projection of source's activity onto the brain (or ROI) surface.
102+
* **Cortical repartition :** correspond to the number of sources contributing to each vertex of the surface. This is particularly convenient to inspect how sources are distributed on the surface.
103+
104+
Both methods use a **radius** parameter and only vertices with an euclidian distance under **radius** are going to be considered. From the GUI, those functions can be executed from the menu *Project*, from the tab *Sources/Properties/Projection*, using keyboard :ref:`BrainShortcuts` or *Brain* methods.
105+
106+
.. note::
107+
108+
**Examples**
109+
* :ref:`sphx_glr_auto_examples_brain_03_sources.py`
110+
* :ref:`sphx_glr_auto_examples_brain_08_screenshot.py`
111+
* :ref:`sphx_glr_auto_examples_brain_12_colorbar_control.py`
112+
113+
**API**
114+
* :ref:`CortProj`
115+
* :ref:`CortRepart`
116+
117+
Connect sources
118+
^^^^^^^^^^^^^^^
119+
120+
.. figure:: picture/picbrain/brain_connect.png
121+
:align: center
122+
123+
Example of connectivity.
124+
125+
Sources can be connected together using connectivity links. *Brain* provides three ways of coloring those links :
126+
127+
* **Strength :** color each link according to the connectivity strength
128+
* **Count :** color each connectivity node according to the number of connections to it
129+
* **Density :** color each link according to the number of existing links in a controllable sphere.
130+
131+
.. note::
132+
133+
**Examples**
134+
* :ref:`sphx_glr_auto_examples_brain_04_connectivity.py`
135+
* :ref:`sphx_glr_auto_examples_brain_09_add_multiple_objects.py`
136+
137+
**API**
138+
* :ref:`BrainClass`
139+
* :ref:`ConnectApi`
140+
141+
Attach time-series and/or pictures
142+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
143+
144+
.. figure:: picture/picbrain/brain_tspic.png
145+
:align: center
146+
147+
Attach time-series (Left) and pictures (Right) to sources.
148+
149+
As a complement, *Brain* provides the ability to visualize directly into the MNI brain time-series and pictures.
150+
151+
.. note::
152+
153+
**Examples**
154+
* :ref:`sphx_glr_auto_examples_brain_06_add_time_series.py`
155+
* :ref:`sphx_glr_auto_examples_brain_07_add_pictures.py`
156+
157+
**API**
158+
* :ref:`BrainClass`
159+
* :ref:`TimeSeriesApi`
160+
* :ref:`PicturesApi`
161+
162+
.. warning::
163+
164+
In the current 0.3.0 visbrain version, time-series and pictures don't rotate with the brain. As a consequence those elements can only be visualized in axial view. This should be solved in next release.
165+
166+
Volume
167+
~~~~~~
168+
169+
Brain templates are surfaces defined by vertices and faces. In contrast, volumes are defined with a 3-D array (Nx, Ny, Nz). There is three scenarios where volumes can be used in *Brain*:
170+
171+
* **Cross-sections :** inspect volumes using slices
172+
* **Region Of Interest (ROI) :** display deep brain regions
173+
* **3-D volume rendering :** use VisPy.visuals.Volume rendering methods (mip, translucent, additive and iso)
174+
175+
Those volumes can be used to visualize nifti, dycom or any image files. By default, *Brain* comes with two volume files : **Brodmann areas** and **Anatomical Automatic Labeling (AAL)**.
176+
177+
Cross-sections
178+
^^^^^^^^^^^^^^
179+
180+
.. figure:: picture/picbrain/brain_crossec.png
181+
:align: center
182+
183+
Cross-sections of a Nifti volume
184+
185+
Cross-sections correspond to an axial, sagittal and coronal slice of the volume and can either be visualize in 3-D (inside the brain template) or in slitted view
186+
187+
.. note::
188+
189+
**Examples**
190+
* :ref:`sphx_glr_auto_examples_brain_00_brain_control.py`
191+
* :ref:`sphx_glr_auto_examples_brain_10_add_nifti_volume.py`
192+
193+
**API**
194+
* :ref:`VolCrossecApi`
195+
196+
Region Of Interest (ROI)
197+
^^^^^^^^^^^^^^^^^^^^^^^^
198+
199+
.. figure:: picture/picbrain/brain_roi.png
200+
:align: center
201+
202+
Cortical projection on the thalamus (Left) and cortical repartition on Brodmann area 4 and 6.
203+
204+
If a volume is provided with corresponding labels, ROIs can be extracted and then be transformed into a mesh, compatible with source's projection methods.
205+
206+
.. note::
207+
208+
**Examples**
209+
* :ref:`sphx_glr_auto_examples_brain_05_region_of_interest.py`
210+
* :ref:`sphx_glr_auto_examples_brain_08_screenshot.py`
211+
212+
**API**
213+
* :ref:`RoiApi`
214+
215+
3-D volume rendering
216+
^^^^^^^^^^^^^^^^^^^^
217+
218+
.. figure:: picture/picbrain/brain_volume.png
219+
:align: center
220+
221+
Volume rendering methods of a Nifti volume.
222+
223+
.. note::
224+
225+
**Examples**
226+
* :ref:`sphx_glr_auto_examples_brain_00_brain_control.py`
227+
* :ref:`sphx_glr_auto_examples_brain_10_add_nifti_volume.py`
228+
229+
**API**
230+
* :ref:`VolCrossecApi`
231+
232+
Colorbar control
233+
~~~~~~~~~~~~~~~~
234+
235+
.. figure:: picture/picbrain/brain_cbar.png
236+
:align: center
237+
238+
Colorbar example.
239+
240+
The colorbar can be controlled for individual objects including :
241+
242+
* **Connectivity** (*if defined*)
243+
* **Pictures** (*if defined*)
244+
* **Projections** (*if defined*)
245+
246+
.. note::
247+
248+
**Examples**
249+
* :ref:`sphx_glr_auto_examples_brain_12_colorbar_control.py`
250+
* :ref:`sphx_glr_auto_examples_brain_08_screenshot.py`
251+
252+
**API**
253+
* :ref:`CbarApi`
254+
255+
49256
API
50257
---
51258

52-
The user functions correspond to a bundle of functions that can be used to control Brain operations without opening the graphical interface. This can be convenient to generate a large amount of pictures.
259+
The user functions correspond to a bundle of functions that can be used to control Brain operations without opening the graphical interface. This can be convenient to generate a large amount of pictures.
53260

54261
.. toctree::
55262
:maxdepth: 4
56-
263+
57264
brainAPI
58265

59266

@@ -64,23 +271,29 @@ See this tutorial to export your figures in a proper way in order to use them in
64271

65272
.. toctree::
66273
:maxdepth: 4
67-
274+
68275
vbexport
69276

277+
278+
.. _BrainShortcuts:
279+
70280
Shortcuts
71281
---------
72282

73283
============== ==================================================================================
74284
Keys Description
75285
============== ==================================================================================
76286
<space> Brain transparency
287+
<delete> Reset camera
77288
0 Top view
78289
1 Bottom view
79290
2 Left view
80291
3 Right view
81292
4 Front view
82293
5 Back view
83294
b Display / hide the brain
295+
b Display / hide cross-sections
296+
b Display / hide volume
84297
s Display / hide sources
85298
t Display / hide connectivity
86299
r Display / hide Region Of Interest (ROI)
@@ -90,7 +303,7 @@ a Auto-scale colormap
90303
"-" Decrease brain opacity
91304
CTRL+P Run the cortical projection
92305
CTRL+R Run the cortical repartition
93-
CTRL+D Display quick settings panel
306+
CTRL+D Display / hide quick settings panel
94307
CTRL+N Screenshot of the main canvas
95308
CTRL+W Screenshot of the entire window
96309
CTRL+T Show the shortcuts panel

0 commit comments

Comments
 (0)