Right click channel file -> Add EEG Positions

Hello all,

What is the equivalent code for this GUI operation?
I can't seem to find it.

Thanks.

-Tom.

The below code does not appear to do anything:

% Script generated by Brainstorm (28-Feb-2023)

% Input files
sFiles = {...
    'T04_04/250_EEGlab_sujet04_0001/data_block001.mat'};
RawFiles = {...
    '/home/thomasha/windows-share/thomasha/brainstorm_db_folders/yeo_54_regions/brainstorm_db/Protocol01/data/T04_04/250_EEGlab_sujet04_0001/channel.mat', ...
    '/home/thomasha/windows-share/thomasha/brainstorm_db_folders/yeo_54_regions/brainstorm_db/Protocol01/anat/T04_04/subjectimage_MRI.mat'};

% Start a new report
bst_report('Start', sFiles);

% Process: Add EEG positions
sFiles = bst_process('CallProcess', 'process_channel_addloc', sFiles, [], ...
    'channelfile', {RawFiles{1}, 'BST'}, ...
    'usedefault',  'ICBM152: BrainProducts EasyCap 64', ...  % ICBM152: BrainProducts EasyCap 64
    'fixunits',    1, ...
    'vox2ras',     1, ...
    'mrifile',     {RawFiles{2}, 'BST'}, ...
    'fiducials',   []);

% Save and display report
ReportFile = bst_report('Save', sFiles);
bst_report('Open', ReportFile);
% bst_report('Export', ReportFile, ExportDir);
% bst_report('Email', ReportFile, username, to, subject, isFullReport);

The script you generated would be a valid solution for copying the EEG positions between two different folders within the same subject. But it needs to be fixed:

  • the options "fixunits" should be set to 0, as there is not expected error in units, since the data is already available in Brainstorm in the correct format
  • the option "vox2ras" and "mrifile" should be disabled (respectively 0 and []), as you are not reading "WORLD" coordinates, everything is already in SCS. I think these are ignored anyway when reading from a channel.mat already in the database, but I'd recommend to remove this extra input, at least for the readability of your script.
  • the main problem in your script is that the input and target are the same: RawFiles{1} points at the channel file that is already used for the input file in sFiles: subject T04_04, folder 250_EEGlab_sujet04_0001. You're copying the information from a file to itself, so as expected it is not doing anything.

If you are expecting use the template 'ICBM152: BrainProducts EasyCap 64' for the selected input file, your script should look like this instead:

% Input files
sFiles = {...
    'T04_04/250_EEGlab_sujet04_0001/data_block001.mat'};

% Process: Add EEG positions
sFiles = bst_process('CallProcess', 'process_channel_addloc', sFiles, [], ...
    'channelfile', [], ...
    'usedefault',  'ICBM152: BrainProducts EasyCap 64', ...  % ICBM152: BrainProducts EasyCap 64
    'fixunits',    0, ...
    'vox2ras',     0, ...
    'mrifile',     [], ...
    'fiducials',   []);