Average trials after source-localization


I am contacting you as I am trying to see the difference in localization between:
(1) Importing trials in the database, averaging trials, localizing the average trial and
(2) Localizing the entire recording, and then averaging trials after localization.

However, I can't find a way to extract the trials once the localization is done and my data is on the cortical surface.
Do you have any suggestions for that?

Thanks a lot,

Interestingly, I just realized I did a process that can do almost that 6 years ago: bst-users/processes/process_windows_average/process_windows_average_time.m at master · brainstorm-tools/bst-users · GitHub

With few changes, it working but much less flexible than what we can do with data at the sensor level :slight_smile:

Do you mean, source localization was done on the raw data?
If this is the case, the "sources" are not full sources but a kernel in disguise of full sources.

The to use this kernel on trials, you should:

  1. Import that raw data, to create the trials
  2. Close Brainstorm
  3. In the protocol directory, copy the "kernel" file from the raw folder to the imported
  4. Start Brainstorm
  5. Reload Protocol
  6. In the imported folder, export to matlab the kernel, clear its field DataFile, import it back
  7. Reload Protocol

So what i am doing is importing the entire recording in the database (here 1 000s), then use wMEM to localize the entire recording :

What I would like to do is to segment that recording into trials and average them based on the events.

here is what it looks like in the database: