[Simnibs-discuss] Converting from .stl to .surf (freesurfer)

Jesper Duemose Nielsen jesperdn at drcmr.dk
Sat Jun 25 11:57:07 CEST 2022


Hi Lau

You could try something like this

----

from simnibs.msh.hmutils import mesh_load
import mne

fname_in = '/path/to/filename.stl'
fname_out '/path/to/filename.surf'

v, f = mesh_load(fname_in)
# v, f = mne.surface.decimate_surface(v, f, n_triangles=5000) # or whatever
mne.surface.write_surface(fname_out, v, f)

----

In my experience, the BEM implementation in MNE does not like the high 
density surfaces from simnibs so you may want to decimate them. I 
included a possible way of doing it.

Best,

Jesper

On 6/22/2022 13:34, Lau Møller Andersen wrote:
>
> Dear SimNIBS list
>
> Thank you for a great tool.
>
> I looked through the archive and couldn't find an answer for my 
> question. I have used your headreco algorithm, and I created 
> impressive looking renderings of the head and the brain of a subject. 
> These are in the stl.format, and I was wondering whether there's a way 
> to convert it to the .surf format found in FreeSurfer?
>
> Specifically, I need this to specify the boundaries between layers 
> when specifying the BEM-model in MNE-Python.
>
> All the best wishes
>
> Lau Møller Andersen
>
> -- 
> Lau Møller Andersen
> Ph.D. | Assistant Professor
>
> AIAS-COFUND Fellow (Aarhus Institute of Advanced Studies) aias.au.dk
> Høegh-Guldbergs Gade 6B
> 8000 Aarhus C
> Denmark
> &
> Department of Linguistics, Cognitive Science and Semiotics cognitive 
> science <https://cc.au.dk/en/about-the-school/subjects/cognitive-science/>
> School of Communication and Culture
> Faculty of Arts
> Aarhus University
> Building 1485, Room 524
> Jens Christian Skous Vej 2
> 8000 Aarhus C
> Denmark
> &
> Center of Functionally Integrative Neuroscience cfin.au.dk
> Department of Clinical Medicine
> Faculty of Health
> Aarhus University
> Building 1710
> Universitetsbyen 3
> 8000 Aarhus C
> Denmark
>
> Website: laumollerandersen.org <http://laumollerandersen.org>
> Mail: lmandersen at cfin.au.dk and lmandersen at aias.au.dk
> GitHub: github.com/ualsbombe <https://github.com/ualsbombe>
> Twitter: twitter.com/ualsbombe <https://twitter.com/ualsbombe>
> Google Scholar: User Profile 
> <https://scholar.google.dk/citations?user=3lZ_qo8AAAAJ&hl=da&oi=ao>
>
> _______________________________________________
> Simnibs-discuss mailing list
> Simnibs-discuss at drcmr.dk
> https://mailman.drcmr.dk/mailman/listinfo/simnibs-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.drcmr.dk/pipermail/simnibs-discuss/attachments/20220625/fdfc519f/attachment.html>


More information about the Simnibs-discuss mailing list