ICA procedure in Brainstorm

Hi all,

I am currently migrating from EEGLAB to Brainstorm (that interface…), and have a couple of questions about how ICA works in Brainstorm.

In EEGLAB I would typically run ICA on the epoched data, with non-stereotyped artefacts manually rejected. My rationale is that I it doesn’t seem terribly constructive to generate components for when the participant is looking around the room during the rest period, and that I would prefer not to have a component for a single bizarre artefact (or temporally correlated artefact across most components, as tends to happen).

This is my (possibly quite limited) understanding of how I would accomplish the same result in Brainstorm:

  1. Mark non-stereotyped artefacts as BAD in the continuous file viewer
  2. Apply ICA to continuous data with epoch limits around events of interest
  3. Remove components that are clearly primarily artefactual

I assume that periods labelled BAD are not included in ICA, is this accurate? Are there any other problems with this approach?


Indeed, all the segments of recordings identified with an event that includes the tag “bad” will be ignored from the ICA analysis. The problem with removing blocks of recordings is that you create discontinuities in the data, that might lead to specific ICA components to explain the jumps. I think there is the same issue with epoched data, but maybe I’m wrong…
I am not familiar with the epoched approach of ICA (or with ICA in general…), follow the EEGLAB recommendations if you can. When I wrote this process, I was recommended to use continuous recordings rather than epoched ones.

This process is calling directly the EEGLAB function runica. You should be able to call this function in a similar way as what you were doing in EEGLAB, and hopefully obtain similar results.


1 Like

Thanks for your reply Francois. I think that EEGLAB is fine to run ICA on epoched data (e.g. see https://sccn.ucsd.edu/wiki/Makoto's_preprocessing_pipeline) and other discontinuous data. Although from memory EEGLAB has events that are inserted indicating a discontinuity, which I assume that Brainstorm does not support?

No, I am not aware of these markers.
Are they used for some purpose in the ICA analysis?

I’ve just done a bit of searching to jog my memory, I believe I was incorrect, the BOUNDARY event in EEGLAB is used to mitigate the impact of discontinuities on filtering.

According to this thread the discontinuity shouldn’t matter with sufficient data points, as time points are shuffled anyway. I think it must be almost always worse for the decomposition to include periods with extreme contamination.

I’ve routinely applied ICA to epoched data in EEGLAB, and it works well, as you can quickly scroll through and eliminate particularly poorly decomposed epochs (usually noisy) and run ICA again. Equivalent functionality would be even better in Brainstorm, with the faster interface. I don’t quite see how it would fit into the current workflow system though, so maybe not possible.

Thanks for the details and the reference.

To run the ICA decomposition based on segments of recordings around an event of interest, set the options “Event name” and “Event window” in the ICA options (input = continuous recordings, before epoching).
To use recordings that have already been imported: use the process2 tab, put all the epochs you want to use to compute the IC on the left, and the continuous recordings you want to clean on the right.

Thanks Francois, that’s great.

I notice that an option for fastica is commented out in process_ica. Is support for fastica planned?

Yes, it is on our todo list, in the middle of hundreds of other items…

If you are interested in contributing to the project, help is always welcome!

Hi Francois,

I want know a few details about ICA and epoching in Brainstorm. I'm done with the manual bad segment marking in the raw files. I want brainstorm to ignore those timesegments while doing ICA as they will affect the performance of ICA. As long as I understand from the statement below running ICA on the raw file will ignore the time segments marked with the event tag "BAD". Did I understand this correctly?

Indeed, all the segments of recordings identified with an event that includes the tag “bad” will be ignored from the ICA analysis.

This is correct.
What is marked with "BAD" events is excluded from the ICA computation.

If you want to double-check this and are familiar with the Matlab debugger: put a breakpoint at line 453 in process_ssp2.m, and check if the number of samples returned by LoadInputFile is what you expect.

In another thread about ICA and bad segments, you mentioned the below statements. I find these two statements to be a bit contradictory. Are you referring to epoched data in this?

For bad segments, it depends on the type of inputs:

  • If you compute the ICA components on epochs (imported recordings or continuous files around events of interest): the epochs including at least one event with the tag “bad” are excluded
  • If you run the ICA analysis on continuous recordings, the bad segments are not excluded because we want to keep the signal continuity.

ICA automatically ignore bad segments and channels?.

ICA automatically ignore bad segments and channels?.

These are posts from 2017. There was indeed a time where the bad segments were not removed from the ICA computation. Now they are.
I added a note in the description of the ICA options to confirm this:

Time window: Time segment where the artifact is present.
Note that all the BAD segments are removed from the selected data before executing the ICA algorithm, causing some discontinuities in the signals.

Oh Okay! Thanks a lot for the explanation. I was about to use the workaround you mentioned. This saved some time for me.