[FieldTrip] Antw: Creating a head model using OPENMEEG - Intersecting mesh error

Gregor Volberg Gregor.Volberg at psychologie.uni-regensburg.de
Mon Jan 20 12:21:26 CET 2014

Dear Roey,
just two or three hints that might be helpful:
I assume that the segmentation itself was successful; you can check this with ft_plot_vol for each of your tissues. Given that the segmentation is correct and the tissue borders are not intersecting, the error occurred during the mesh construction. I experienced that the number of triangles used for the mesh is often critical, with large numbers producing self-intersections. You could play around a bit with the number of triangles used for each compartement as specified in cfg.numvertices. Then, check the effect on the resulting volume. You do not need to call the ft_sourceanalysis for that; there is the funktion om_check_vol  in the external/openmeeg folder that checks the integrity of the volumes and reports intersections or self-intersections.
During the leadfield computation, OpenMEEG writes some files to the hard disk for later use. If the meshes are incorrect, then the leadfield fails and no file can be written to the disk. So the error warning on the file identifiers is presumably secondary to the mesh issue.
Kind regards,

Dr. rer. nat. Gregor Volberg <gregor.volberg at psychologie.uni-regensburg.de> ( mailto:gregor.volberg at psychologie.uni-regensburg.de )
University of Regensburg
Institute for Experimental Psychology
93040 Regensburg, Germany
Tel: +49 941 943 3862 
Fax: +49 941 943 3233
>>> Roey Schurr <roeysc at gmail.com> 19.01.2014 12:21 >>>
Dear fieldtrippers,

I am writing you after encountering an error using the OPENMEEG method for creating a head model, which I need for source reconstruction of EEG data (using 19 electrodes), e.g.:
triangles 5018 and 5129 are intersecting 
triangles 5305 and 5781 are intersecting 
triangles 5879 and 5907 are intersecting 
!!!!!!!!!!! WARNING !!!!!!!!!!! 
Mesh is self intersecting ! 
2 meshes are intersecting !

It seems to be the same problem reported by Olivia about two years ago:

In what follows I will describe the main steps in my script:

1) I create a segmented 'brain','skull','scalp' mri structure of the subject:
cfg.output = {'brain','skull','scalp'};
[bss_segmentedmri] = ft_volumesegment(cfg, mri);

2) I try using ft_sourceanalysis

3) which in turn tries to compute the leadfield using ft_compute_leadfield through ft_leadfield_openmeeg.

yes this doesn't work, and I get the following error:
Error using fprintf
Invalid file identifier. Use fopen to generate a valid file identifier.

Error in ft_leadfield_openmeeg (line 112)
fprintf(fid,'%s\t%.15f\t%.15f\t%.15f\n', sens.label{ii}, sens.chanpos(ii,:));

Since it is crucial that I use a realistic head model, do you have any suggestions?

Any advice would be greatly appreciated!
Thank you, and have a nice week,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20140120/4aa1b93e/attachment-0002.html>

More information about the fieldtrip mailing list