Importing Epoched Data from MNE into Brainstorm

Hi,

I have an automatic EEG pre-processing pipeline in MNE, but I want to try doing some of my analysis in Brainstorm. The data is epoched as a part of the preprocessing and I’m able to save it out as a Neuromag .fif file.

The problem comes when I try importing the epoched data into Brainstorm, I lose all the event data. Every epoch is put into the folder ‘Epoch’ and they all get labelled with the same label 'Epoch’. I'm not so bothered about the events being missing as each epoch should only have one event, but the lack of meaningful labelling is more of an issue.

I suppose if each epoch file name is numbered correctly I might be able to write a script that applies the correct label to each file. Is there a different import method or file format I’m missing or is that the only way?

Lyndon

Hi Lyndon,

Brainstorm should be able to properly handle epoched .fif files from MNE.
Could you share the culprit file, to understand what is going on?

Best,
Raymundo

Hi Raymundo,

Here's one of the offending files:

Many thanks,
Lyndon

1 Like

Hi @llr510,

Indeed, Brainstorm does not support events are not supported in epoched .fif files
See: Error message when importing an epoched fif file that was preprocessed with MNE python into brainstorm

Regarding the order of the epochs, they are the same order as in MNE-Python.

In Brainstorm once Epochs are imported (without removing DC)

DataMat = in_bst_data('Subject01/test-epo_02/data_Epoch_trial001.mat', 'F');
% Signals are in field F
signals_in_brainstorm = DataMat.F;

In Python

epochs = mne.read_epochs('test-epo.fif')
signals_in_python = epochs[0]._data

The content of signals_in_brainstorm and signals_in_python is the same.
This is true for all epoch, with a shift of 1 due to indexing


@Francois, any thoughts on getting more data from the MNE .fif files?

Hi @Raymundo.Cassani,

Thanks for letting me know that events aren't supported.

Since the import order is the same as in MNE, I was able to make a Brainstorm script that would add multiple tags from a csv file with the column 'label' and a row for each epoch event.

I'll share it for anyone else who has the same issue, but it's literally just a bastardized version of 'Add Tag' that I duplicated and tweaked slightly:
process_tag_by_events.m (6.5 KB)

1 Like