Surface export not matching MRI space


I am working with SEEG data and I am trying to have an overview of a subject in 3D slicer (MRI, TDM, electrods and brain model) in the same space for presentation.

I have imported the electrods coordonates, MRI and TDM from raw data so they are in the same space. However, I am trying to add a brain model created with the pial computed with cat12 in brainstorm and can't find a way to export the pial in the original MRI space.

In the screenshot below you can see to brain models that have been created with stlwrite.m using in yellow pial.fs and in green pial.gii both exported from brainstorm.

Does anyone has a solution ?


ps: the TDM is in neurology mode (left is right and right is left)

Hi @ArthurBorderie

Brainstorm models are in the SCS coordinate system.
Please check this tuto:

To convert the coordinate to the original MRI system, you need to convert first the vertices of your surface and then generate the STL model.
Please check this function that you can use for coordinates conversion:


the same issue happens when exporting to freesurfer surface (see back here:Exporting surface, not aligned with MRI in FreeView - #2 by tmedani)

Thank you for your quick answer.

The first thing I tried in this project was to use the cs_convert function on the vertices and faces of the pial found in the anatomy folder in the brainstorm database. However, it caused issues with stlwrite.m.
data = load('pial.mat')
Fk = data.faces;
Vk = data.vertices;
sMRI = load('subjectimage.mat')

[Fk, Transf] = cs_convert(sMri, 'scs', 'mri', Fk);
[Vk, Transf] = cs_convert(sMri, 'scs', 'mri', Vk);
Index in position 2 is invalid. Array indices must be positive integers or logical
Error in stlwrite (line 76)
facets = reshape(facets(:,faces'), 3, 3, );

I supposed that te error was due to the conversion of the surfaces so I tried to apply the .stl to only the vertices to which I applied the cs_convert(scs to mri (i suppose this the correct format)). And As you can see the result is not great to say the least.

Then I tried to export directly the file pial (in brainstom: anatomy>subject>pial>right clic>file>export file>.gii or .fs) thinking that they would be converted back to the original MRI system but as you can see it did not work (1st post).

Is there any other export method that would convert the pial back to the original MRI system ? Or if you have the information of what is the conversion matrix of the exported pial file (from the previous paragraph) ?

Did you find any solution since then ?

no sorry :frowning: