From 2d8a7216b547baedd525991f97aa4537d5fe98dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-R=C3=A9mi=20KING?= Date: Tue, 13 Jul 2021 23:05:00 +0200 Subject: [PATCH] Add KIT/Yokogawa/Ricoh marker coil extension: ".mrk" to allowed extensions (#842) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add mrk extension * Update mne_bids/config.py Co-authored-by: Stefan Appelhoff * changlog * add Jean-Rémi to Authors.rst * fix head_to_mri upstream API change * add KIT test for MRK and CON * update whatsnew Co-authored-by: Stefan Appelhoff --- doc/authors.rst | 1 + doc/whats_new.rst | 2 ++ examples/convert_mri_and_trans.py | 2 +- mne_bids/config.py | 3 ++- mne_bids/tests/test_write.py | 19 +++++++++++++++++++ 5 files changed, 25 insertions(+), 2 deletions(-) diff --git a/doc/authors.rst b/doc/authors.rst index 636ddf48f..c4a13fb95 100644 --- a/doc/authors.rst +++ b/doc/authors.rst @@ -24,3 +24,4 @@ .. _Tom Donoghue: https://github.com/TomDonoghue .. _Richard Köhler: https://github.com/richardkoehler .. _Sin Kim: https://github.com/AKSoo +.. _Jean-Rémi King: https://kingjr.github.io/ diff --git a/doc/whats_new.rst b/doc/whats_new.rst index 84de0d13b..1b2f1e6a1 100644 --- a/doc/whats_new.rst +++ b/doc/whats_new.rst @@ -27,6 +27,7 @@ Authors * `Richard Höchenberger`_ * `Adam Li`_ * `Richard Köhler`_ (new contributor) +* `Jean-Rémi King`_ (new contributor) Detailed list of changes ~~~~~~~~~~~~~~~~~~~~~~~~ @@ -44,6 +45,7 @@ Enhancements - :func:`mne_bids.write_raw_bids` gained a new parameter ``empty_room`` that allows to specify an associated empty-room recording when writing an MEG data file. This information will be stored in the ``AssociatedEmptyRoom`` field of the MEG JSON sidecar file, by `Richard Höchenberger`_ (:gh:`795`) - Added support for the new channel type ``'dbs'`` (Deep Brain Stimulation), which was introduced in MNE-Python 0.23, by `Richard Köhler`_ (:gh:`800`) - :func:`mne_bids.read_raw_bids` now warns in many situations when it encounters a mismatch between the channels in ``*_channels.tsv`` and the raw data, by `Richard Höchenberger`_ (:gh:`823`) +- MNE BIDS now accepts ".mrk" head digitization files used in the KIT/Yokogawa/Ricoh MEG system, by `Jean-Rémi King`_ and `Stefan Appelhoff`_ (:gh:`842`) API and behavior changes ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/examples/convert_mri_and_trans.py b/examples/convert_mri_and_trans.py index 10fb4dfb3..b49e9ffbf 100644 --- a/examples/convert_mri_and_trans.py +++ b/examples/convert_mri_and_trans.py @@ -46,7 +46,7 @@ import mne from mne.datasets import sample -from mne.source_space import head_to_mri +from mne import head_to_mri from mne_bids import (write_raw_bids, BIDSPath, write_anat, get_anat_landmarks, get_head_mri_trans, print_dir_tree) diff --git a/mne_bids/config.py b/mne_bids/config.py index 687e7e327..b875ff407 100644 --- a/mne_bids/config.py +++ b/mne_bids/config.py @@ -131,7 +131,8 @@ ALLOWED_INPUT_EXTENSIONS + ['.json', '.tsv', '.tsv.gz', '.nii', '.nii.gz'] + ['.pos', '.eeg', '.vmrk'] + # extra datatype-specific metadata files. - ['.dat', '.EEG'] # extra eeg extensions + ['.dat', '.EEG'] + # extra eeg extensions + ['.mrk'] # KIT/Yokogawa/Ricoh marker coil ) # allowed BIDS path entities diff --git a/mne_bids/tests/test_write.py b/mne_bids/tests/test_write.py index a822d4d68..995953049 100644 --- a/mne_bids/tests/test_write.py +++ b/mne_bids/tests/test_write.py @@ -886,6 +886,25 @@ def test_kit(_bids_validate, tmpdir): events_data=events_fname, event_id=event_id, overwrite=True) + # check that everything works with MRK markers, and CON files + data_path = op.join(testing.data_path(download=False), 'KIT') + raw_fname = op.join(data_path, 'data_berlin.con') + hpi_fname = op.join(data_path, 'MQKIT_125.mrk') + electrode_fname = op.join(data_path, 'MQKIT_125.elp') + headshape_fname = op.join(data_path, 'MQKIT_125.hsp') + bids_root = tmpdir.mkdir("bids_kit_mrk") + kit_bids_path = _bids_path.copy().update(acquisition=None, + root=bids_root, + suffix='meg') + raw = _read_raw_kit( + raw_fname, mrk=hpi_fname, elp=electrode_fname, + hsp=headshape_fname) + write_raw_bids(raw, kit_bids_path) + + _bids_validate(bids_root) + assert op.exists(bids_root / 'participants.tsv') + read_raw_bids(bids_path=kit_bids_path) + @pytest.mark.filterwarnings(warning_str['meas_date_set_to_none']) def test_ctf(_bids_validate, tmpdir):