Electrode display/control

Dear Francois,

  1. I need to display an ecog electrode set (125) and contact labels, via Display Sensors, EEG cortex in the GUI. I can do this well, however if I want to change the size of the contacts displayed from 8 mm (default) to 6 mm, I get the following error:

Operands to the || and && operators must be convertible to logical scalar values.
Error in figure_3d>SetElectrodesConfig (line 2649)
if ~isnan(str2double(res{3})) && ~isempty(str2double(res{3})) && (str2double(res{3}) >= 0)
Error in figure_3d>@(h,ev)SetElectrodesConfig(hFig) (line 1459)
gui_component(‘MenuItem’, jMenuChannels, [], ‘Configure display’, IconLoader.ICON_CHANNEL, [],
@(h,ev)SetElectrodesConfig(hFig), []);

The electrodes displayed look OK on the cortex. However, if I want to get this file in process, it does not load (as opposed to the corresponding time series), and if I want to check MR registration, it gets stuck with ‘Loading sensors descriptions’ in ‘Importing sensors’ .
2. I can easily export this file in matlab (v2013b) via GUI, but I am writing a script and I want to call in it the sensors/labels display on the cortex for a certain subject/condition (known file name/location) at a certain point. How can I get this done?
3. Is there an easy way to change the label color to differ from the actual electrode contact for better contrast?

Thank you,


Dear Octavian,

  1. The line pointed by your error message (line 2649 in figure_3d.m) is part of the configuration menu for depth electrodes (sensor type SEEG). I don’t know why this line would executed for ECOG contacts.
    You say that the default size is 8mm, but the current default is 4mm for ECOG contacts.
    Are you running the last version of Brainstorm (this code changed a lot in the past few weeks)?
    Last comment: in the channel file you sent, the electrodes are classified as EEG, you should change their type to ECOG (right-click > Edit channel file).

  2. To open a new figure displaying the ECOG contacts, you can use:
    hFig = view_surface(SurfaceFile, SurfAlpha, [], ‘NewFigure’); % SurfAlpha = .2
    [hFig, iDS, iFig] = view_channels(ChannelFile, ‘ECOG’, 1, 1, hFig, is3DElectrodes);

  3. I added this to my todo list. In the meantime, you can change the color of the text with:
    hText = findobj(hFig, ‘Type’, ‘text’);
    set(hText, ‘Color’, [1 0 0]);

We will try later this year to prepare a tutorial for ECOG/SEEG recordings, with the help of the epilepsy clinic in Freiburg. Hopefully we’ll get these functions more stables over the next few months.


Dear Francois,

Thank you for your assist and prompt reply, as always.

I updated Brainstorm (BST), changed electrode type to ‘ECOG’, the new electrode size defaults were changed to 4 mm, and I was able to change the size further without error. Problem solved.

Here are related questions:

  1. What label should one use for the ‘regular’ depth electrodes? These differ conceptually from SEEG in that they are not targeted stereotactically, and are usually part of ieeg electrode configurations that include subdural (ECOG) electrodes (usually these studies are a mixture of grid, strip and depth electrodes). I assume that for BST purposes, these depths are still SEEG, but please confirm.

  2. I work on an ECOG study that would be served if I chose one channel file (and one time series fie) per condition, not subject. When selecting a new subject, based on the GUI prompts, one can choose between one channel file per subject (‘EEG’) or one file per condition (‘MEG’). I assume these are semantics driven by the needs of the majority of studies, but I want to make sure that if I use one channel file per condition, the BST code does not ‘interpret’ or modify any routine as if the study was a MEG study. I do not know too much about MEG, so I risk to ask for clarifications.

Thank you,


Dear Octavian,

  1. The classification ECOG/SEEG modifies two things: the display of the electrodes and the forward modeling.
  • SEEG: the contacts with the same name are aligned on a depth electrode, which is displayed in grey; for the forward modeling, these contacts are supposed to record LFPs (inserted in the brain tissues), there position is not altered in the OpenMEEG modeling
  • ECOG: can be subdural strips or grids, in the case of strips the contacts are connected with a thin blue line; for the forward modeling, these contacts are supposed to be in contact with the cortex envelope, they are projected on the inner skull surface by OpenMEEG

