Match known EEG locations to the MRI image

Hi,

I have the precise EEG electrode locations on the scalp from MRI images and I'd like to use these coordinates in brainstorm for source localization on the subjects cortex. The problem though is that when I input the coordinates along with the NAS, LPA and RPA through a text file. The electrodes are continuously positioned off-center from the scalp for all the subjects. I've attached an image of this. Is there any way that I could produce more accurate results without having to manually position them? Also, is there any way that I can add electrode coordinates without having them depend on the NAS, LPA and RPA as we already know exactly where they are positioned on the scalp?

We are also wondering what the code is that does this so that we could possibly modify it to suit our needs.

Thank you very much!
Greg


Hi Greg,

To align the 3D information coming from two different environments (MRI and digitizer), you always need to compute a transformation (rotation+translation) from one to the other.
One of the easiest way to compute this transformation is to pick three points, get their coordinates in the two environments, and compute a transformation from this.
In Brainstorm, we use the three landmards NAS/LPA/RPA to do this coregistration.
These transformations are computed by the functions cs_compute.m, and applied to other points with cs_convert.m
http://neuroimage.usc.edu/brainstorm/CoordinateSystems#Converting_between_coordinate_systems

If your 3 landmarks are defined in the two spaces (MRI and EEG text file), then you should not have any registration problem.
If it’s not done automatically, there is something wrong with your coordinates, or with the syntax in your EEG file.
You can post the file containing you EEG coordinates on this forum and I’ll tell you if there is anything wrong with it.

Otherwise, you can use a fitting procedure (this menu “Refine using head points”). This is not recommended if you have less than 100 head points.
It is done in function bst_meshfit.m (called in channel_align_auto.m)

Cheers,
Francois

There is a missing part in my response:

If you already have the coordinates coordinates in MRI coordinates, you can use the cs_convert function to convert the positions from ‘mri’ to ‘scs’.
Then save a text file with these SCS positions (or edit directly the channel file structure), and do not include the NAS/LPA/RPA (so that Brainstorm doesn’t transform them).
Note that everything in Brainstorm is in international units (meters). All your coordinates should be < 1.

This procedure should give exactly the same result as exporting the coordinates with the NAS/LPA/RPA points in it, it’s just more complicated (I think…)

Thank you for the excellent explanation Francois! I managed to solve it. My coordinates were all correct except the NAS/LPA/RPA were defined by the wrong image space, so the proper transformation was not being applied.

Hi Francois,

I am running into the same problem as gmierz but a little worse, after importing my electrode positions from an EEGLAB exported .set file, the electrodes and headpoints are much smaller and misplaced from the MRI head. I am attaching an image of this. From inspecting my channel file, I see that I do not have NAS, LPA, and RPA defined, I've also attached the exported channel file from brainstorm. I'm not exactly sure how to define the 3 points as this data was shared with my from a collaborator. I tried playing around with the cs_convert command to see if that could do the trick but that didn't solve my problem either. So I'm wondering what I can do to fix the electrode positions?

Thank you for your help!
Xihe

channel.pos (9.9 KB)

Hello,

The positions of the electrodes are not saved in the format Brainstorm expects.
Can you send me an example .set file for which you have this issue? Upload it somewhere and send me the link.
Maybe I’ll find a solution for reading information from this file in a better way.

Otherwise, you can edit the sensor positions manually: right-click on the channel file > MRI registration > Edit. With a combination of resize/translation/rotation operations, I managed something decent.

If these are standard electrode positions (as opposed to digitized on the head of the subject with a Polhemus), you can probably find and equilvalent set of positions for your cap in Brainstorm (right-click on the channel file > Add EEG positions > ICBM152 > …)

Cheers,
Francois

Thanks for the file.
I fixed some issues with the reading of the electrode positions from the EEGLAB .set files.
The electrodes won’t align perfectly, because we don’t have access to the positions of the NAS/LPA/RPA points in this file, and also because this appears to be a set of standard 3D positions.

If you update Brainstorm and try again, you will obtain something that looks already a bit better, but that needs to be refined manually (right-click on the channel file > MRI registration > Edit)

Otherwise, you can use the default positions available in Brainstorm. These are aligned on the ICBM152 template, and would also need so manual alignment on the individual anatomy of your subject.