Importing Fieldtrip structures to do Source Localization in BrainStorm

Hi everyone,
I have used Fieldtrip to obtain the headmodel (BEM) and the source model for EEG data;
I would like to know which is the easier way to convert and import these Fieldtrip structures in
Brainstorm to solve the inverse problem.

Thank you in advance!

Importing anatomical structures computed manually in FieldTrip into Brainstorm is complicated due to the conversions of coordinate systems.

The easy solution is to import the anatomical and sensor information in Brainstorm, then call the wrapper process to the FieldTrip forward model computation from Brainstorm: "Sources > FieldTrip: ft_prepare_leadfield". If you are using OpenMEEG, then prefer computing the BEM model from Brainstorm (https://neuroimage.usc.edu/brainstorm/Tutorials/TutBem), but other BEM solutions are not available directly in Brainstorm.

Otherwise, you can explore the code of process_ft_prepare_leadfield.m and the out_fieldtrip_*.m and in_*_fieldtrip.m functions to understand and how to do the structure conversions, but be aware that you might not be able to easily convert correctly the spatial information to the Brainstorm coordinate system.

Hi François,

I'm taking on the challenge of doing this for a big 300 subjects dataset with @filipa. All have been segmented by a previous collaborator using FieldTrip.
I would like to take the following approach. I know it is kind of a hack and probably not good practice, but here we go:

  1. Import all .nii MRIs by hand in Brainstorm and do an automated MNI normalization to get the Nasion, LPA, RPA, AC, PC, IH points easily and hence compute the necessary spatial coregistration transformations.
  2. Simply squeeze my FieldTrip segmented MRIs masks into a Brainstorm MRI Cube, leaving alone the coregistrations, and stick that Cube into a tissue-like .mat file with Cube, Voxsize, Labels, Comment, SCS, NCS, History, Histogram.
  3. Save it by hand in the right location, updating the brainstormsubject.mat file accordingly.

The reason I do this is because 300 subjects is a lot to import in Brainstorm, but 300 subjects to import, segment and fix is a nightmare, and a redo of what our collaborator did already.

So if you don't have an easier way that I've overlooked, my questions go:

  1. Am I correct thinking that I only need to transfer the brain, skull, and scalp structures below into the Brainstorm Cube (replacing the ones in the mask by indices into the Label structure) to get a working copy of the segmentation into Brainstorm?
          dim: [240 256 176]
    transform: [4×4 double]
     coordsys: 'neuromag'
         unit: 'cm'
        brain: [240×256×176 logical]
        skull: [240×256×176 logical]
        scalp: [240×256×176 logical]
          cfg: [1×1 struct]
  1. Can I leave out the Histogram field, which I have no clue how to create by hand? or do you have a function that creates it easily?

Obviously, if you have an easier fix, I'm all ears !

Many thanks! Happy hour!
Max

1 Like

Hi Max,

  1. Am I correct thinking that I only need to transfer the brain, skull, and scalp structures below into the Brainstorm Cube (replacing the ones in the mask by indices into the Label structure) to get a working copy of the segmentation into Brainstorm?

You have the code to convert a FieldTrip segmentation into a Brainstorm "tissue" volume available in the function process_ft_volumesegment.m, after line 259.

What are you expecting to do with this tissue segmentation?

  1. Can I leave out the Histogram field, which I have no clue how to create by hand? or do you have a function that creates it easily?

Yes. Leave it empty. If Brainstorm needs it, it will recompute it anyway.