mne-bids: bug: write_raw_bids uses CapTrak coordsys for iEEG data (invalid)
EDIT SA: ieeg + captrak issue starts below in the thread here: https://github.com/mne-tools/mne-bids/issues/723#issuecomment-799307076
Hello everyone,
first thanks for the great and handy tool working with BIDS data. I am following this tutorial https://mne.tools/mne-bids/stable/auto_examples/convert_ieeg_to_bids.html, and I am wiriting the montage in order to write out BIDS comaptible data in such way:
montage = mne.channels.make_dig_montage(ch_pos=dict(zip(ch_names, elec)), \
coord_frame='mni_tal')
raw_arr.set_montage(montage, on_missing='warn')
mne_bids.write_raw_bids(raw=raw_arr, bids_path=bids_path, overwrite=True)
This nicely creates the BIDS folder structure, but when one session has multiple runs, the electrode.tsv get’s overwritten, so the electrode tsv created by the upper code is only written out in such way: sub-XYZ_ses-XYZ_acq-XYZ_space-XYZ_electrodes.tsv, but the “run” keyword is missing. This creates reading errors when working with multiple runs in one session. When the “run” keyword get’s included by hand, reading BIDS will read the electrodes.tsv and won’t result in an error like this (when working with multple runs):
RuntimeError: Channels do not correspond between raw data and the channels.tsv file. For MNE-BIDS, the channel names in the tsv MUST be equal and in the same order as the channels in the raw data.
So maybe the solution would be rather simple just to include the run keyword?
About this issue
- Original URL
- State: open
- Created 3 years ago
- Comments: 21 (18 by maintainers)
can I beg for an executive summary of the issue? maybe on discord during the sprint this week?
^ @sappelhoff @hoechenberger @agramfort is it best to start a discussion in MNE-python?
The reason is that if I do this is that the Standard template identifiers from BIDS haven’t been implemented in MNE-BIDS yet. I get the following message:
I think that you are right. This is only triggered if there are still EEG channels in the recording, even if our BIDSPath object is set to “ieeg”.
I am happy to contribute as much as I can, however I’m just starting to get the hang of how the coordinate frames in MNE work.
@adam2392 I agree that the only MNE coordinate frame really useful is mni_tal (or if no registration to an MNI space is available, maybe “mri” for the “raw” images). As I wrote above my personal experience using MNE is really limited. Should we maybe move this discussion to a dedicated thread where we can specifically discuss the integration of BIDS and MNE coordinate systems via MNE-BIDS because this issue was originally opened for a different problem?
@richardkoehler Thanks for your message!
This is not the case anymore in our development version, which I suppose we should release sooner than later …
See: https://github.com/mne-tools/mne-bids/pull/698 https://github.com/mne-tools/mne-bids/pull/704
Hello, if you have already cloned the repo, call
pip install -e .from the repo directory and it should work 💪
@sappelhoff what I meant is that we now allow a deviation between sidecar and raw channels. I’m wondering if @timonmerk would’ve even figured something was wrong so easily with master
Okay, but even if you (as researchers) refer to the visit of a participant on a certain day as a “session”, you could for the sake of BIDS organization say that this “visit-session” has several smaller measurement sessions.
For example do:
sub-01_ses-Day1Meas1_*,sub-01_ses-Day1Meas2_*,sub-01_ses-Day2Meas1_*, …and (potentially) explain what you mean by that in the README.
Would that be an option?