SEEG electrodes and subject's anatomy are not alligned

Hi,

I imported subject’s anatomy (MRI surfaces and phial) and SEEG electrodes file from FreeSurfer folders. When I visualize them, they seem not to be alligned in the same space (see Figure). What kind of trasformation is Brainstorm applying? What I’ve to do to allign them in the same space?

Thanks,
Bianca

Hi Bianca,

I haven’t been working yet on conversion systems for the intra-cranial electrode positions.
I will ask our collaborators who use these tools to describe what is the best way to have electrode positions co-registered with the MRI.

You said you have your got your electrodes positions from the FreeSurfer folder?
In what format are they stored?
Could you send me an example so I can add an easy way to read them? The full FreeSurfer folder could help.
(zip the entire folder, upload it somewhere, then click on my username on this forum to send me the link in a separate email).

Thanks,
Francois

Hello Bianca,

In my invasive work, the electrode information comes from programs separate from the anatomy files. I either import the anatomy in Freesurfer or Brainsuite formats, using Brainstorm’s automatic routines to bring in both the MRI and all of the surfaces in one common coordinate system.

The electrode data, however, come from either an in-house program or the Curry program, as 3-D coordinates hand-selected by a skilled technician. The in-house programs does not have surface renderings nor convenient formats, and we prefer the renderings of Brainsuite and Freesurfer over those of Curry. So we have the need to re-align these electrode coordinates from one coordinate system into the coordinate system Brainstorm assigned to the imports.

To register these coordinates into the Brainstorm anatomy, I extract from the electrode program hundreds or thousands of scalp rendering points, in the same coordinate system as the electrodes. (In Curry, I retrieve their surface rendering of the MRI and downselect 5,000 surface points.) I then create a channel structure identical to Brainstorm’s, but I list the scalp points as additional “head points”.

When I import this channel structure into Brainstorm, it then is easy to use the Brainstorm alignment programs (either “Digitized Head Points” or “MRI Registration”) to align the scalp points of the electrode program with the scalp surface of the anatomy, using a combination of Brainstorm’s manual and automated routines. The electrode information is then naturally aligned with the MRI. Using the MRI viewers, it’s relatively easy to confirm that the registration is the same as was seen in the original electrode program.

Yes, a bit confusing, but we’re merging multiple modalities, instruments, and software here. So I like the approach of getting scalp points in the same coordinates as the electrodes, so I can confirm precise registration.

To mirror Francois’ question, how are you getting electrode information from the Freesurfer folder?

  • John

Dear all,

