Problem with markers' timing when importing from EEGlab

Hi Francois,

I am importing epoched data preprocessed in EEGlab. Everything works fine, I have the correct number of epochs (830 in my example subject, please find the file at this link), which have the proper length (from -2 to +3 s). As you can see from the 2 figures attached, the data are visually the same (I also checked the averages, they correspond).

The only problem is that all the markers look shifted in time in Brainstorm compared to EEGlab. This is the legend of the markers:

  • 64517 = fixation
  • 64629 = stimulus appearance
  • 64518 = start response
  • 64519 = end response
  • 64514 = trial end

I imported the data both with the following code and manually (same result):

% start code
sublist= 2;
nsub = length(sublist);
for isub=1:nsub
isub
cat_dir= sprintf('myFolder' );

% create subject
SubjectName = sprintf('Subject%02d', sublist(isub));
UseDefaultAnat = 1;
UseDefaultChannel = 1;
[sSubject, iSubject] = db_add_subject(SubjectName, [], UseDefaultAnat, UseDefaultChannel);
% If an error occured in subject creation (subject already exists, impossible to create folders...)
if isempty(sSubject)
    error('Could not create subject.');
end
sFiles = [];

% import EEG data
RawFiles = {...
    strcat(cat_dir,sprintf('S%02d_final.set',sublist(isub)))};

sFiles = bst_process(...
    'CallProcess', 'process_import_data_epoch', ...
    sFiles, [], ...
    'subjectname', SubjectName, ...
    'condition', 'Alltrials', ...
    'datafile', {{RawFiles{1}}, 'EEG-EEGLAB'}, ...
    'iepochs', [], ...
    'createcond', 0, ...
    'channelalign', 1, ...
    'usectfcomp', 1, ...
    'usessp', 1, ...
    'freq', [], ...
    'baseline', []);

end
% end code

Is there a way I can fix this? Thank you very much for your help!

Rocco

Hi Rocco,

I think I fixed this issue. Try again and let me know.
https://github.com/brainstorm-tools/brainstorm3/commit/e7775d3e8c939485284af0dcaa290bc07198a527#diff-f2dc36c1f05872dda8a51a1af9b9e5ee

It’s weird that in all these years, no one ever reported it… I guess people don’t care much about events after the are epoched and sorted.

Thanks for reporting it!
Francois

(Update Brainstorm first)

Thanks, that was fast! it works!
Yes I agree, normally when you cut your epochs you don’t need markers anymore. Nonetheless, in my case I would like to refer to the same “big” epochs both when I lock to the stim and to the response (that’s why I cut quite large epochs, to include both stim and resp markers).
Is there a way in Brainstorm to further cut existing stimulus-locked epochs on the basis of a response marker which they include? In a similar way to the “extract time function” but referring to a specific marker.

Another way around it for me could be to recode some events on the preprocessed file, and then import in the databased based on these new events. Unfortunately it’s not possible to use functions as “combine stim-response” on epoched data. Any suggestion?

thank you!!
rocco

You can re-epoch the data after it has been imported in Brainstorm.
For what I see the function process_evt_combine (“Combine stim-response”) is available for imported data as well.

If you are not able to use these functions on the EEGLAB file linked to the database with the menu “Review raw file”, you could try first importing the epochs, or directly use the menu “Import MEG/EEG”.