Channel location SEEG data

Hello!
I am trying to import channel location for SEEG data, but I get the "No channel matching the loaded cap" error, even with different channel location format.
The native format of the SEEG data is Nihon Khoden (.EEG and .21E). I linked the recordings with "> Review raw file", but when I try to manually change the contacts location using "> Edit channel file" I can only see the "Name, Type, Group, Comment and Weight" columns and not the "Location" column. I guess there is a problem with the linking of the raw data file (.EEg and .21E).

Do you have any suggestion on what could be the problem?
Please find the EEG file and the channel location at this link:
https://www.dropbox.com/scl/fo/9nzdqjyhe8ejqvuf8tn4s/h?dl=0&rlkey=lhv23m0ndq4l6ph84lep63gix

Thank you very much
Francesca

To add electrode positions to an existing channel file, you need to use the menu "Add EEG positions":
https://neuroimage.usc.edu/brainstorm/Tutorials/Epilepsy#Prepare_the_channel_file
The channels are matched by name, the labels must match exactly in the NK recordings and in the text file with the 3D locations.

The complicated part is to get a correct interpretation of the coordinate system.
If you have anatomical landmarks NAS/LPA/RPA in the positions file, this would help a lot.
Otherwise, the coordinates could be either in MNI coordinates, or in scanner-based coordinates (T1 MRI "World" coordinates).
Otherwise, you would need to try and align them manually.
https://neuroimage.usc.edu/brainstorm/CoordinateSystems

Thank you for your prompt reply.

I’ve tried to import the channel location with the "Add EEG positions", but I always get the "No channel matching the loaded cap" error. I've tried several format for the file with the 3D locations, but I couldn't find a solution.
Also, the labels in the text file with the 3D locations match exactly in the NK recordings and the coordinates are in MNI coordinates (normalized contacts’ coordinates were estimated by performing a non-linear registration between the subject’s skull stripped MRI and the skull-stripped MNI152 template).

Given that I couldn't import the channel location with the "Add EEG position", I tried to manually change the contacts location using "> Edit channel file", but when I try to do that, I can only see the "Name, Type, Group, Comment and Weight" columns and not the "Location" column. So my best guess is that there must be a problem with the linking of the raw data file (.EEg and .21E).

Do you have any other suggestion on what should I do next to find a solution?
https://www.dropbox.com/scl/fo/9nzdqjyhe8ejqvuf8tn4s/h?dl=0&rlkey=lhv23m0ndq4l6ph84lep63gix

