Skip to content

ICA files

An ICA is a file. Computing it writes the file, and loading it brings the components back in AnyWave.

Load an ICA

AnyWave does not load an ICA by itself when it opens a recording: load it each time you need it. Open the recording, then use one of:

  • ICA > Load ICA components, or the ICA button of the toolbar;
  • Load Components... in the ICA Components window.

Choose the .mat file in the window Add ICA components. It opens in the folder of the data file (in the ICA folder of the database for a recording of a BIDS database).

The components appear in the view of the components and in the ICA Components window. Loading an ICA of a type that is already loaded (a second EEG ICA) replaces the first one, and its rejections are forgotten. The ICA of another type (an MEG ICA after an EEG one) is added to it.

AnyWave refuses an ICA that does not fit the recording, and says why:

  • the channels used to compute it are not in the recording (their names must be the same);
  • the matrices do not have the dimensions that match the channels.

The filters of an ICA

The components are computed from signals filtered in a given way, and they only make sense for signals filtered the same way. So when it loads an ICA, AnyWave applies its filters to the signals of that type (the EEG channels for an EEG ICA): the high pass, the low pass and the notch the ICA was computed with. Look at the Filters after loading an ICA: they are the ones of the file name (hp-1_lp-70_notch-0 for 1 and 70 Hz, and no notch).

The maps

The maps need to know where the sensors are. AnyWave looks for a layout that matches the names of the channels. When there is none for the electrodes of the ICA (names that are not standard, for instance), the components are shown without their maps.

The .mat file

A .mat file written by AnyWave is a MATLAB file (version 7.3). If you compute your own ICA, for instance in MATLAB, write a file of the same form and AnyWave loads it as it does its own.

Variable Type Content Needed to load
modality string EEG, MEG, SEEG or EMG: the type of the channels. yes
labels cell array of strings The names of the channels used to compute the ICA, in the order of the rows of mixing and of the columns of unmixing. yes
unmixing matrix, components x channels Multiplied by the signals, it gives the time course of the components. yes
mixing matrix, channels x components Each column is the map of a component. Used to draw the maps and to rebuild the signals when you reject components. yes
hpf, lpf number The high pass and the low pass used, in Hz, or 0. yes
notch number The notch filter used, in Hz, or 0. no
sr number The sampling rate, in Hz. no
layout2D string The name of the layout found for the channels when the ICA was computed, or n/a. no

Let m be the number of channels and ic the number of components.

  • The names in labels must be names of channels of the data file (or bipolar names such as A1-A2 made of two channels of the file). AnyWave unmixes those channels of the recording to get the components, so the names must match.
  • unmixing is ic x m and mixing is m x ic: the k-th column of mixing is the map of the k-th component, and the k-th row of unmixing produces its time course.

The .json file

Next to the .mat file, AnyWave writes a .json summary of the computation: the algorithm, the type and the names of the channels, the number of components, the sampling rate, the filters, the markers that were used or skipped, the segments of data that were used and the date. It is meant to be read by you, or by a script: AnyWave does not need it to load the ICA.

ICA in a BIDS database

In a BIDS database, the result of an ICA is stored in the derivatives of the database, and appears in the BIDS panel as a child of the recording it was computed on.

  • Double-click the ICA in the panel, or right-click it and choose Load components, to load it. AnyWave opens the recording first when it is not open.
  • Show properties (right-click) shows the summary of the computation.

Export the components

To get the time courses of the components as a file, use the command line: ICA2VHDR writes them to a BrainVision file, and the option --save_comp_traces of the ICA command line does the same at the end of a computation.