brainstorm3 icon indicating copy to clipboard operation
brainstorm3 copied to clipboard

Missing EEG Channel Names When Importing FIF/BIDS Files from NeuroMag

Open tmedani opened this issue 7 months ago • 4 comments

Problem Summary:

Multiple centers have encountered a recurring issue when importing .fif files into Brainstorm: the EEG channel names are not properly retained or imported. This is particularly evident with data originating from NeuroMag systems, where the channel labels either appear as generic names or are entirely missing.

Suggested Solutions:

To address this issue and improve interoperability with .fif data:

  1. Enhancement During Import:

Add an option during the import process to replace standard channel names using a user-specified mapping file (e.g., .csv or .txt).

This file would contain a simple mapping (e.g., EEG001 → Fp1, EEG002 → Fz, etc.).

  1. Post-Import Channel Editing:

Add a right-click context menu option on the channel file (in the Brainstorm GUI) to "Replace Channel Names from Mapping File".

This would allow retrospective correction of channel names after the data has already been imported.

tmedani avatar May 28 '25 20:05 tmedani

Currently, process_import_bids.m comments contain the following DISCUSSION:

%   - Metadata conflicts:
%     - Channel names are kept from the original data files, and can't be renamed with the BIDS metadata.
%       This simplifies a lot the implementation, as we can keep on using the original channel file and add the extra info from _channels.tsv and _electrodes.tsv.
%       This is not aligned with the idea that "In cases of conflict, the BIDS metadata is considered "
%       But the channel names are never expected to be different between the data files and the metadata: 
%       "If BIDS metadata is defined, format-specific metadata MUST NOT conflict to the extent permitted by the format"
%       (reference: https://github.com/bids-standard/bids-specification/pull/761)

We need to modify its behavior such that for non-MEG channels, we perform "Post-Import Channel Editing" by:

  1. Reads the channel names and channel units from the BIDS sidecar _channels.tsv
  2. Reads the electrode location from BIDS sidecar _electrodes.tsv

Please note, that for MEG channels FIF file should be considered authoritative.

yashvakilna avatar Jun 11 '25 18:06 yashvakilna

Thanks @yashvakilna

@chinmaychinara91 can you please check this and compare it with your current scripts?

tmedani avatar Jun 11 '25 19:06 tmedani

@chinmaychinara91 any updates on this issues?

tmedani avatar Jun 16 '25 23:06 tmedani

Based on the discussion with with @yashvakilna and Michelle today and adding to the yash's https://github.com/brainstorm-tools/brainstorm3/issues/802#issuecomment-2963851225 above:

When importing FIF files through process_import_bids, for non-MEG (here EEG) channels, two post processing steps are required:

  1. Renaming the EEGxxx channel names to the proper ones as provided in the _channels.tsv file
  2. Update the locations for the EEG channels from _electrodes.tsv. The reason we do this is because the locations in the FIF file may have error but _electrodes.tsv will have the most accurate locations.

chinmaychinara91 avatar Jun 17 '25 20:06 chinmaychinara91

@yashvakilna, @chinmaychinara91, @tmedani, was this was solved with #810? If so we can close the issue.

rcassani avatar Aug 01 '25 17:08 rcassani

Yes we can. It has been solved in #810

chinmaychinara91 avatar Aug 01 '25 17:08 chinmaychinara91