Convert Brainstorm FEM to Fieldtrip for EEG source modelling

Hi everyone, first I want to thank all people involved in developing Brainstorm. This is a terrific software!

I build a FEM headmodel in Brainstorm from an individual MRI and electrode positions. Now, I would like to export the headmodel for further processing in fieldtrip.

I tried the out_fieldtrip_headmodel function, but did not succeed. Would anyone have an example script were the export is shown in detail?

Best regards,
Markus

Hi @MWB

What do you mean by headmodel?
is it the FEM mesh model (in the anatomical side of brainstorm) or the computed leadfield (in the functional side of brainstorm)?

So, in both case, you can export your "headmodel" to matlab, by right click on the item, then File ==> export to matlab. You will have the data as they are stored in the Brainstorm database.
From this step, you need to adapt this data to Fieldtrip format.

As far as I know, the current Fieldtrip functions can not read the FEM mesh from Brainstorm,
but it's not difficult to adapt it.

Could you explain which headmodel you need? (FEM head mesh or the FEM LF)

Best
Takfarinas

The function out_fieldtrip_headmodel.m is supposed to convert a Brainstorm "headmodel.mat" structure to a FieldTrip leadfield structure.
However, DUNEuro (and FEM in general) is not supported yet.

What is missing in this function is an extra case 'duneuro', which creates a structure similar to what FieldTrip would generate for FEM foward modelling.
You are more than welcome to contribute to the improvement of this conversion function: when you have a prototype, please open a new PR on the Brainstorm github, and we will finish the integration from there.

For converting the 3D tetrahedral mesh to a "FieldTrip headmodel", we need to modify the function out_fieldtrip_tess.m, which currently only supports surface triangulated tesselations.

Thanks

1 Like