MCPcopy
hub / github.com/mne-tools/mne-python / fetch_fsaverage

Function fetch_fsaverage

mne/datasets/_fsaverage/base.py:14–85  ·  view source on GitHub ↗

Fetch and update :ref:`fsaverage `. Parameters ---------- subjects_dir : str | None The path to use as the subjects directory in the MNE-Python config file. None will use the existing config variable (i.e., will not change anything), and if

(subjects_dir=None, *, verbose=None)

Source from the content-addressed store, hash-verified

12
13@verbose
14def fetch_fsaverage(subjects_dir=None, *, verbose=None):
15 """Fetch and update :ref:`fsaverage <fsaverage_background>`.
16
17 Parameters
18 ----------
19 subjects_dir : str | None
20 The path to use as the subjects directory in the MNE-Python
21 config file. None will use the existing config variable (i.e.,
22 will not change anything), and if it does not exist, will use
23 ``~/mne_data/MNE-fsaverage-data``.
24 %(verbose)s
25
26 Returns
27 -------
28 fs_dir : Path
29 The fsaverage directory.
30 (essentially ``subjects_dir / 'fsaverage'``).
31
32 .. versionchanged:: 1.8
33 A :class:`pathlib.Path` object is returned instead of a string.
34
35 Notes
36 -----
37 This function is designed to provide
38
39 1. All modern (Freesurfer 6) fsaverage subject files
40 2. All MNE fsaverage parcellations
41 3. fsaverage head surface, fiducials, head<->MRI trans, 1- and 3-layer
42 BEMs (and surfaces)
43
44 This function will compare the contents of ``subjects_dir/fsaverage``
45 to the ones provided in the remote zip file. If any are missing,
46 the zip file is downloaded and files are updated. No files will
47 be overwritten.
48
49 .. versionadded:: 0.18
50 """
51 # Code used to create the BEM (other files taken from MNE-sample-data):
52 #
53 # $ mne watershed_bem -s fsaverage -d $PWD --verbose info --copy
54 # $ python
55 # >>> bem = mne.make_bem_model('fsaverage', subjects_dir='.', verbose=True)
56 # >>> mne.write_bem_surfaces(
57 # ... 'fsaverage/bem/fsaverage-5120-5120-5120-bem.fif', bem)
58 # >>> sol = mne.make_bem_solution(bem, verbose=True)
59 # >>> mne.write_bem_solution(
60 # ... 'fsaverage/bem/fsaverage-5120-5120-5120-bem-sol.fif', sol)
61 # >>> import os
62 # >>> import os.path as op
63 # >>> names = sorted(op.join(r, f)
64 # ... for r, d, files in os.walk('fsaverage')
65 # ... for f in files)
66 # with open('fsaverage.txt', 'w') as fid:
67 # fid.write('\n'.join(names))
68 #
69 subjects_dir = _set_montage_coreg_path(subjects_dir)
70 subjects_dir = subjects_dir.expanduser().absolute()
71 fs_dir = subjects_dir / "fsaverage"

Callers 6

montage_sgskip.pyFile · 0.90
35_eeg_no_mri.pyFile · 0.90
20_seeg.pyFile · 0.90

Calls 2

_set_montage_coreg_pathFunction · 0.85
_manifest_check_downloadFunction · 0.85

Tested by

no test coverage detected