Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Size of electrodes vs size of channels #701

Closed
Immiora opened this issue Feb 10, 2021 · 11 comments · Fixed by #704
Closed

Size of electrodes vs size of channels #701

Immiora opened this issue Feb 10, 2021 · 11 comments · Fixed by #704
Labels
Milestone

Comments

@Immiora
Copy link

Immiora commented Feb 10, 2021

Currently, mne-bids requires that the number of entries in electrodes.tsv and the raw datafile.eeg are the same:

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. 80 channels in tsv file: ".../electrodes.tsv" ... 128 channels in raw file: "('.../ieeg.eeg',)" ...

However, this is often the case for iEEG. See example here with 97 iEEG electrodes and 98 channels in the data.

According to iBIDS guidelines, electrodes.tsv contains iEEG positions, but channels.tsv contains all channels on the recording system, not only iEEG, but for example, EOG, ECG, EMG, etc. The number of channels in channels.tsv therefore matches the number of channels in the datafile.eeg, but not in electrodes.tsv.

Can this requirement be relaxed or what workaround would you recommend? We would like to supply EOG/ECG/EMG recordings with the dataset but they do not have locations in electrodes.tsv

@Immiora
Copy link
Author

Immiora commented Feb 10, 2021

Also, I am a bit confused why in the text of the error it says Channels do not correspond between raw data and the channels.tsv file, whereas it refers to the entries in the electrodes.tsv

@Immiora Immiora closed this as completed Feb 10, 2021
@Immiora Immiora reopened this Feb 10, 2021
@hoechenberger
Copy link
Member

Channels do not correspond between raw data and the channels.tsv file, whereas it refers to the entries in the electrodes.tsv

I assume this error message was just copied from the (older) channels.tsv handling code to the (newer) electrodes.tsv code, and we forgot to adjust it accordingly.

According to iBIDS guidelines, electrodes.tsv contains iEEG positions, but channels.tsv contains all channels on the recording system, not only iEEG, but for example, EOG, ECG, EMG, etc. The number of channels in channels.tsv therefore matches the number of channels in the datafile.eeg, but not in electrodes.tsv.

Absolutely, this is clearly a bug.

For the record, we're currently in the process of relaxing similar constraints in other contexts as well, see e.g. #698, which was merged today, but doesn't address iEEG so far

@sappelhoff
Copy link
Member

yes, electrodes.tsv can have a different number of entries than channels and raw data (channels and raw data should be identical) see also bids-standard/bids-specification#667

@adam2392
Copy link
Member

Okay I think we should adapt the error. That is, electrodes.tsv should be a subset of the raw ch_names. I.e. if there are names defined there not in raw.ch_names, the error should be raised. However, they do not need to match 1-1.

I am PRing this up rn.

@hoechenberger
Copy link
Member

That is, electrodes.tsv should be a subset of the raw ch_names

No, it is okay for electrodes.tsv to have more electrodes than there are channels in the data

@sappelhoff
Copy link
Member

sappelhoff commented Feb 10, 2021

No, it is okay for electrodes.tsv to have more electrodes than there are channels in the data

furthermore, channels.tsv does not have to be a subset of electrodes.tsv

Imagine the case:

  • you record EOG using two passive electrodes placed at the outer canthi of the left and right eye: HEOGL and HEOGR
  • in your data you make a bipolar reference between these two channels, and end up with a single channel HEOG

Some recording equipment types let you do this during recording, so I wouldn't even consider it a "derivative"

@adam2392
Copy link
Member

adam2392 commented Feb 10, 2021

That is, electrodes.tsv should be a subset of the raw ch_names

No, it is okay for electrodes.tsv to have more electrodes than there are channels in the data

Wait sorry I might not be understanding correctly. How can there be "coordinate" data for channels that are not in the raw data?

How can one do raw.set_montage(montage)? Does it work if montage contains names not in raw.ch_names?

@sappelhoff
Copy link
Member

Related: #485

@sappelhoff sappelhoff added this to the 0.7 milestone Feb 12, 2021
@sappelhoff
Copy link
Member

Can this requirement be relaxed or what workaround would you recommend? We would like to supply EOG/ECG/EMG recordings with the dataset but they do not have locations in electrodes.tsv

@Immiora I would add the electrodes used to get these channels to electrodes.tsv and just set their values for xyz to n/a

@Immiora
Copy link
Author

Immiora commented Mar 4, 2021

Can this requirement be relaxed or what workaround would you recommend? We would like to supply EOG/ECG/EMG recordings with the dataset but they do not have locations in electrodes.tsv

@Immiora I would add the electrodes used to get these channels to electrodes.tsv and just set their values for xyz to n/a

Do not think this is the intended use.

From BIDS Specification Docs:
Electrode description (*_electrodes.tsv): File that gives the location, size and other properties of iEEG electrodes.

But it looks like the issue has been addressed. Thanks!

@sappelhoff
Copy link
Member

Mh, I always understood these files to contain all kinds of electrodes, including ECG, EOG, etc. --> especially because these are often recorded using the same amplifier as the (i)EEG electrodes.

But I agree with you that the spec text makes it seem otherwise. Perhaps that should/could be fixed.

Anyways, glad your issue has been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants