|
a |
|
b/doc/_includes/bem_model.rst |
|
|
1 |
:orphan: |
|
|
2 |
|
|
|
3 |
Creating the BEM meshes |
|
|
4 |
======================= |
|
|
5 |
|
|
|
6 |
.. NOTE: part of this file is included in doc/overview/implementation.rst. |
|
|
7 |
Changes here are reflected there. If you want to link to this content, link |
|
|
8 |
to :ref:`bem-model` to link to that section of the implementation.rst page. |
|
|
9 |
The next line is a target for :start-after: so we can omit the title from |
|
|
10 |
the include: |
|
|
11 |
bem-begin-content |
|
|
12 |
|
|
|
13 |
.. _bem_watershed_algorithm: |
|
|
14 |
|
|
|
15 |
Using the watershed algorithm |
|
|
16 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
|
17 |
|
|
|
18 |
The watershed algorithm [Segonne *et al.*, |
|
|
19 |
2004] is part of the FreeSurfer software. |
|
|
20 |
The name of the program is ``mri_watershed``. |
|
|
21 |
Its use in the MNE environment is facilitated by the script |
|
|
22 |
:ref:`mne watershed_bem`. |
|
|
23 |
|
|
|
24 |
After ``mne watershed_bem`` has completed, the following files appear in the |
|
|
25 |
subject's :file:`bem/watershed` directory: |
|
|
26 |
|
|
|
27 |
- :file:`{<subject>}_brain_surface` contains the brain surface triangulation. |
|
|
28 |
|
|
|
29 |
- :file:`{<subject>}_inner_skull_surface` contains the inner skull |
|
|
30 |
triangulation. |
|
|
31 |
|
|
|
32 |
- :file:`{<subject>}_outer_skull_surface` contains the outer skull |
|
|
33 |
triangulation. |
|
|
34 |
|
|
|
35 |
- :file:`{<subject>}_outer_skin_surface` contains the scalp triangulation. |
|
|
36 |
|
|
|
37 |
All of these surfaces are in the FreeSurfer format. In addition, there will be |
|
|
38 |
a file called :file:`bem/watershed/ws.mgz` which contains the brain MRI |
|
|
39 |
volume. Furthermore, ``mne watershed_bem`` script converts the scalp surface to |
|
|
40 |
fif format and saves the result to :file:`bem/{<subject>}-head.fif`. |
|
|
41 |
|
|
|
42 |
.. _bem_flash_algorithm: |
|
|
43 |
|
|
|
44 |
Using FLASH images |
|
|
45 |
~~~~~~~~~~~~~~~~~~ |
|
|
46 |
|
|
|
47 |
This method depends on the availablily of MRI data acquired with a multi-echo |
|
|
48 |
FLASH sequence at two flip angles (5 and 30 degrees). These data can be |
|
|
49 |
acquired separately from the MPRAGE data employed in FreeSurfer cortical |
|
|
50 |
reconstructions but it is strongly recommended that they are collected at the |
|
|
51 |
same time with the MPRAGEs or at least with the same scanner. For easy |
|
|
52 |
co-registration, the images should have FOV, matrix, slice thickness, gap, and |
|
|
53 |
slice orientation as the MPRAGE data. For information on suitable pulse |
|
|
54 |
sequences, see :footcite:t:`FischlEtAl2004`. |
|
|
55 |
|
|
|
56 |
Creation of the BEM meshes using this method involves the following steps: |
|
|
57 |
|
|
|
58 |
- Creating a synthetic 5-degree flip angle FLASH volume, register |
|
|
59 |
it with the MPRAGE data, and run the segmentation and meshing program. |
|
|
60 |
This step is accomplished by running the script :ref:`mne flash_bem`. |
|
|
61 |
|
|
|
62 |
- Inspecting the meshes with tkmedit, see :ref:`inspecting-meshes`. |
|
|
63 |
|
|
|
64 |
.. note:: Different methods can be employed for the creation of the |
|
|
65 |
individual surfaces. For example, it may turn out that the |
|
|
66 |
watershed algorithm produces are better quality skin surface than |
|
|
67 |
the segmentation approach based on the FLASH images. If this is |
|
|
68 |
the case, ``outer_skin.surf`` can set to point to the corresponding |
|
|
69 |
watershed output file while the other surfaces can be picked from |
|
|
70 |
the FLASH segmentation data. |
|
|
71 |
|
|
|
72 |
|
|
|
73 |
Organizing MRI data into directories |
|
|
74 |
------------------------------------ |
|
|
75 |
|
|
|
76 |
Since all images comprising the multi-echo FLASH data are contained in a single |
|
|
77 |
series, it is necessary to organize the images according to the echoes before |
|
|
78 |
proceeding to the BEM surface reconstruction. This can be accomplished by using |
|
|
79 |
`dcm2niix <https://www.nitrc.org/plugins/mwiki/index.php/dcm2nii:MainPage>`__ |
|
|
80 |
or the MNE-C tool ``mne_organize_dicom`` if necessary, then use |
|
|
81 |
:func:`mne.bem.convert_flash_mris`. |
|
|
82 |
|
|
|
83 |
Creating the surface tessellations |
|
|
84 |
---------------------------------- |
|
|
85 |
|
|
|
86 |
The BEM surface segmentation and tessellation is automated with the script |
|
|
87 |
:ref:`mne flash_bem`. It assumes that a FreeSurfer reconstruction for this |
|
|
88 |
subject is already in place. |
|
|
89 |
|
|
|
90 |
Before running :ref:`mne flash_bem` do the following: |
|
|
91 |
|
|
|
92 |
- Create symbolic links from the directories containing the 5-degree and |
|
|
93 |
30-degree flip angle FLASH series to ``flash05`` and ``flash30``, |
|
|
94 |
respectively: |
|
|
95 |
|
|
|
96 |
- :samp:`ln -s {<FLASH 5 series dir>} flash05` |
|
|
97 |
|
|
|
98 |
- :samp:`ln -s {<FLASH 30 series dir>} flash30` |
|
|
99 |
|
|
|
100 |
- Some partition formats (e.g. FAT32) do not support symbolic links. In this |
|
|
101 |
case, copy the file to the appropriate series: |
|
|
102 |
|
|
|
103 |
- :samp:`cp {<FLASH 5 series dir>} flash05` |
|
|
104 |
|
|
|
105 |
- :samp:`cp {<FLASH 30 series dir>} flash30` |
|
|
106 |
|
|
|
107 |
- Set the ``SUBJECTS_DIR`` and ``SUBJECT`` environment variables or pass |
|
|
108 |
the ``--subjects-dir`` and ``--subject`` options to ``mne flash_bem`` |
|
|
109 |
|
|
|
110 |
.. note:: If ``mne flash_bem`` is run with the ``--noflash30`` option, the |
|
|
111 |
:file:`flash30` directory is not needed, *i.e.*, only the 5-degree flip |
|
|
112 |
angle flash data are employed. |
|
|
113 |
|
|
|
114 |
It may take a while for ``mne flash_bem`` to complete. It uses the FreeSurfer |
|
|
115 |
directory structure under ``$SUBJECTS_DIR/$SUBJECT``. The script encapsulates |
|
|
116 |
the following processing steps: |
|
|
117 |
|
|
|
118 |
- It creates an mgz file corresponding to each of the eight echoes in each of |
|
|
119 |
the FLASH directories in ``mri/flash``. The files will be called |
|
|
120 |
:file:`mef {<flip-angle>}_{<echo-number>}.mgz`. |
|
|
121 |
|
|
|
122 |
- If the ``unwarp=True`` option is specified, run grad_unwarp and produce |
|
|
123 |
files :file:`mef {<flip-angle>}_{<echo-number>}u.mgz`. These files will be |
|
|
124 |
then used in the following steps. |
|
|
125 |
|
|
|
126 |
- It creates parameter maps in :file:`mri/flash/parameter_maps` using |
|
|
127 |
``mri_ms_fitparms``. |
|
|
128 |
|
|
|
129 |
- It creates a synthetic 5-degree flip angle volume in |
|
|
130 |
:file:`mri/flash/parameter_maps/flash5.mgz` using ``mri_synthesize``. |
|
|
131 |
|
|
|
132 |
- Using ``fsl_rigid_register``, it creates a registered 5-degree flip angle |
|
|
133 |
volume ``mri/flash/parameter_maps/flash5_reg.mgz`` by registering |
|
|
134 |
:file:`mri/flash/parameter_maps/flash5.mgz` to the *T1* volume under ``mri``. |
|
|
135 |
|
|
|
136 |
- Using ``mri_convert``, it converts the flash5_reg volume to COR format under |
|
|
137 |
``mri/flash5``. If necessary, the T1 and brain volumes are also converted |
|
|
138 |
into the COR format. |
|
|
139 |
|
|
|
140 |
- It runs ``mri_make_bem_surfaces`` to create the BEM surface tessellations. |
|
|
141 |
|
|
|
142 |
- It creates the directory :file:`bem/flash`, moves the tri-format |
|
|
143 |
tringulations there and creates the corresponding FreeSurfer surface files |
|
|
144 |
in the same directory. |
|
|
145 |
|
|
|
146 |
- The COR format volumes created by ``mne flash_bem`` are removed. |
|
|
147 |
|
|
|
148 |
If the ``--noflash30`` option is specified to ``mne flash_bem``, |
|
|
149 |
steps 3 and 4 in the above are replaced by averaging over the different |
|
|
150 |
echo times in 5-degree flip angle data. |
|
|
151 |
|
|
|
152 |
.. _inspecting-meshes: |
|
|
153 |
|
|
|
154 |
Inspecting the meshes |
|
|
155 |
--------------------- |
|
|
156 |
|
|
|
157 |
It is advisable to check the validity of the BEM meshes before |
|
|
158 |
using them. This can be done with: |
|
|
159 |
|
|
|
160 |
- the ``--view`` option of :ref:`mne flash_bem` |
|
|
161 |
- calling :func:`mne.viz.plot_bem` directly |
|
|
162 |
- Using FreeSurfer tools ``tkmedit`` or ``freeview`` |