Can brainstorm interpolate bad channels?

Hello,

I am running a 64 channel cnt file and have about 8 bad channels that i would like to interpolate. I have looked on the site, google and the forum to not be able to find any info on an interpolation function on brainstorm. Could anyone please direct me to it or offer any advice otherwise?

Many thanks
Josh

Hi Josh,

There is indeed no easy way to re-interpolate bad channels in Brainstorm.
We will add this feature at some point, but it is not a priority for the current developments.

If you are very motivated, you can do it manually on your recordings: right-click on a data file > File > Export to Matlab.
Then replace the bad channels with a combination of the other adjacent good channels. The position of the channels are available in the channel file.
Then re-import your files back in the Brainstorm database (right-click on the FOLDER containing your input file > File > Import from Matlab).
If you can write some generic re-usable code, we can then integrated that as a process (a plug-in function), and add it to the Brainstorm distribution. That would be a fantastic contribution, but it is definitely a lot of work.

Can’t you do that with your acquisition software?

Cheers,
Francois

Dear Francois et al.,

Is there any update on this topic? I have some MEG+67EEG (Neuromag Triux) I would like to use as demo material. Unfortunately, there are quite a few (very) bad (poor impedance) channels, which I have marked as bad via the GUI (12 out of 67 channels bad).

I've attached the topographic plots of a Left median nerve stimulus @37 msec for MEG and EEG channels separately. As you can see, the ERF looks as one would expect. But the EEG looks like s__t :frowning: Am I doing something wrong, or missing a switch that'll magically make my data look better? The missing/bad channels are simply set to zero, which of course explains the patchy topography.

I do not believe interpolating raw data is an option for EEG, but for visualisation purposes it would be great. I can see mne-python uses a delaunay triangulation-based linear interpolator for this, which would be just fine. Please let me know if you think I can help, I'm not brave enough to dig into the code myself…

Best, Chris




Hi Chris,

I added and implicit re-interpolation of the bad channels for the 2D/3D topography.
When some channels are bad, first their values are interpolated from their neighbors (Shepard’s algorithm), then the full sensor array is interpolated on the 2D/3D surface used to represent the values.
The update is online, please update Brainstorm (menu Help > Update Brainstorm)

Let me know if this works for you.

Cheers,
Francois

Hi Francois,

(I forgot to reply) Thanks for the update, that’s a great improvement!

/Chris

Dear Francois,

If one wants to interpolate a specific bad channel (say ecog electrode), how one can get the interpolated time series for that channel in matlab (from the calculations in 2d/3d topography), to back import it then and incorporate it into the recording for further processing?
Second, where is the code snippet referring to the Shepard method (a reference may also help, since there are several Shepard method variants)?
Thank you,

Octavian

Dear Octavian,

There is currently no way to interpolate bad channels. It is not recommended to replace the bad channels before running any source estimation, as it does not add any information to the model.

The code for the Shepard’s weighting method is described in brainstorm3/toolbox/math/bst_shepards.m

Btw, I’ve been adding a lot of new tools for handling intra-cranial recordings (position and visualization of the electrodes). It will be posted in the next few days.

Cheers,
Francois

Thank you, Francois

I totally agree that interpolation should be used sparingly. When used, it usually involves 1-3- channels out of up to 190, in our case. One instance is when comparing baseline, interictal and ictal recordings (intrasubject), and having connectivity matrices or other matlab pipeline components (vector or matric ranks) set for a certain channel template, and trying not to change those (as artifact may contaminate only one of the 3 categories, and only partly any of them). Thus, for those limited sections, one may interpolate. So, if there is a way to export to matlab the interpolation used for 2d/3d graphic display of bad electrodes, please let me know.
Thanks for the ecog tools, I can’t wait to use them,

Octavian

Dear Octavian,

The functions used for the topography displays would not be very useful: they interpolate the values of the EEG electrodes on a surface with a lot more points (the scalp or a flat 2D surface).
But they all use the bst_shepards function. You can probably use this function directly.

I will add a process for doing it automatically at some point…

Francois

Hi Francois.
Thank you for all your good work on this area thus far.
I have since tried to run the interpolate bad electrodes on another 64 channel eeg and i get the following warning.
“001-2/2_ev_LDR_dc/data_block001_sin.mat
The following channels could not be interpolated from any good neighbor: FCZ T7 P7 P1 OZ O2
02-Jul-2015 14:09:35”

Do you have any advice on how to make the inerpolation work?

Thank you
Josh

Hi Josh,

In the options of the process, you can decide how large you want the neighborhood to be.
You just have to increase the value “Maximum distance between neighbours”.

Note that if you have too many bad channels, the interpolation does not always make sense…
Maybe you should just mark this trial as bad (right-click on it > Reject trial)

Francois