Skip to content

Commit 4145647

Browse files
committed
Split tutorial in smaller files.
1 parent d9935e2 commit 4145647

File tree

4 files changed

+458
-460
lines changed

4 files changed

+458
-460
lines changed

Commands.rst

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
.. role:: command
2+
.. role:: opt
3+
.. role:: input
4+
.. role:: output
5+
6+
OpenMEEG from the command line
7+
------------------------------
8+
9+
Diagram for the low level pipeline for computing leadfields (a.k.a., gain matrices) using OpenMEEG:
10+
11+
.. image:: _static/OpenMEEGSimple_new.png
12+
:width: 600 px
13+
:alt: dipole positions
14+
:align: center
15+
16+
This section reviews the main OpenMEEG command line tools.
17+
The general syntax and main options are detailed for each command.
18+
19+
Full details are available in OpenMEEG documentation.
20+
In this section, :command:`command` names are in :command:`red`, :opt:`options` are in :opt:`green` and :output:`output` files are shown in :output:`blue`.
21+
22+
om_assemble
23+
^^^^^^^^^^^
24+
25+
General syntax:
26+
27+
:command:`om_assemble` :opt:`Option` :input:`Parameters` :output:`Matrix`
28+
29+
This program assembles the different matrices to be used in later stages.
30+
It uses the head description (the geometrical model and the conductivities of the head see `sec.geom`_, and `sec.cond`_), the sources (see `sec.sources`_) and the sensors (see `sec.sensors`_) information.
31+
:opt:`Option` selects the type of matrix to assemble.
32+
:input:`Parameters` depends on the specific option :opt:`Option`.
33+
34+
35+
.. note:: Abbreviated option names can be used, such as :opt:`-HM` or :opt:`-hm` instead of :opt:`-HeadMat`.
36+
37+
38+
We now detail the possible :opt:`options` (with their abbreviated versions given in parentheses), allowing to define various matrices to assemble.
39+
40+
A typical command is:
41+
42+
:command:`om_assemble` :opt:`-HeadMat` :input:`subject.geom` :input:`subject.cond` :output:`HeadMat.mat`
43+
44+
In the above example, the :input:`Parameters` are the two file names: :input:`subject.geom` :input:`subject.cond`. More generally, the :input:`Parameters` include two such file names describing geometry and conductivity, plus additional :input:`Input`, describe below for each :opt:`Option`.
45+
46+
General options for :command:`om_assemble`
47+
""""""""""""""""""""""""""""""""""""""""""
48+
49+
- :opt:`--help` (:opt:`-h`): summarizes all possible options.
50+
51+
Head modelling options for :command:`om_assemble`: produce matrices (called head matrices) linked to the propagation of electrical signals in the head.
52+
53+
- :opt:`-HeadMat` (:opt:`-HM`, :opt:`-hm`): :command:`om_assemble` computes the matrix called Head Matrix (a.k.a structure matrix) for the Symmetric BEM, linked to the electrical conduction within the head. The output matrix is symmetric.
54+
55+
.. note:: The symmetric format only stores the lower half of a matrix.
56+
57+
**Source modelling** options for :command:`om_assemble`: compute the source matrix for Symmetric BEM (right-hand side of the linear system).
58+
This matrix maps the representation of the sources to their associated electric potential in an infinite medium (:math:`v_{\Omega_1}`).
59+
Different options exist for the 2 types of source models:
60+
61+
- :opt:`-DipSourceMat` (:opt:`-DSM`, :opt:`-dsm`): should be used when considering several isolated dipoles.
62+
This model is the most commonly used and should be used by default even if the dipoles correspond to the vertices of a cortical mesh. :input:`Input` is a file containing the dipole descriptions.
63+
For faster computations, one can consider giving the name of the domain (containing all dipoles) as a string as an optional parameter in the end of the command line (see Example).
64+
65+
- :opt:`-SurfSourceMat` (:opt:`-SSM`, :opt:`-ssm`): should be used for continuous surfacic distributions
66+
of dipoles. :input:`Input` is a file containing a mesh that describes the surface.
67+
For faster computations, one can consider giving the name of the domain (containing all dipoles)
68+
as a string as an optional parameter in the end of the command line.
69+
70+
- :opt:`-EITSourceMat` (:opt:`-EITSM`, :opt:`-EITsm`,): :command:`om_assemble` computes the
71+
right-hand side vector for a given set of scalp electrodes where current injection is applied
72+
(which can be used for Electrical Impedance Tomography, EIT). For this option, :input:`Input`
73+
is a file describing the electrode positions.
74+
75+
**Sensor modelling** options for :command:`om_assemble`: compute matrices which are needed to integrate source and sensor information with computed potentials to provide the actual solution of the forward problem. The the following situations are handled: EEG, ECoG, sEEG, MEG.
76+
77+
EEG:
78+
- :opt:`-Head2EEGMat` (:opt:`-H2EM`, :opt:`-h2em`): :command:`om_assemble` computes the linear interpolation matrix that maps OpenMEEG unknown :math:`\mathbf{X}` to the potential on the scalp at EEG sensors: :math:`\mathbf{V_{sensors}} = \mathbf{Head2EEGMat} . \mathbf{X}`. :input:`Input` is a file describing the EEG sensor positions. :math:`\mathbf{Head2EEGMat}` is stored as a sparse matrix.
79+
80+
ECoG:
81+
- :opt:`-Head2ECoGMat` (:opt:`-H2ECogM`, :opt:`-H2ECOGM`, :opt:`-h2ecogm`): :command:`om_assemble` computes the linear interpolation matrix that maps the OpenMEEG unknown :math:`\mathbf{X}` to the potential on the scalp at EEG sensors: :math:`\mathbf{V_{sensors}} = \mathbf{Head2ECoGMat} . \mathbf{X}`. :input:`Input` contains two parameters: the file describing the ECoG sensor positions, and the name of the interface on which the ECoG electrodes should be mapped. :math:`\mathbf{Head2ECoGMat}` is stored as a sparse matrix.
82+
83+
sEEG:
84+
- :opt:`-Head2InternalPotMat` (:opt:`-H2IPM`, :opt:`-h2ipm`): :command:`om_assemble` computes the matrix that allows
85+
the computation of potentials at internal positions from potentials and normal currents on head interfaces, as computed by the symmetric BEM.
86+
87+
- :opt:`-DipSource2InternalPotMat` (:opt:`-DS2IPM`, :opt:`-ds2ipm`): :command:`om_assemble` computes the source contribution to the chosen internal points. It gives the potential due to isolated dipoles, as if the medium were infinite. For this option, :input:`Input` takes the form: :input:`dipoles internalPoints` where :input:`dipoles` contains the dipole description and :input:`internalPoints` is a file describing the points locations.
88+
89+
MEG:
90+
- :opt:`-Head2MEGMat` (:opt:`-H2MM`, :opt:`-h2mm`): :command:`om_assemble` computes the contribution of Ohmic currents to the MEG sensors. :input:`Input` is a file describing the SQUIDS geometries and characteristics.
91+
92+
- :opt:`-SurfSource2MEGMat` (:opt:`-SS2MM`, :opt:`-ss2mm`): :command:`om_assemble` computes the source contribution to the MEG sensors using the same source model as the one used for the option :opt:`-SurfSourceMat, i.e. surfacic distribution of dipoles. For this option, :input:`Input` takes the form: :input:`mesh squids` where :input:`mesh` contains a mesh describing the source surface and :input:`squids` is a file describing the SQUIDS geometries and characteristics.
93+
94+
- :opt:`-DipSource2MEGMat` (:opt:`-DS2MM`, :opt:`-ds2mm`): :command:`om_assemble` computes the source contribution to the MEG sensors using the same source model as the one used for the option :opt:`-DipSourceMat`, i.e. isolated dipoles. For this option, :input:`Input` takes the form: :input:`dipoles squids` where :input:`dipoles` contains the dipole description and :input:`squids` is a file describing the SQUIDS geometries and characteristics.
95+
96+
97+
98+
99+
om_minverser
100+
^^^^^^^^^^^^
101+
102+
General syntax:
103+
104+
:command:`om_minverser` :input:`HeadMat` :output:`HeadMatInv`
105+
106+
This program is used to invert the symmetric matrix as provided by the command :command:`om_assemble` with the option :opt:`-HeadMat`.
107+
108+
This command has only one option:
109+
110+
- :opt:`--help` (:opt:`-h`): summarizes the usage of :command:`om_minverser`.
111+
112+
.. note:: The output matrix :output:`HeadMatInv` is a symmetric matrix, like :input:`HeadMat`.
113+
114+
om_gain
115+
^^^^^^^
116+
117+
General syntax:
118+
119+
:command:`om_gain` :opt:`Option` :input:`HeadMatInv` :opt:`Parameters` SourceMat Head2EEGMat :output:`GainMatrix`
120+
121+
This command computes the gain matrix by multiplying together matrices obtained previously (e.g. :input:`HeadMatInv` is the matrix computed using :command:`om_minverser`).
122+
The resulting gain matrix is stored in the file :output:`GainMatrix`.
123+
:opt:`Option` selects the type of matrix to build. :opt:`Parameters` depend on the specific option :opt:`Option`.
124+
125+
General options:
126+
127+
128+
- :opt:`--help` (:opt:`-h`): summarizes the usage of :command:`om_gain` for all its possible options.
129+
130+
Gain matrix type options: select the type of gain matrix to be computed by :command:`om_gain`.
131+
132+
- :opt:`-EEG`: allows to compute an EEG or an ECoG gain matrix. For EEG :opt:`Parameters` are then: :input:`HeadMatInv SourceMat Head2EEGMat`. For ECoG :input:`Head2EEGMat` should simply be replaced by :input:`Head2ECoGMat`
133+
- :input:`SourceMat` is the matrix obtained using :command:`om_assemble` with either of the options
134+
:opt:`-SurfSourceMat` or :opt:`-DipSourceMat`, depending on the source model.
135+
- :input:`Head2EEGMat` (resp. :input:`Head2ECoGMat`) is the matrix obtained using :command:`om_assemble` with the option :opt:`-Head2EEGMat` (resp. :opt:`-Head2ECoGMat`).
136+
137+
- :opt:`-EEG` option is also used to compute an EIT gain matrix: in this case, :input:`SourceMat`
138+
should contain the output of the :opt:`-EITsource` option of :command:`om_assemble`. Multiplying
139+
the EIT gain matrix by the vector of applied currents at each EIT electrode yields the simulated
140+
potential on the EEG electrodes. The applied current on the EIT electrodes should sum to zero.
141+
142+
- :opt:`-MEG`: allows to compute a MEG gain matrix. :opt:`Parameters` are then:
143+
144+
- :input:`HeadMatInv SourceMat Head2MEGMat Source2MEGMat`
145+
- :input:`SourceMat` is the matrix obtained using :command:`om_assemble` with either of the options
146+
:opt:`-SurfSourceMat` or :opt:`-DipSourceMat`, depending on the source model. :input:`Head2MEGMat`
147+
is the matrix obtained using :command:`om_assemble` with the option :opt:`-HeadMEEGMat`.
148+
:input:`Source2MEGMat` is the matrix obtained using :command:`om_assemble` with either of the
149+
options :opt:`-SurfSource2MEGMat` or :opt:`-DipSource2MEGMat`, depending on the source model.
150+
151+
.. note::
152+
153+
The magnetic field is related both to the sources and to the electric potential, according to: :math:`\mathbf{M_{sensor}} = \mathbf{Source2MEGMat} * \mathbf{S} + \mathbf{Head2MEGMat}.\mathbf{X}`.
154+
155+
- :opt:`-InternalPotential`: allows to compute an internal potential gain matrix for sensors within the volume. :opt:`Parameters` are then:
156+
157+
- :input:`HeadMatInv SourceMat Head2InternalPotMat Source2InternalPotMat`
158+
- :input:`Head2InternalPotMat` and :input:`Source2InternalPotMat` are respectively obtained
159+
using :command:`om_assemble` with option :opt:`-Head2InternalPotMat` and :opt:`-DipSource2InternalPotMat`.

0 commit comments

Comments
 (0)