Process_import_channel not working

Hello,

During subject import, I call process_import_channel in order to upload the correct channel montage (without this step, the channel locations defaulted to after process_import_data_raw are off by a fairly large margin. I have EEG data collected using an EGI geodesic 128 channel montage. I have tried using the channel_GSN_128.mat file included in the brainstorm default files, as well as manually exporting the channel locations after correcting them for one subject (to create a .tsv file with the electrode locations). I don't get an error message, the import just appears to not work, and skips over this step, moving straight to the projection step below. Any insight into what I am doing wrong would be greatly appreciated!

    % Process: link to raw file
    sFilesRaw = bst_process('CallProcess', 'process_import_data_raw', [], [], ...
    'subjectname',    SubjectNames{iSubj}, ...
    'datafile',       {RawFiles{iSubj}, 'EEG-EEGLAB'}, ...
    'channelreplace', 0, ...
    'channelalign',   1, ...
    'evtmode',        'value');

    % Process: Add EEG positions
    bst_process('CallProcess', 'process_import_channel', sFilesRaw, [], ...
    'channelfile', {'emoryu_2018_tp1rs1_electrodes.tsv'}, ...
    'usedefault',  1, ...
    'channelalign',    1, ...
    'subjectname',     SubjectNames{iSubj});

    %Process: Project electrodes on scalp
    bst_process('CallProcess', 'process_channel_project', sFilesRaw, []);

The process you need is process_channel_addloc, this will allow you to add the locations to the EEG electrodes from the created .tsv file.

% Process: Add EEG positions
bst_process('CallProcess', 'process_channel_addloc', sFilesRaw, [], ...
    'channelfile', {'emoryu_2018_tp1rs1_electrodes.tsv', 'BIDS-SPACE-UNIT'}, ...
    'fixunits',    1, ...
    'vox2ras',     0);

Edit the 'BIDS-SPACE-UNIT' file of type to match the SPACE and UNIT used in the .tsv file.
E.g: 'BIDS-MNI-MM'

Spaces:

  • MNI: MNI space
  • SCANRAS: Subject space
  • ACPC: ACPC space
  • ALS: ALS/SCS/CTF space
  • CAPTRAK CapTrack space

Units:

  • MM: millimeters (default in the GUI)
  • CM: centimeters
  • M: meters

Thank you! process_channel_addloc worked.

I've encountered another odd issue. After making the above changes, process_channel_project is not running in my script (it's called right after I add the EEG electrode positions). A window pops up to indicate that the projection is being run, but the progress bar does not move forward, and when I look at the channel locations, the electrode positions are not changed. Weirdly, if I enter the exact same code into the command window in matlab, it runs fine.
Any ideas? I updated brainstorm a few days ago, so I should have the most recent version.

Is there any message in the Matlab Command Window?

No

Can you check the report viewer?

  1. File > Report viewer > Clear history
  2. Run your script
  3. File > Report viewer

No warnings. Seems like it should be working, but when I look at the channel locations after I run the script, it clearly hasn't worked. However, if I execute the same line of script in the command line, it works.

The above is a screen shot of the channel locations on the scalp after I have run my script.

That is strange. Could it be that the script and the command line version do not run on the same files?

I figured it out. I had a line resetting the template to fsAverage after I projected the channels. So, the original channel location import was perfectly aligned, which meant it didn't look like process_channel_project did anything, but then I reset the template, and that shifted the channels with regard to the template. When I ran the code in the command line, it was done after I reset the template, so it projected the channels back to the scalp.

Thanks for your help, and sorry to bother you over my mistake!

1 Like