sccn / EEG-BIDS

21 stars 17 forks source link

Export with sessions as string #127

Open arnodelorme opened 2 years ago

arnodelorme commented 2 years ago

Cheng shared some files (file-cheng on my computer)

However, there is no script, and the files actually have numerical sessions (in the file name itself). Also, when creating a study with these files, the files do not have sessions or subjects defined.

Cheng, please share a script that takes these files as input to recreate the problem.

arnodelorme commented 2 years ago

I simply used the bids plugin in eeglab to export bids format. I did some scripts to identify the files from the file name etc: The bids-eeglab plugin will then automatically identify the information. The GUI from eeglab will identify the run/session/group correctly when create a study, however, it creates errors when exporting them to bids format.

Modified script below

for iEEG = 1:length(ALLEEG)
    EEG = ALLEEG(iEEG);
    EEG.subject = extractBefore(EEG.setname,'_'); % find out the subject ID
    EEG.session = str2num(char(extractBetween(EEG.setname,'ses-','_')));
    EEG.condition = char(extractBetween(EEG.setname,'task-','_'));
    EEG.run = str2num(char(extractAfter(EEG.setname,'run-')));
    EEG.task = EEG.condition;
    ALLEEG(iEEG).task = '';
    ALLEEG(iEEG) = EEG;
end
arnodelorme commented 2 years ago

Fixed in 20f89e7

ChengtengIp commented 2 years ago

Hi Arnaud,

I have tried to export the EEG data using the branch pernet_x from eeglab but it still did not work. I got an error message as below: image Best regards, Cheng

ChengtengIp commented 2 years ago

The same error message appears again even when I deleted that subject.

arnodelorme commented 2 years ago

I have merged the pernet_x branch to the master branch now.

  1. Use the modified script above
  2. Import all the datasets in EEGLAB
  3. Export to BIDS

Works for me.

arnodelorme commented 2 years ago

@CPernet can help. He knows how to do that.

CPernet commented 2 years ago

@ChengtengIp put a few of those subjects in a folder on our server and let see what is failing or not then I can update the function as needed and PR it