a b/doc/_includes/morph.rst
1
:orphan:
2
3
Morphing and averaging source estimates
4
=======================================
5
6
The spherical morphing of BEM surfaces accomplished by FreeSurfer can be
7
employed to bring data from different subjects into a common anatomical frame.
8
This page describes utilities which make use of the spherical :term:`morphing`
9
procedure. :func:`mne.morph_labels` morphs label files between subjects
10
allowing the definition of labels in a one brain and transforming them to
11
anatomically analogous labels in another. :meth:`mne.SourceMorph.apply` offers
12
the capability to transform all subject data to the same space and,
13
e.g., compute averages of data across subjects.
14
15
.. NOTE: part of this file is included in doc/overview/implementation.rst.
16
   Changes here are reflected there. If you want to link to this content, link
17
   to :ref:`ch_morph` to link to that section of the implementation.rst page.
18
   The next line is a target for :start-after: so we can omit the title from
19
   the include:
20
   morph-begin-content
21
22
23
Why morphing?
24
~~~~~~~~~~~~~
25
26
.. note:: Morphing examples in MNE-Python
27
    :class: sidebar
28
29
    Examples of morphing in MNE-Python include :ref:`this tutorial
30
    <tut-mne-fixed-free>` on surface source estimation or these examples on
31
    :ref:`surface <ex-morph-surface>` and :ref:`volumetric <ex-morph-volume>`
32
    source estimation.
33
34
Modern neuroimaging techniques, such as source reconstruction or fMRI analyses,
35
make use of advanced mathematical models and hardware to map brain activity
36
patterns into a subject-specific anatomical brain space. This enables the study
37
of spatio-temporal brain activity. The representation of spatio-temporal brain
38
data is often mapped onto the anatomical brain structure to relate functional
39
and anatomical maps. Thereby activity patterns are overlaid with anatomical
40
locations that supposedly produced the activity. Anatomical MR images are often
41
used as such or are transformed into an inflated surface representations to
42
serve as  "canvas" for the visualization.
43
44
In order to compute group-level statistics, data representations across
45
subjects must be morphed to a common frame, such that anatomically and
46
functional similar structures are represented at the same spatial location for
47
*all subjects equally*. Since brains vary, :term:`morphing` comes into play to
48
tell us how the data produced by subject A would be represented on the brain of
49
subject B (and vice-versa).
50
51
52
The morphing maps
53
~~~~~~~~~~~~~~~~~
54
55
The MNE software accomplishes morphing with help of morphing maps.
56
The morphing is performed with help of the registered
57
spherical surfaces (``lh.sphere.reg`` and ``rh.sphere.reg`` ) which must be
58
produced in FreeSurfer. A morphing map is a linear mapping from cortical
59
surface values in subject A (:math:`x^{(A)}`) to those in another subject B
60
(:math:`x^{(B)}`)
61
62
.. math::    x^{(B)} = M^{(AB)} x^{(A)}\ ,
63
64
where :math:`M^{(AB)}` is a sparse matrix with at most three nonzero elements
65
on each row. These elements are determined as follows. First, using the aligned
66
spherical surfaces, for each vertex :math:`x_j^{(B)}`, find the triangle
67
:math:`T_j^{(A)}` on the spherical surface of subject A which contains the
68
location :math:`x_j^{(B)}`. Next, find the numbers of the vertices of this
69
triangle and set the corresponding elements on the *j* th row of
70
:math:`M^{(AB)}` so that :math:`x_j^{(B)}` will be a linear interpolation
71
between the triangle vertex values reflecting the location :math:`x_j^{(B)}`
72
within the triangle :math:`T_j^{(A)}`.
73
74
It follows from the above definition that in general
75
76
.. math::    M^{(AB)} \neq (M^{(BA)})^{-1}\ ,
77
78
*i.e.*,
79
80
.. math::    x_{(A)} \neq M^{(BA)} M^{(AB)} x^{(A)}\ ,
81
82
even if
83
84
.. math::    x^{(A)} \approx M^{(BA)} M^{(AB)} x^{(A)}\ ,
85
86
*i.e.*, the mapping is *almost* a bijection.
87
88
89
About smoothing
90
~~~~~~~~~~~~~~~
91
92
The current estimates are normally defined only in a decimated grid which is a
93
sparse subset of the vertices in the triangular tessellation of the cortical
94
surface. Therefore, any sparse set of values is distributed to neighboring
95
vertices to make the visualized results easily understandable. This procedure
96
has been traditionally called smoothing but a more appropriate name might be
97
smudging or blurring in accordance with similar operations in image processing
98
programs.
99
100
In MNE software terms, smoothing of the vertex data is an iterative procedure,
101
which produces a blurred image :math:`x^{(N)}` from the original sparse image
102
:math:`x^{(0)}` by applying in each iteration step a sparse blurring matrix:
103
104
.. math::    x^{(p)} = S^{(p)} x^{(p - 1)}\ .
105
106
On each row :math:`j` of the matrix :math:`S^{(p)}` there are :math:`N_j^{(p -
107
1)}` nonzero entries whose values equal :math:`1/N_j^{(p - 1)}`. Here
108
:math:`N_j^{(p - 1)}` is the number of immediate neighbors of vertex :math:`j`
109
which had non-zero values at iteration step :math:`p - 1`. Matrix
110
:math:`S^{(p)}` thus assigns the average of the non-zero neighbors as the new
111
value for vertex :math:`j`. One important feature of this procedure is that it
112
tends to preserve the amplitudes while blurring the surface image.
113
114
Once the indices non-zero vertices in :math:`x^{(0)}` and the topology of the
115
triangulation are fixed the matrices :math:`S^{(p)}` are fixed and independent
116
of the data. Therefore, it would be in principle possible to construct a
117
composite blurring matrix
118
119
.. math::    S^{(N)} = \prod_{p = 1}^N {S^{(p)}}\ .
120
121
However, it turns out to be computationally more effective to do blurring with
122
an iteration. The above formula for :math:`S^{(N)}` also shows that the
123
smudging (smoothing) operation is linear.