Skip to content

Commit

Permalink
MRG, ENH: Add infant template downloader (mne-tools#8738)
Browse files Browse the repository at this point in the history
* ENH: Add infant template downloader

* TST: Add test

* Update tutorials/source-modeling/plot_eeg_no_mri.py

Co-authored-by: Daniel McCloy <[email protected]>

Co-authored-by: Daniel McCloy <[email protected]>
  • Loading branch information
larsoner and drammock authored Jan 20, 2021
1 parent 81051e6 commit 5f17b35
Show file tree
Hide file tree
Showing 24 changed files with 1,679 additions and 31 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ recursive-include mne/data/image *
recursive-include mne/data/fsaverage *
include mne/datasets/_fsaverage/root.txt
include mne/datasets/_fsaverage/bem.txt
include mne/datasets/_infant/*.txt

recursive-include mne/channels/data/layouts *
recursive-include mne/channels/data/montages *
Expand Down
2 changes: 2 additions & 0 deletions doc/changes/latest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ Enhancements

- Add toggle-all button to :class:`mne.Report` HTML and ``width`` argument to :meth:`mne.Report.add_bem_to_section` (:gh:`8723` by `Eric Larson`_)

- Add infant template MRI dataset downloader :func:`mne.datasets.fetch_infant_template` (:gh:`8738` by `Eric Larson`_ and `Christian O'Reilly`_)

- Speed up :func:`mne.inverse_sparse.tf_mixed_norm` using STFT/ISTFT linearity (:gh:`8697` by `Eric Larson`_)

- `mne.Report.parse_folder` now processes supported non-FIFF files by default, too (:gh:`8744` by `Richard Höchenberger`_)
Expand Down
6 changes: 6 additions & 0 deletions doc/overview/datasets_index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,12 @@ For convenience, we provide a function to separately download and extract the

:ref:`tut-eeg-fsaverage-source-modeling`

Infant template MRIs
^^^^^^^^^^^^^^^^^^^^
:func:`mne.datasets.fetch_infant_template`

This function will download an infant template MRI from
:footcite:`OReillyEtAl2021` along with MNE-specific files.

ECoG Dataset
^^^^^^^^^^^^
Expand Down
1 change: 1 addition & 0 deletions doc/python_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ Datasets
fetch_aparc_sub_parcellation
fetch_fsaverage
fetch_hcp_mmp_parcellation
fetch_infant_template
fnirs_motor.data_path
hf_sef.data_path
kiloword.data_path
Expand Down
34 changes: 33 additions & 1 deletion doc/references.bib
Original file line number Diff line number Diff line change
Expand Up @@ -1888,10 +1888,42 @@ @misc{WikipediaSI
urldate = "12-October-2020"
}


@misc{BIDSdocs,
author = "{BIDS} contributors",
title = {Brain Imaging Data Structure — Specification},
url = {https://bids-specification.readthedocs.io/en/stable/},
urldate = "12-October-2020"
}


@article{OReillyEtAl2021,
title = {Structural templates for imaging {EEG} cortical sources in infants},
volume = {227},
issn = {1053-8119},
url = {http://www.sciencedirect.com/science/article/pii/S1053811920311678},
doi = {10.1016/j.neuroimage.2020.117682},
language = {en},
urldate = {2021-01-12},
journal = {NeuroImage},
author = {O'Reilly, Christian and Larson, Eric and Richards, John E. and Elsabbagh, Mayada},
month = feb,
year = {2021},
keywords = {Electroencephalography, Forward model, Infant, Neurodevelopment, Population template, Source reconstruction},
pages = {117682}
}

@article{RichardsEtAl2016,
series = {Sharing the wealth: {Brain} {Imaging} {Repositories} in 2015},
title = {A database of age-appropriate average {MRI} templates},
volume = {124},
issn = {1053-8119},
url = {http://www.sciencedirect.com/science/article/pii/S1053811915003559},
doi = {10.1016/j.neuroimage.2015.04.055},
language = {en},
journal = {NeuroImage},
author = {Richards, John E. and Sanchez, Carmen and Phillips-Meek, Michelle and Xie, Wanze},
month = jan,
year = {2016},
keywords = {Average MRI templates, Brain development, Lifespan MRI, Neurodevelopmental MRI Database},
pages = {1254--1259}
}
3 changes: 2 additions & 1 deletion mne/datasets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@
from .utils import (_download_all_example_data, fetch_hcp_mmp_parcellation,
fetch_aparc_sub_parcellation)
from ._fsaverage.base import fetch_fsaverage
from ._infant.base import fetch_infant_template

__all__ = [
'_download_all_example_data', '_fake', 'brainstorm', 'eegbci',
'fetch_aparc_sub_parcellation', 'fetch_fsaverage',
'fetch_aparc_sub_parcellation', 'fetch_fsaverage', 'fetch_infant_template',
'fetch_hcp_mmp_parcellation', 'fieldtrip_cmc', 'hf_sef', 'kiloword',
'misc', 'mtrf', 'multimodal', 'opm', 'phantom_4dbti', 'sample',
'sleep_physionet', 'somato', 'spm_face', 'testing', 'visual_92_categories',
Expand Down
37 changes: 13 additions & 24 deletions mne/datasets/_fsaverage/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import os.path as op


from ..utils import _manifest_check_download, _get_path
from ...utils import (verbose, get_subjects_dir, set_config)

FSAVERAGE_MANIFEST_PATH = op.dirname(__file__)
Expand Down Expand Up @@ -64,38 +65,26 @@ def fetch_fsaverage(subjects_dir=None, verbose=None):
# with open('fsaverage.txt', 'w') as fid:
# fid.write('\n'.join(names))
#
from ..utils import _manifest_check_download
subjects_dir = _set_montage_coreg_path(subjects_dir)
subjects_dir = op.abspath(subjects_dir)
fs_dir = op.join(subjects_dir, 'fsaverage')
os.makedirs(fs_dir, exist_ok=True)

fsaverage_data_parts = {
'root.zip': dict(
url='https://osf.io/3bxqt/download?revision=2',
hash_='5133fe92b7b8f03ae19219d5f46e4177',
manifest=op.join(FSAVERAGE_MANIFEST_PATH, 'root.txt'),
destination=op.join(subjects_dir),
),
'bem.zip': dict(
url='https://osf.io/7ve8g/download?revision=4',
hash_='b31509cdcf7908af6a83dc5ee8f49fb1',
manifest=op.join(FSAVERAGE_MANIFEST_PATH, 'bem.txt'),
destination=op.join(subjects_dir, 'fsaverage'),
),
}
for fname, data in fsaverage_data_parts.items():
_manifest_check_download(
destination=data['destination'],
manifest_path=data['manifest'],
url=data['url'],
hash_=data['hash_'],
)
_manifest_check_download(
manifest_path=op.join(FSAVERAGE_MANIFEST_PATH, 'root.txt'),
destination=op.join(subjects_dir),
url='https://osf.io/3bxqt/download?revision=2',
hash_='5133fe92b7b8f03ae19219d5f46e4177',
)
_manifest_check_download(
manifest_path=op.join(FSAVERAGE_MANIFEST_PATH, 'bem.txt'),
destination=op.join(subjects_dir, 'fsaverage'),
url='https://osf.io/7ve8g/download?revision=4',
hash_='b31509cdcf7908af6a83dc5ee8f49fb1',
)
return fs_dir


def _get_create_subjects_dir(subjects_dir):
from ..utils import _get_path
subjects_dir = get_subjects_dir(subjects_dir, raise_error=False)
if subjects_dir is None:
subjects_dir = _get_path(None, 'MNE_DATA', 'montage coregistration')
Expand Down
117 changes: 117 additions & 0 deletions mne/datasets/_infant/ANTS1-0Months3T.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
bem/ANTS1-0Months3T-5120-5120-5120-bem-sol.fif
bem/ANTS1-0Months3T-5120-5120-5120-bem.fif
bem/ANTS1-0Months3T-fiducials.fif
bem/ANTS1-0Months3T-head.fif
bem/ANTS1-0Months3T-oct-6-src.fif
bem/ANTS1-0Months3T-vol-5-src.fif
bem/inner_skull.surf
bem/inner_skull_large.surf
bem/outer_skin.surf
bem/outer_skin_large.surf
bem/outer_skull.surf
bem/outer_skull_large.surf
flirt_trans_mat.txt
label/aparc.annot.ctab
label/lh.aparc.a2009s.annot
label/lh.aparc.annot
label/lh.cortex.label
label/rh.aparc.a2009s.annot
label/rh.aparc.annot
label/rh.cortex.label
montages/10-10-montage.fif
montages/10-10_electrodes.tsv
montages/10-20-montage.fif
montages/10-20_electrodes.tsv
montages/10-5-montage.fif
montages/10-5_electrodes.tsv
montages/HGSN128-montage.fif
montages/HGSN128_electrodes.tsv
montages/HGSN129-montage.fif
montages/HGSN129_electrodes.tsv
mprage.nii.gz
mri/T1.mgz
mri/aparc+aseg.mgz
mri/aseg.count.txt
mri/aseg.mgz
mri/aseg.nii.gz
mri/aseg.presurf.mgz
mri/brain.finalsurfs.mgz
mri/brain.mgz
mri/brain.nii.gz
mri/brainmask.mgz
mri/brainmask.nii.gz
mri/filled.mgz
mri/lh.dpial.ribbon.mgz
mri/lh.dwhite.ribbon.mgz
mri/lh.ribbon.mgz
mri/norm.mgz
mri/norm.nii.gz
mri/rh.dpial.ribbon.mgz
mri/rh.dwhite.ribbon.mgz
mri/rh.ribbon.mgz
mri/ribbon.mgz
mri/transforms/niftyreg_affine.lta
mri/transforms/niftyreg_affine.nii.gz
mri/transforms/niftyreg_affine.txt
mri/transforms/niftyreg_affine.xfm
mri/transforms/talairach.auto.xfm
mri/transforms/talairach.xfm
mri/wm.mgz
surf/10-10-montage.obj
surf/10-10-montage.surf
surf/10-20-montage.obj
surf/10-20-montage.surf
surf/10-5-montage.obj
surf/10-5-montage.surf
surf/HGSN128-montage.obj
surf/HGSN128-montage.surf
surf/fiducials.obj
surf/fiducials.surf
surf/lh.area
surf/lh.curv
surf/lh.defects
surf/lh.inflated
surf/lh.inflated.H
surf/lh.inflated.K
surf/lh.input
surf/lh.orig
surf/lh.orig.euler.txt
surf/lh.orig_corrected
surf/lh.pial
surf/lh.qsphere
surf/lh.qsphere.nofix
surf/lh.smoothwm
surf/lh.smoothwm1
surf/lh.smoothwm2
surf/lh.smoothwm3
surf/lh.smoothwm4
surf/lh.smoothwm5
surf/lh.sphere
surf/lh.sphere.reg
surf/lh.sulc
surf/lh.thickness
surf/lh.white
surf/rh.area
surf/rh.curv
surf/rh.defects
surf/rh.inflated
surf/rh.inflated.H
surf/rh.inflated.K
surf/rh.input
surf/rh.orig
surf/rh.orig.euler.txt
surf/rh.orig_corrected
surf/rh.pial
surf/rh.qsphere
surf/rh.qsphere.nofix
surf/rh.smoothwm
surf/rh.smoothwm1
surf/rh.smoothwm2
surf/rh.smoothwm3
surf/rh.smoothwm4
surf/rh.smoothwm5
surf/rh.sphere
surf/rh.sphere.reg
surf/rh.sulc
surf/rh.thickness
surf/rh.white
115 changes: 115 additions & 0 deletions mne/datasets/_infant/ANTS10-5Months3T.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
bem/ANTS10-5Months3T-5120-5120-5120-bem-sol.fif
bem/ANTS10-5Months3T-5120-5120-5120-bem.fif
bem/ANTS10-5Months3T-fiducials.fif
bem/ANTS10-5Months3T-head.fif
bem/ANTS10-5Months3T-oct-6-src.fif
bem/ANTS10-5Months3T-vol-5-src.fif
bem/inner_skull.surf
bem/inner_skull_large.surf
bem/outer_skin.surf
bem/outer_skin_large.surf
bem/outer_skull.surf
bem/outer_skull_large.surf
flirt_trans_mat.txt
label/aparc.annot.ctab
label/lh.aparc.a2009s.annot
label/lh.aparc.annot
label/lh.cortex.label
label/rh.aparc.a2009s.annot
label/rh.aparc.annot
label/rh.cortex.label
montages/10-10-montage.fif
montages/10-10_electrodes.tsv
montages/10-20-montage.fif
montages/10-20_electrodes.tsv
montages/10-5-montage.fif
montages/10-5_electrodes.tsv
montages/HGSN128-montage.fif
montages/HGSN128_electrodes.tsv
montages/HGSN129-montage.fif
montages/HGSN129_electrodes.tsv
mprage.nii.gz
mri/T1.mgz
mri/aparc+aseg.mgz
mri/aseg.count.txt
mri/aseg.mgz
mri/aseg.nii.gz
mri/aseg.presurf.mgz
mri/brain.finalsurfs.mgz
mri/brain.mgz
mri/brain.nii.gz
mri/brainmask.mgz
mri/brainmask.nii.gz
mri/filled.mgz
mri/lh.dpial.ribbon.mgz
mri/lh.dwhite.ribbon.mgz
mri/lh.ribbon.mgz
mri/norm.mgz
mri/norm.nii.gz
mri/rh.dpial.ribbon.mgz
mri/rh.dwhite.ribbon.mgz
mri/rh.ribbon.mgz
mri/ribbon.mgz
mri/transforms/niftyreg_affine.lta
mri/transforms/niftyreg_affine.nii.gz
mri/transforms/niftyreg_affine.txt
mri/transforms/niftyreg_affine.xfm
mri/transforms/talairach.auto.xfm
mri/transforms/talairach.xfm
mri/wm.mgz
surf/10-10-montage.obj
surf/10-10-montage.surf
surf/10-20-montage.obj
surf/10-20-montage.surf
surf/10-5-montage.obj
surf/10-5-montage.surf
surf/HGSN128-montage.obj
surf/HGSN128-montage.surf
surf/fiducials.obj
surf/fiducials.surf
surf/lh.area
surf/lh.curv
surf/lh.inflated
surf/lh.inflated.H
surf/lh.inflated.K
surf/lh.orig
surf/lh.orig.euler.txt
surf/lh.orig_corrected
surf/lh.pial
surf/lh.qsphere
surf/lh.qsphere.nofix
surf/lh.smoothwm
surf/lh.smoothwm1
surf/lh.smoothwm2
surf/lh.smoothwm3
surf/lh.smoothwm4
surf/lh.smoothwm5
surf/lh.sphere
surf/lh.sphere.reg
surf/lh.sulc
surf/lh.thickness
surf/lh.white
surf/rh.area
surf/rh.curv
surf/rh.defects
surf/rh.inflated
surf/rh.inflated.H
surf/rh.inflated.K
surf/rh.input
surf/rh.orig
surf/rh.orig.euler.txt
surf/rh.orig_corrected
surf/rh.pial
surf/rh.qsphere
surf/rh.qsphere.nofix
surf/rh.smoothwm
surf/rh.smoothwm1
surf/rh.smoothwm2
surf/rh.smoothwm3
surf/rh.smoothwm4
surf/rh.smoothwm5
surf/rh.sphere
surf/rh.sphere.reg
surf/rh.sulc
surf/rh.thickness
surf/rh.white
Loading

0 comments on commit 5f17b35

Please sign in to comment.