<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="Generator" content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Vorformatiert Zchn";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTMLVorformatiertZchn
        {mso-style-name:"HTML Vorformatiert Zchn";
        mso-style-priority:99;
        mso-style-link:"HTML Vorformatiert";
        font-family:"Courier New";}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style></head><body lang="DE"><div class="WordSection1"><p class="MsoNormal"><span lang="EN-US" style="font-family:"Arial",sans-serif;color:black">Hello everybody,<o:p></o:p></span></p><pre><span lang="EN-US" style="font-size:11.0pt;font-family:"Arial",sans-serif;color:black"><o:p> </o:p></span></pre><pre><span lang="EN-US" style="font-size:11.0pt;font-family:"Arial",sans-serif;color:black">I am using Fieldtrip to generate FEM head models. I segment my MRI data outside of MATLAB (using the Simnibs pipeline + manual corrections in SEG3D). I import my segmentation in MATLAB and use ft_prepare_mesh to generate the hexahedral mesh. This seems to work fine. However, when I pass the resulting mesh to the ft_prepare_headmodel function, I get the following error:<o:p></o:p></span></pre><pre><span lang="EN-US" style="font-size:11.0pt;font-family:"Arial",sans-serif;color:black"><o:p> </o:p></span></pre><pre><span lang="EN-US" style="font-size:11.0pt;font-family:"Arial",sans-serif;color:black"><o:p> </o:p></span></pre><pre style="margin-left:35.4pt"><span lang="EN-US" style="font-size:11.0pt;font-family:"Arial",sans-serif;color:red">Error using sb_calc_stiff (line 80)<o:p></o:p></span></pre><pre style="margin-left:35.4pt"><span lang="EN-US" style="font-size:11.0pt;font-family:"Arial",sans-serif;color:red">Elements have wrong orientation or are degenerated<o:p></o:p></span></pre><pre style="margin-left:35.4pt"><span lang="EN-US" style="font-size:11.0pt;font-family:"Arial",sans-serif;color:red"><o:p> </o:p></span></pre><pre style="margin-left:35.4pt"><span lang="EN-US" style="font-size:11.0pt;font-family:"Arial",sans-serif;color:red">Error in ft_headmodel_simbio (line 90)<o:p></o:p></span></pre><pre style="margin-left:35.4pt"><span lang="EN-US" style="font-size:11.0pt;font-family:"Arial",sans-serif;color:red">headmodel.stiff = sb_calc_stiff(headmodel);<o:p></o:p></span></pre><pre style="margin-left:35.4pt"><span lang="EN-US" style="font-size:11.0pt;font-family:"Arial",sans-serif;color:red"><o:p> </o:p></span></pre><pre style="margin-left:35.4pt"><span lang="EN-US" style="font-size:11.0pt;font-family:"Arial",sans-serif;color:red">Error in ft_prepare_headmodel (line 426)<o:p></o:p></span></pre><pre style="margin-left:35.4pt"><span lang="EN-US" style="font-size:11.0pt;font-family:"Arial",sans-serif;color:red">    headmodel = ft_headmodel_simbio(geometry, 'conductivity', cfg.conductivity);<o:p></o:p></span></pre><pre><span lang="EN-US" style="font-size:11.0pt;font-family:"Arial",sans-serif;color:black"><o:p> </o:p></span></pre><pre><span lang="EN-US" style="font-size:11.0pt;font-family:"Arial",sans-serif;color:black"><o:p> </o:p></span></pre><pre><span lang="EN-US" style="font-size:11.0pt;font-family:"Arial",sans-serif;color:black"><o:p> </o:p></span></pre><pre><span lang="EN-US" style="font-size:11.0pt;font-family:"Arial",sans-serif;color:black">Below is the code I am using to generate the mesh and the FEM model:<o:p></o:p></span></pre><pre><span lang="EN-US" style="font-size:11.0pt;font-family:"Arial",sans-serif;color:black"><o:p> </o:p></span></pre><pre style="margin-left:35.4pt"><span lang="EN-US" style="font-size:11.0pt;font-family:"Arial",sans-serif;color:black">cfg        = [];<o:p></o:p></span></pre><pre style="margin-left:35.4pt"><span lang="EN-US" style="font-size:11.0pt;font-family:"Arial",sans-serif;color:black">cfg.shift  = 0.3;<o:p></o:p></span></pre><pre style="margin-left:35.4pt"><span lang="EN-US" style="font-size:11.0pt;font-family:"Arial",sans-serif;color:black">cfg.tissue = {'gray','white','csf','skull','scalp'};<o:p></o:p></span></pre><pre style="margin-left:35.4pt"><span lang="EN-US" style="font-size:11.0pt;font-family:"Arial",sans-serif;color:black">cfg.method = 'hexahedral';<o:p></o:p></span></pre><pre style="margin-left:35.4pt"><span lang="EN-US" style="font-size:11.0pt;font-family:"Arial",sans-serif;color:black">mesh       = ft_prepare_mesh(cfg,segmentedmri);<o:p></o:p></span></pre><pre style="margin-left:35.4pt"><span lang="EN-US" style="font-size:11.0pt;font-family:"Arial",sans-serif;color:black"><o:p> </o:p></span></pre><pre style="margin-left:35.4pt"><span lang="EN-US" style="font-size:11.0pt;font-family:"Arial",sans-serif;color:black"><o:p> </o:p></span></pre><pre style="margin-left:35.4pt"><span lang="EN-US" style="font-size:11.0pt;font-family:"Arial",sans-serif;color:black">cfg              = [];<o:p></o:p></span></pre><pre style="margin-left:35.4pt"><span lang="EN-US" style="font-size:11.0pt;font-family:"Arial",sans-serif;color:black">cfg.method       ='simbio';<o:p></o:p></span></pre><pre style="margin-left:35.4pt"><span lang="EN-US" style="font-size:11.0pt;font-family:"Arial",sans-serif;color:black">cfg.conductivity = [0.33 0.14 1.79 0.01 0.43];   <o:p></o:p></span></pre><pre style="margin-left:35.4pt"><span lang="EN-US" style="font-size:11.0pt;font-family:"Arial",sans-serif;color:black">FEMModel         = ft_prepare_headmodel(cfg, mesh);   <o:p></o:p></span></pre><pre><span lang="EN-US" style="font-size:11.0pt;font-family:"Arial",sans-serif;color:black"><o:p> </o:p></span></pre><pre><span lang="EN-US" style="font-size:11.0pt;font-family:"Arial",sans-serif;color:black"><o:p> </o:p></span></pre><pre><span lang="EN-US" style="font-size:11.0pt;font-family:"Arial",sans-serif;color:black"> <o:p></o:p></span></pre><pre><span lang="EN-US" style="font-size:11.0pt;font-family:"Arial",sans-serif;color:black">Has anyone experienced the same problem and know how to fix it?<o:p></o:p></span></pre><pre><span lang="EN-US" style="font-size:11.0pt;font-family:"Arial",sans-serif;color:black"><o:p> </o:p></span></pre><pre><span lang="EN-US" style="font-size:11.0pt;font-family:"Arial",sans-serif;color:black">Thanks a lot,<o:p></o:p></span></pre><pre><span style="font-size:11.0pt;font-family:"Arial",sans-serif;color:black"><o:p> </o:p></span></pre><pre><span style="font-size:11.0pt;font-family:"Arial",sans-serif;color:black"><o:p> </o:p></span></pre><p class="MsoNormal"><o:p> </o:p></p></div></body></html>