The problem is not coming from the recordings, it is your Excel file that is formatted in a very weird way. The names of the channels include many non-breaking spaces (ASCII #160) at the end of each contact label. Because of these extra unexpected characters, the names do not match with the channel name in the SEEG recordings. You need to remove them manually, or find a way to export them in a cleaner way.

  1. In Excel, export to file to "Text (tab-delimited)"
  2. Rename the file with the extension .tsv instead of the default .txt
  3. With a text editor that shows the special characters (eg. Notepad++), delete all the "special space" characters after the labels (you can use the "Replace" feature to remove all of them at once: copy-paste one of these characters, and replace them with an empty string)
  4. In Brainstorm: Edit the channel file, set the type as "SEEG" for all the SEEG channels (select them all, right-click)
  5. Add EEG positions > File format: "EEG: BIDS electrodes.tsv, MNI space mm"

The edited channel file:
Coordinates_MNI.zip (1.6 KB)

The result on the MNI brain:
image

Thank you very much for your help on such a trivial matter.

I was also wandering if it is possible to display the electrodes from multiple subjects on the MNI brain at the same time.
Is there a way to do that? Would it be possible for example to load a .mat file with the coordinates from all the contacts from all the electrodes from all the patients?

Thank you very much for your kind help.
Francesca

I was also wandering if it is possible to display the electrodes from multiple subjects on the MNI brain at the same time.

I've already added a menu to project the electrodes in subject space on the MNI brain:
image

But I haven't coded yet the display of multiple channel files on the same figure for SEEG/ECOG.
I was thinking of maybe displaying each subject with a different colors, all the electrodes of one subject with the same color. Either as simple dots, or with the "realistic" view (probes+contacts).

Would you have examples of the types of displays (and interactivity elements) you'd like to get when you select multiple channel files in MNI space and then right-click>Display?
image

I was thinking of maybe displaying each subject with a different colors, all the electrodes of one subject with the same color. Either as simple dots, or with the "realistic" view (probes+contacts).

This is exactly what I would like to obtain, but I am currently failing to do. How do I display multiple channel files in the same figure? Is there a specific tutorial you suggest might be useful?

Would you have examples of the types of displays (and interactivity elements) you'd like to get when you select multiple channel files in MNI space and then right-click>Display?

When I try to do this I only get the electrodes from one patient (the last one selected). I guess I am missing something very basic, but I can't wrap my head around it.

Oh! I just realized I probably misinterpreted the whole thing.

But I haven't coded yet the display of multiple channel files on the same figure for SEEG/ECOG.
I was thinking of maybe displaying each subject with a different colors, all the electrodes of one subject with the same color. Either as simple dots, or with the "realistic" view (probes+contacts).

Does that mean it is not possible to display multiple channel files on the same figure yet, but is going to be coded at one point?

Would you have examples of the types of displays (and interactivity elements) you'd like to get when you select multiple channel files in MNI space and then right-click>Display?

And you asking me for suggestions?

If that's the case, displaying each subject with a different color would be a great feature.
I was thinking though that sometimes, in group studies, it would be useful to group the contacts by color, regardless of probe/subject of origin. For example if you want to distinguish the contacts covering a specific anatomical area or the contacts behaving in certain way (regardless of probe/subject of origin).

Exactly. I will work on this probably in January.

I was thinking though that sometimes, in group studies, it would be useful to group the contacts by color, regardless of probe/subject of origin

One color per shaft?
For example: all the contacts of electrode "A" in green (A1,A2,..,An)

@as_dub

Hi Francois, hope your holidays went well. Since you said you would work on this in January I thought best not to bother you until now.

What I am after is the ability not only to display multiple channel files from different subjects on the same figure, but also to color-code each contact manually, so as to select, for each experiment, the contacts that probe a given area, regardless of subject and/or shaft of origin.

Just a bit of background that might explain my request, which might otherwise appear useless: we are conducting physiological - not clinical - studies with SEEG recordings. Electrodes implantation is different for every subject (i.e., different number of electrodes and positions). Different contacts from different patients may, however, interest the same cytoarchitectonic area. For instance, let’s say I am interested in how primary visual cortex V1 responds to a visual task, and let’s also say I have SEEG data from 4 patients, with variable coverage of V1, who underwent a visual task during SEEG monitoring: it would be extremely useful to display all the contacts in V1 from the 4 patients, regardless of the subject or shaft of origin.

Thank you so much for your help

Hi Francesca,

No updates yet on this topic, but we'll be actively working on SEEG group analysis tools in the near future.

We're planning on starting a new tutorial dedicated to this topic, this will help us design and document new tools. For the dataset to be used, we have two public datasets as possible candidates:

If you have other suggestions, please let us now (the dataset must be easily accessible for Brainstorm users, include MRI+CT+SEEG+contact positions, and include cognitive tasks).

The first step of preparation was a change of the Clusters feature (see this post: Issues with using the Cluster function to generate GFP). Clusters are now saved in the datasets, and will be used to for creating groups of contacts by ROI (e.g. your V1 example), allowing to gather easily information for all the contacts in a given subject, or across subjects: contact positions, but also time series.

I'll keep you posted when I get to the group visualization of sensors.
In the meantime, please posting all your suggestions (including examples of figures that you liked from published articles)

Cheers
Francois

Hi @frtalami ! Just in case it can help, I developed a tool called MIA which actually allows the visualization of multipatient SEEG data. It allows the exploration of the timecourses of several patients/electrodes per region of interest. In addition it computes indices of similarity across time courses.
(See an example snapshot below).

MIA is available as a Brainstorm plugin. Do not hesitate to get in touch if you wish to use and have any question.
Best,

Anne-Sophie

2 Likes

Hi @as_dub!
Thank you so much for your suggestion. I have in fact been using MIA a lot and it has been very helpful. I let you know if I have any question or need help. Thank you so much for your availability.

Best
Francesca

Hi Francois,

Thank you so much. I will put together a list of suggestions and examples

In the meantime I have been having new issues with "add EEG position". I am sorry to bother you again with this, but for some of the dataset I am analysing I get this error when I try to "Add EEG position":

Error using cellismemberlegacy (line 26)
Invalid input. Valid flags are 'rows', 'legacy'.

Error in cell/ismember (line 91)
lia = cellismemberlegacy(a,b,flag1);

Error in channel_add_loc (line 148)
elseif ismember(LocChannelMat.Channel(idef).Type,
{'SEEG','ECOG'})

Error in tree_callbacks>@(h,ev)channel_add_loc(iAllStudies,,1) (line 2835)
gui_component('MenuItem', jMenu, , 'Import from file',
IconLoader.ICON_CHANNEL, , @(h,ev)channel_add_loc(iAllStudies, ,
1));

Do you have any suggestion about what this might be?

Thank you
Francesc

Bug fixed here: https://github.com/brainstorm-tools/brainstorm3/commit/ca3f7021f74d5785ef7862bccd5e48c352d2924a

The two sensors "S'3" and "sP3" were considered as the same match... I added a test to run first a case-sensitive search first.
Please update Brainstorm and try again.

Hi @as_dub,
as promised I need some help with MIA.
I have a big dataset of 1288 intracranial contacts. Everything works fine with the sanity check, but when I try to do the TF decomposition I get this error:
Reference to non-existent field 'F'.

Error in mia_s4_compute_tf_bandwise (line 94)
F = data.F ;

Error in mia_extract_frequency>calculate_Callback (line 270)
handles.sFiles = mia_s4_compute_tf_bandwise(OPTIONS);

Error in gui_mainfcn (line 95)
feval(varargin{:});

Error in mia_extract_frequency (line 41)
gui_mainfcn(gui_State, varargin{:});

Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)mia_extract_frequency('calculate_Callback',hObject,eventdata,guidata(hObject))
Error using uiwait (line 81)
Error while evaluating UIControl Callback.

What am I doing wrong? Can you help?

Thanks
Francesca

Hi Francesca!

I am very happy to help.

This looks like MIA is not finding any imported data. Are you using mia from the Brainstorm plugin?
(i.e. you export data from Brainstorm to MIA using the 'Export data to MIA database' process)

Would you please describe what kind of data you are exporting? (several patient? several trials? what format?)

Best,
AnneSo

I am using MIA from the Brainstorm plugin.
I created a "fake subject" putting together the SEEG electrodes from 20 patients. I have a total of 1288 SEEG contacts, I segmented the data in brainstorm (100 trials [-200;500ms] around the events) and then used the brainstorm process "Export data to MIA database". I am not sure it is a valuable info, but please note that the original .mat file I imported in brainstorm exceeded 2Gb of data storage, so I used the -7.3 MAT-file.

The sanity check looks good to me

Thank you very much
Francesca

Hi Francesca,

I am surprised that you put together all patients in a "fake subject" because MIA is used to combine the data from multiple patients. I am happy to meet to discuss this.

However, this does not explain the error you get when trying to perform the TF decomposition. I just made a modification to the Brainstorm plugin function to try to avoid this error. Would you please update the plugin and try again?

Best,
AnneSo