Thanks for your replies and suggestions.
We are automatically extracting SEEG channel coordinates from the post-implant CT scans (see http://www.biomedcentral.com/1471-2105/16/99 for details.)

After channel segmentation, we apply rigid transformations to bring channel positions in Freesurfer (SurfaceRAS) space. We are importing channel positions as text file using ASCII Name, X ,Y ,Z format. What is confusing now, is that channel positions are correctly aligned to Freesurfer space if visualized in other tools (e.g. Freeview or 3DSlicer). when imported in Braistorm it seems that we are missing a translation.

We noticed that our volume (i.e. channel positions) is defined with origin in its center (X/2;Y/2;Z/2) while Brainstorm’s CTF space has its origin in the midpoint between RPA and LPA line. So what probably is missing is just the origin translation along Z axis on the channel volume.

Freesurfer surfaces are correctly aligned to MRI,how can we apply the same trasformation to channel positions?

g.

Hello,

Brainstorm re-writes everything it imports in the Brainstorm/CTF head coordinate system.
The transformation applied to the surfaces in FreeSurfer segmentation folder is not saved anywhere and depends on the MRI volume.
The easiest would be for me to add an option in the import of the electrode locations to import FreeSurfer coordinates.
I was already planning to do it with MNI coordinates (in one or two weeks).

It would be easier if I an example: could you send me an example FreeSurfer folder + contacts positions?
(upload it somewhere, then click on my username on this forum to send me the link in a separate email)

Thanks,
Francois

Hello,

I did a quick read of the DEETO article, and as noted, it uses the CT scan to determine the contact locations. Ultimately, you want to align these in the MRI, which is a different modality and always subject to some possible registration distortion and error. I don’t know if this is feasible in the DEETO software you are running, but an approach I would take is to not only extract the XYZ locations of the contacts, but also extract about 5,000 scalp points from the CT in the same coordinate system. Then create a Brainstorm channel structure, using the scalp points as “head points,” in addition to the contact locations. Then alignment can be more precisely guaranteed across modalities by using the CT scalp points to align to the MRI scalp surface inside of Brainstorm, with visual confirmation.

Does anyone reading this know if this feasible in the DEETO software?

  • John

Dear John & Francois ( and of course all brainstorm users),

thanks a lot for your suggestions. In our current SEEG projects we already have the MRI preimplant coregistered with post implant CT scans. The DEETO software we wrote defines channel coordinates in the CT/MRI geometrical space and are correctly aligned to each other (i.e. assessed using 3DSlicer or Freeviewer/TkSurfer).

What is confusing me is that the channel file and MRI/Surfaces (these last imported using “Import anatomy folder”) are defined exactly in the same geometrical space.

My question is simpler. (1) what is the transformation that is tacking place at the MRI volume that is also correctly applied to Freesurfer Surfaces (i.e. they visually overlap) but is not applied to channel positions and/or (2) how to apply this transformation also to the channel file?

Does anyone reading this know if this feasible in the DEETO software?

We should implement it and add this to our next release if is the only solution to this specific problem.

g.

Hello,

The FreeSurfer surface coordinates are saved in FreeSurfer RAS coordinates (in voxels).
When imported into Brainstorm, they are converted first to Brainstorm MRI coordinates (in millimeters) at lines 141-148 in function in_tess.m:

% FreeSurfer RAS coord => MRI => millimeters
if ~isempty(sMri)
    mriSize = size(sMri.Cube) / 2;
    Vertices = bst_bsxfun(@plus, Vertices, mriSize / 1000);
    Vertices = bst_bsxfun(@times, Vertices, sMri.Voxsize);
end

Then are converted from Brainstorm MRI coordinates to Brainstorm SCS coordinates at line 193 in function in_tess.m:

TessMat(iTess).Vertices = cs_convert(sMri, 'mri', 'scs', TessMat(iTess).Vertices);

All the coordinates systems used in Brainstorm are documented here:
http://neuroimage.usc.edu/brainstorm/CoordinateSystems

Does this help?
Francois

Hi,

This indeed helped to figure out one problem from our side. Brainstorm inverts X Y axis as it can be understood from line 148 in in_tess.m file.

Now I should apply to the channel positions the transformation that is computed by cs_convert MRI=> SCS.

Let’ s see,

g.

Dear Francois,

after some playing around with Brainstorm we were able to reach a quasi-perfect alignment (see attached figure). We are only ~1cm far from the real positions. As you can see F1 represent the Nasion coordinates picked in 3DSlicer. We saved that position in the same channel file were we stored the other channel positions. After importing the channel file, brainstorm shows the F1 few mm backwards and probably also it misalign along Z-axis.

We applied exactly the same codes you applied in cs_convert + translation (mri.size/2).

Have any of you working on SEEG experienced the same problem?

All the best,

g.

Hello,

I’m sorry for the response delay.
I cannot really tell what is going wrong with the alignment without looking into details at all the code and the files. Those issues with the transformations between coordinate systems are so difficult to understand…

I may have a much simpler solution to offer.
It looks like you have the position of the nasion placed in your file. Could you also mark two additional points to identify the left and right ears (LPA and RPA)?
The points we recommend using are described on this page:
http://neuroimage.usc.edu/brainstorm/CoordinateSystems

If you have an electrodes file with those three landmarks (NAS/LPA/RPA), Brainstorm will automatically calculate the appropriate transformation to align the electrodes positions on the MRI.
The beginning (or end) of your text file could look like this:

Nasion    9.592    0.083    -1.885
LPA    -0.474    6.819    0.628
RPA    -0.960    -6.723    0.164
E1    4.335    3.089    12.941
E2    2.689    3.027    13.882

If you cannot set freely the name of the landmarks, you can use any of the equivalent labels below (not case-sensitive):

  • NAS: nasion, nz, fidnas, fidnz
  • LPA: pal, og, left, fidt9, leftear
  • RPA: par, od, right, fidt10, rightear

Does this help?

Francois

Hello,

I am interested in these kind of problems.

Maybe the difference is between the RAS (origin = scanner origin) and TkRegRAS (origin = volume center) coordinates.
I encountered this problem marking electrodes as pointsets in FreeView. These are saved using the RAS coordinates.
The conversion code you propose is only valid for the TkRegRAS coordinates. This problem usually produces error of about 1 cm.

Regards,
Clément

Hi Clement,

Thanks for this comment, this is good to know.
Is there any method you could suggest to convert the coordinates from RAS to TkRegRAS outside of Brainstorm?

Cheers,
Francois

Actually in Freeview, I also mark the coordinates of the volume center in the RAS system. Then I just use it to translate electrodes and fiducials marked in Freeview from RAS to TkRegRAS and then to BrainstormMRI.

Clément

Dear all,

what is driving me crazy is that the channel positions are correctly aligned to Freesurfer surfaces (I checked this multiple times in the past years using either Freeview, tksurfer, and lately 3DSlicer). Then I cannot understand how is it possible that, if expressed in the exact same space, one cannot simply apply the same transform matrix that is applied to surfaces to get the channel positions from tkSurfer RAS - space to Brainstorm - space. Yet I do not have time now to make a full report for you to understand where the problem might arise (if it even exists). As soon as I can I’ll prepare some example data and I’ll pack everything so that these issue can be properly checked.

BR,

g.

Have you tried the simplest solution, which is to add the fiducial points (NAS,LPA,RPA) to your SEEG file?

[QUOTE=Francois;8897]Have you tried the simplest solution, which is to add the fiducial points (NAS,LPA,RPA) to your SEEG file?[/QUOTE]

Hi Francois,

we indeed tried the solution and it seems to give quite good alignment. I’ll try to quantify the displacements (if any) and let you know. It can be tricky (and prone to errors) the manual selection of exactly the same points using different viewer (our segmentation software is implemented as 3DSlicer plugin). Maybe a solution with automatically extracting from 500 points on the skull would give less problems. I’ll talk with software engineers and see if we can also test this solution.

BR,

g.

[QUOTE=Francois;8320]Hello,

Brainstorm re-writes everything it imports in the Brainstorm/CTF head coordinate system.
The transformation applied to the surfaces in FreeSurfer segmentation folder is not saved anywhere and depends on the MRI volume.
The easiest would be for me to add an option in the import of the electrode locations to import FreeSurfer coordinates.
I was already planning to do it with MNI coordinates (in one or two weeks).

Francois
[/QUOTE]

Dear Francois and all,
I am experiencing, I believe, the same issue as garnulfo when trying to import (S)EEG locations.
I don’t have any fiducial points (nor any other head points) available with the positions of the electrodes, but managed to align them properly with the surface of the cortex, corrected for brainshift, using the method described here http://episurg.pbworks.com/w/page/101851831/Electrode%20Localization

Hence, I have an electrode location file with coordinates that matches nicely with the voxel coordinates from freeviewer (as seen eg in tkmedit). However some transformation is applied to the surfaces and scan imported in brainstorm, that is not applied to the electrode locations file. Is there any way, as you suggested last year, to apply the same transformation to the electrode locations as that used for the Freesurfer surfaces?

Thank you very much,

Tom

Dear Tom,

The easier way would be for you to add the three fiducials NAS/LPA/RPA in the file with SEEG coordinates, in the same coordinate system.
If you can see your contacts correctly aligned in any program (freeview or others):

  1. Select three arbitrary landmarks NAS/LPA/RPA in the same program, for example the ones we describe here: http://neuroimage.usc.edu/brainstorm/CoordinateSystems
  2. Get the coordinates from this program and add them to the text file with the SEEG positions (edit the file with a text editor if you cannot add them from the interface of your program)
  3. When you import the anatomy of the subjects in Brainstorm: mark the exact same three anatomical landmarks in the MRI (NAS/LPA/RPA)
  4. When importing the channel positions (right-click on channel file > Add EEG positions > Import from file), all the contacts should be aligned in the Brainstorm coordinate system automatically.

Let me know if you need additional directions.
Cheers,
Francois

Dear Francois,
Thanks for your quick answer.
Unfortunately this method doesn’t work for some reason.
I have a file with the correct electrode locations along with the 6 fiducial points in the freesurfer space:
"31,124,227,NAS
192,159,123,LPA
58,150,128,RPA
126,108,141,AC
126,110,115,PC
131,39,128,IH
189.2381,79.10872,129.3728,TSG6
191.3195,88.22131,134.0091,TSG12
191.141,96.49012,139.4339,TSG18
189.5289,108.1668,143.3309,TSG24
…"
Whether I try to import this file as a channel file, or to use this file as an electrode position file to update the positions of a dummy channel file, the electrodes are situated an order of magnitude away from where they should land, although in the first case it seems the first 3 fiducials (NAS, LPA, RPA) are effectively read out by brainstorm (they don’t appear in the subsequently created channel file).
I double checked the fact that the fiducials and the electrode positions are indeed in the same space. So it seems there is a problem with the matching of the fiducials when importing a channel file…
I am quite confused as I am doing basically the exact same thing as a colleague. I tried on another computer and the problem persists. Would you happen to have any suggestion?

Thank you very much !
Tom