You can have a mix of ECOG and SEEG contacts for the same recordings. All the ECoG contacts (strips or grids) should be classified as “ECOG” except for the inter-hemispheric ones. The problem is that ECOG electrodes are always projected on the skull by OpenMEEG, so it wouldn’t work for any contact that is not closely inserted between the cortex and the skull. Therefore interhemispheric ECOG strips should be classified as SEEG, even if it causes the display to be inaccurate… We will have to work on a better way to handle this case…

  1. No problem for using the option “Yes, use one channel file per condition/run (MEG)” for an EEG study. The indications (MEG) and (EEG) are here just to indicate the most standard approach for each modality. This option is very confusing for many users, having this strict guideline helps a lot.
    It will not change anything in your analysis but the folders where your channel files are saved.


Dear Francois,

I have a question related to the topic, I was hoping you could help me with:

After importing intracranial electrode position to brainstorm (see a recent bug thread related to that issue), I noticed the different electrodes are not divided to groups by their original clusters. This is well documented in the in_channel_cartool_els.m file, which says:
“the division in clusters is not kepo in the output, because it is not useful in the smac algorithms”.

Could you please explain this point?
I would have wanted my different clusters to be divided into their cluster groups, using:

ChannelMat.Channel(iChan).Group = <ClusterNama>;

Is there a reason the code does not support this option at this time point?

Thank you as always!


The reason for which it was not supported before: this function you edited was written in 2006…

The new version I posted keeps the separation between groups.
Let me know if there are other adaptations to make.


Dear Francois,
This makes perfect sense now :slight_smile:

I updated brainstorm, and the seperation now works perfectly!
Two small problems I encountered:

  1. It now seems that the display function is having a hard time displaying a combined set of ECoG and SEEG electrodes. When trying to display the, only the ECoG electrodes are displayed. When opening the right click > Channels menu, no groups appear in the menu, and so it is not possible to choose which channels to display.

  2. If only SEEG electrodes exist, it is possible to choose which electrodes group to display. However, when you choose to not display a certain group, the line connecting those electrodes indeed disappears, however the contacts themselves still appear in the figure (yet the labels correctly appear only over those electrodes that you choose to display).

As always, your kind, quick and effective help is very much appreciated!


Hi Roey,

We haven’t published any tutorial yet on the processing of intra-cranial recordings. We will probably have some formal documentation by the fall.
Those tools are still in development, we are in a debugging phase at the present time, in collaboration with the Cleveland Clinic and the epilepsy clinic in Freiburg.

The SEEG and ECOG types of sensors are displayed and processed separately. They are handled in specific ways for the 3D rendering, the forward modeling and the inverse modeling. Due to the modeling in the OpenMEEM BEM model, the ECOG electrodes are always reprojected on the inner skull surface. This might lead to severe misregistration and misinterpretation of the source maps. We haven’t found any solution to this problem yet. The only option so far for avoid this is to classify the interhemispheric and ventral ECOG strips as SEEG.
If you want to have them all on the same views, you need to set them to the same modality…

To edit your channel file: right-click on it > Edit channel file. You can edit the Type and Group of each electrodes individually, or modify large groups at the same time (select the channels to edit, right-click > Set type/group).

Can you send me screen captures of what you consider being display bugs?


Dear Francois,

Thanks for clarifying this. I am looking forward for the tutorials regarding the new methods implemented in brainstorm!
I guess the so-called display bug has to do with rendering issues. In the attached images you can see what I meant regarding the electrodes groups you choose not to display. Each file consists of two screen shots, with or without anelectrodes group chosen not to be displayed, in the two rendering options for OpenGL.


I see… These tools are still in a prototyping phase.
The display will get better at some point, it takes time to find rendering solutions that work in the same way for all the versions of Matlab and all the operating systems.
Let us know if you detect other bugs, related with the interface or the manipulation of the SEEG/ECOG recordings.


I will!
Thank, Francois,

FYI: We improved significantly the tools available in Brainstorm for processing and visualizing SEEG and ECOG data, including new options for volume coregistration. They are now documented in a new tutorial:

Thank you for the update, Francois!