question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ENH: Use something other than FreeSurfer for BEM extraction

See original GitHub issue

Dear MNE expert,

I am working with a EEG dataset and I wish to run source on that. Unfortunately the T1w are not FLASH and I know that in the absence of FLASH images, MNE offers a somewhat less accurate solution based on the watershed algorithm (see Jas et al., 2018).

Indeed for some subjects in my dataset (see attached 1) I got the following error when I am going to run make_bem_model.

RuntimeError: Surface inner skull is not completely inside surface outer skull

For other subject instead the surfaces are simply wrong (see attached 2), even though make_bem_model hadn’t give me any error

Screen Shot 2020-01-20 at 14 13 39

Screen Shot 2020-01-20 at 14 13 04

I was wondering whether if you have some tips on how to fix them.

Thanks

Dave

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:26 (21 by maintainers)

github_iconTop GitHub Comments

1reaction
larsonercommented, Feb 3, 2021

Some exploration so far – I’ve had decent luck with FieldTrip + SPM (worked on 157/158 subjects), but this requires MATLAB so it’s a bit of a no-go.

I then tried brainsuite and fsl using this gist. brainsuite skullfinder is very fast (1-2 sec) but produces a questionable output, whereas fsl seems to work well in about a minute of run-time.

Subject 1

brainsuite skullfinder:

$ freeview -v T1.mgz -f bs_inner_skull.surf:edgecolor=red -f bs_outer_skull.surf:edgecolor=yellow -f bs_outer_skin.surf:edgecolor=255,170,128:hide_in_3d=true

Screenshot from 2021-02-03 15-19-49

fsl bet:

Screenshot from 2021-02-03 15-43-51

FieldTrip + SPM could not process this subject because it couldn’t determine the orientation (the head is tilted about the Z axis is probably the issue?).

Subject 2

brainsuite:

Screenshot from 2021-02-03 15-53-10

fsl:

Screenshot from 2021-02-03 15-52-34

FieldTrip + SPM + Python mesh code to marching_cubes + smooth + decimate:

Screenshot from 2021-02-03 15-49-26

Overall I think I like the idea of adding a mne fsl_bem function that uses fsl to generate BEM surfaces. It already puts out ones that are smoothed and 5120 triangles, writes to a standard format (vtk) that can by read by pyvista, etc. It even makes sure that the meshes don’t intersect:

the mesh is self-intersecting 
thus will rerun with higher smoothness constraint
0reactions
hoechenbergercommented, Feb 4, 2021

Amazing work, @larsoner!! Would very much love to see this added to MNE

Read more comments on GitHub >

github_iconTop Results From Across the Web

mri_make_bem_surfaces - Free Surfer Wiki
mri_make_bem_surfaces - This is a tool to create BEM surfaces ... however, it is not updated or actively worked upon (It's last substantial ......
Read more >
Head models of healthy and depressed adults for simulating ...
In our previous study, we reported stronger stimulation-induced E-fields in the lDLPFC for the bipolar montage used by Brunoni and colleagues (2013) than...
Read more >
What's new — MNE 1.0.3 documentation
This simplifies MNE-Python maintenance and keeps the package smaller. The following new dependencies have been added: Jinja2 (replaces Tempita , ...
Read more >
NeuroPycon: An open-source python toolbox for fast multi ...
Last but not least, the ability to use NeuroPycon parameter files to ... data will be used in the pipeline to extract the...
Read more >
CMP3 Documentation - Connectome Mapper 3
by users not familiar with Docker and Singularity containers, ... Important: The user is requested to use its own Freesurfer license ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found