Skip to content

bug: write_raw_bids uses CapTrak coordsys for iEEG data (invalid) #723

@timonmerk

Description

@timonmerk

EDIT SA: ieeg + captrak issue starts below in the thread here: #723 (comment)


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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions