Channelreplace, channelalign

To whom it may concern,

Could someone explain to me what “channelreplace” and “channelalign” do in the following code?

bst_process(‘CallProcess’, ‘process_import_data_epoch’, [], [], …
‘subjectname’, SubjectNames{i}, …
‘condition’, ‘’, …
‘datafile’, {{ERP{i}}, ‘EEG-ERPLAB’}, …
‘iepochs’, [], …
‘eventtypes’, ‘’, …
‘createcond’, 0, …
‘channelreplace’, 1, …
‘channelalign’, 1, …
‘usectfcomp’, 1, …
‘usessp’, 1, …
‘freq’, [], …
‘baseline’, []);

Along this vein, is there a reference table somewhere to determine what options a function has, the possible values of those options, and their meaning? The “help” function in Matlab gives no info at all.

Thanks,

HY

Hi HY,

For most processes, you can use the “Online tutorial” button from the pipeline editor to open up the appropriate documentation page. When that fails, you can also open up the process file (here process_import_data_epoch.m) and have a look at the GetDescription() function, which describes most parameters.

The parameters you’re refering to are a bit more advanced importing options that perhaps could be better documented. They are explained deep in a core file of Brainstorm:

I hope this helps,
Martin

Thanks for the fast reply. Those two lines of comment in the code are exactly what I need!

I do have a follow-up question though, if I’m using default anatomy and channel files (e.g. Biosemi 64 10-10), and importing epoch data from EEGLAB, no matter which option I choose for channelalign, it always seems to mess up the channel locations, i.e., putting the electrodes into the head. I suspect this is caused by EEGLAB using a different coordinate system. Is there a way to fix this?

Thanks,

HY

Biosemi 64 10-10 is available in our default caps, so I would use the Set Channel File process (Import -> Import recordings) to it. E.g. if your default anatomy is ICBM152, set it to “ICBM152: BioSemi 64 10-10”). The EEGLAB importer should in theory convert the coordinates though.

1 Like

Since I’m using default anatomy and default channel locations, my understanding is that I only need to calculate the headmodel once, is it correct? Since I have quite a lot of subjects, is there a way to script this process, i.e., calculating the headmodel of subject 1 and copy the results for all other subjects?

Yes! This is a feature I added very recently so make sure you are up to date. You can right click on the head model and copy it to other folders/subjects. Refer to db_set_headmodel() if you want to do it via a script.

1 Like

How did you create this script?
In general, you should have each option in the call to bst_process('CallProcess',...) corresponding to one option in the pipeline editor. Therefore there should be no need of any extra documentation (beyond what is explained in the corresponding tutorial pointed at when you click on the "Online tutorial" button).
If you use an recent version of Brainstorm to generate a script corresponding to process "Import > Import recordings > Import MEG/EEG: Existing epochs", you should obtain something like this:

% Process: Import MEG/EEG: Existing epochs
sFiles = bst_process('CallProcess', 'process_import_data_epoch', sFiles, [], ...
    'subjectname', SubjectNames{1}, ...
    'condition',   '', ...
    'iepochs',     [], ...
    'eventtypes',  '', ...
    'createcond',  0, ...
    'usectfcomp',  1, ...
    'usessp',      1, ...
    'freq',        [], ...
    'baseline',    []);