Import Data without changing global channel location of the protocol

Hi everyone,

I just need a suggestion. I am creating a protocol with a global channel file. I am loading data from a EEGlab preprocessed resting state, with no individual anatomy, so every subject will have the same channel location and the same Default anatomy.

What I do is that I create a new subject, editing the subject with the global channel location, and then I import the data, in the following way:

[sSubject, iSubject] = db_add_subject(subjName,[ ],1,2);


sImported = bst_process('CallProcess', 'process_import_data_time', [], [], ...
    'subjectname', subjName, ...               % target Brainstorm subject
    'condition',   condName, ...               % condition/folder name
    'datafile',    {thisSetPath, 'EEG-EEGLAB'}, ... % EEGLAB file
    'timewindow',  [], ...                     % full time
    'split',         0, ...
    'channelalign',  0, ...
    'ignoreshort',   1, ...
    'usectfcomp',    0, ...
    'usessp',        0, ...
    'freq',          [], ...
    'baseline',      [], ...
    'blsensortypes', 'EEG');

However, when I import the data the global channel location is changed. When I do from gui I can import the data and it asks if I want to delete the previous channel location. But from code even if I use the argument “ 'channelalign', 0, ...” the global channel location is changed. How can import the data without changing the global channel location of the protocol?

Thanks

Hello @gianmarcoduma,

Before anything else, we do not recommend using a global channel file, nor using one channel file per subject. That is why these options are grayed out. The recommendation is to use one channel file per acquisition run. The reason behind this is that elements such as projectors (re-referencing, ICA and SSP) are saved in the channel file, and it is likely that different subjects (and different runs) will have different projectors.

:light_bulb: we keep those grayed options just for legacy support.

You can import first the data, then add the electrode locations based on the Default anatomy anatomy. Check the code snippet below, it assumes you are using the ICBM152 template as Default anatomy.

% Subject: DefAnat, OneChannelFilePerRun
[sSubject, iSubject] = db_add_subject('Testo',[], 1, 0);

% Process: Import MEG/EEG: Time
sImported = bst_process('CallProcess', 'process_import_data_time', [], [], ...
    'subjectname', subjName, ...               % target Brainstorm subject
    'condition',   condName, ...               % condition/folder name
    'datafile',    {thisSetPath, 'EEG-EEGLAB'}, ... % EEGLAB file
    'timewindow',  [], ...                     % full time
    'split',         0, ...
    'channelalign',  0, ...
    'ignoreshort',   1, ...
    'usectfcomp',    0, ...
    'usessp',        0, ...
    'freq',          [], ...
    'baseline',      [], ...
    'blsensortypes', 'EEG');

% Process: Add EEG positions
sFiles = bst_process('CallProcess', 'process_channel_addloc', sImported, [], ...
    'channelfile', {'', ''}, ...
    'usedefault',  'ICBM152: ASA 10-05 343', ...  % ICBM152: ASA 10-05 343
    'fixunits',    0, ...
    'vox2ras',     0, ...
    'mrifile',     {'', ''}, ...
    'fiducials',   []);