<HTML><HEAD>
<META content="text/html; charset=utf-8" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 10.00.9200.16750"></HEAD>
<BODY style="FONT: 10pt Tahoma; MARGIN: 4px 4px 1px">
<DIV>Dear Roey,</DIV>
<DIV> </DIV>
<DIV>just two or three hints that might be helpful:</DIV>
<DIV> </DIV>
<DIV>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.<BR>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.</DIV>
<DIV> </DIV>
<DIV>Kind regards,</DIV>
<DIV>Gregor </DIV>
<DIV> </DIV>
<DIV><BR> </DIV>
<DIV> </DIV>
<DIV>-- <BR>Dr. rer. nat. Gregor Volberg <<A href="mailto:gregor.volberg@psychologie.uni-regensburg.de">gregor.volberg@psychologie.uni-regensburg.de</A>> ( <A href="mailto:gregor.volberg@psychologie.uni-regensburg.de">mailto:gregor.volberg@psychologie.uni-regensburg.de</A> )<BR>University of Regensburg<BR>Institute for Experimental Psychology<BR>93040 Regensburg, Germany<BR>Tel: +49 941 943 3862 <BR>Fax: +49 941 943 3233<BR><A href="http://www.psychologie.uni-regensburg.de/Greenlee/team/volberg/volberg.html">http://www.psychologie.uni-regensburg.de/Greenlee/team/volberg/volberg.html</A><BR>>>> Roey Schurr <roeysc@gmail.com> 19.01.2014 12:21 >>><BR></DIV>
<DIV dir=ltr>Dear fieldtrippers,
<DIV><BR></DIV>
<DIV>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.:</DIV>
<DIV>
<DIV>...</DIV>
<DIV>
<DIV>triangles 5018 and 5129 are intersecting </DIV>
<DIV>triangles 5305 and 5781 are intersecting </DIV>
<DIV>triangles 5879 and 5907 are intersecting </DIV></DIV>
<DIV>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! </DIV>
<DIV>!!!!!!!!!!! WARNING !!!!!!!!!!! </DIV>
<DIV>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</DIV>
<DIV>Mesh is self intersecting ! </DIV></DIV>
<DIV>...</DIV>
<DIV>2 meshes are intersecting !<BR></DIV>
<DIV><BR></DIV>
<DIV>It seems to be the same problem reported by Olivia about two years ago:<BR></DIV>
<DIV><A href="http://mailman.science.ru.nl/pipermail/fieldtrip/2012-March/004881.html">http://mailman.science.ru.nl/pipermail/fieldtrip/2012-March/004881.html</A><BR></DIV>
<DIV><BR></DIV>
<DIV>In what follows I will describe the main steps in my script:</DIV>
<DIV><BR></DIV>
<DIV>1) I create a segmented 'brain','skull','scalp' mri structure of the subject:</DIV>
<DIV>cfg.output = {'brain','skull','scalp'};</DIV>
<DIV>[bss_segmentedmri] = ft_volumesegment(cfg, mri);</DIV>
<DIV><BR></DIV>
<DIV>2) I try using ft_sourceanalysis</DIV>
<DIV><BR></DIV>
<DIV>3) which in turn tries to compute the leadfield using ft_compute_leadfield through ft_leadfield_openmeeg.</DIV>
<DIV><BR></DIV>
<DIV>yes this doesn't work, and I get the following error:</DIV>
<DIV>
<DIV>Error using fprintf</DIV>
<DIV>Invalid file identifier. Use fopen to generate a valid file identifier.</DIV>
<DIV><BR></DIV>
<DIV>Error in ft_leadfield_openmeeg (line 112)</DIV>
<DIV>fprintf(fid,'%s\t%.15f\t%.15f\t%.15f\n', sens.label{ii}, sens.chanpos(ii,:));</DIV></DIV>
<DIV><BR></DIV>
<DIV><BR></DIV>
<DIV>Since it is crucial that I use a realistic head model, do you have any suggestions?</DIV>
<DIV><BR></DIV>
<DIV>Any advice would be greatly appreciated!</DIV>
<DIV>Thank you, and have a nice week,</DIV>
<DIV><BR></DIV>
<DIV>roey</DIV></DIV></BODY></HTML>