<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style>@font-face {
        font-family: Helvetica;
}
@font-face {
        font-family: Helvetica;
}
@font-face {
        font-family: Calibri;
}
@font-face {
        font-family: Tahoma;
}
@page WordSection1 {margin: 72.0pt 72.0pt 72.0pt 72.0pt; }
P.MsoNormal {
        MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Calibri","sans-serif"; FONT-SIZE: 11pt
}
LI.MsoNormal {
        MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Calibri","sans-serif"; FONT-SIZE: 11pt
}
DIV.MsoNormal {
        MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Calibri","sans-serif"; FONT-SIZE: 11pt
}
A:link {
        COLOR: blue; TEXT-DECORATION: underline
}
SPAN.MsoHyperlink {
        COLOR: blue; TEXT-DECORATION: underline
}
A:visited {
        COLOR: purple; TEXT-DECORATION: underline
}
SPAN.MsoHyperlinkFollowed {
        COLOR: purple; TEXT-DECORATION: underline
}
P.MsoAcetate {
        MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Tahoma","sans-serif"; FONT-SIZE: 8pt
}
LI.MsoAcetate {
        MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Tahoma","sans-serif"; FONT-SIZE: 8pt
}
DIV.MsoAcetate {
        MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Tahoma","sans-serif"; FONT-SIZE: 8pt
}
SPAN.EmailStyle17 {
        FONT-FAMILY: "Calibri","sans-serif"; COLOR: windowtext
}
SPAN.BalloonTextChar {
        FONT-FAMILY: "Tahoma","sans-serif"
}
.MsoChpDefault {
        FONT-FAMILY: "Calibri","sans-serif"
}
</style><style id="owaParaStyle">P {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
</style>
</head>
<body lang="EN-AU" vlink="purple" link="blue" fPStyle="1" ocsi="0">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">
<p>Dear FieldTrip<a></a><a></a> users,</p>
<p> </p>
<p>As I have faced problems in creating a head model<a></a> with MRI's, so I thought to try the MNI<a></a><a></a> head for creating the meshes. I used the NeuroScan<a></a><a></a> software to create the surface meshes and exported them to Matlab<a></a><a></a>.
 Then tried to crate the head model<a></a> using ft_prepare_headmodel<a></a><a></a> function.  however the 'om_minverser<a></a><a></a>' stops working and the program terminates.</p>
<p> </p>
<p>When I plot the meshes they seem fine to me so I assume that there is no segmenting issues. But Now I get an error as attached in the 'log.txt<a></a><a></a>' from the Matlab<a></a> workspace, which says about self intersecting meshes. I have attached the Neuroscan<a></a><a></a>
 exported meshes (innerSkull.mat,outerSkull.mat,skin.mat<a></a>) and the Matlab<a></a><a></a> function (m_file.txt<a></a>) that I used in creating the head model<a></a>.</p>
<p> </p>
<p>I really want to generate some simulated EEG data but cannot make anything work. If someone can give a guidance on where I am going wrong in the procedure , that will be highly appreciated.</p>
<p> </p>
<p>Many thanks.</p>
<p> </p>
<p>Kind regards</p>
<p><a>Imali</a><a></a><a></a></p>
<p> </p>
<div style="FONT-FAMILY: Times New Roman; COLOR: #000000; FONT-SIZE: 16px">
<hr tabindex="-1">
<div style="DIRECTION: ltr" id="divRpF653581"><font color="#000000" size="2" face="Tahoma"><b>From:</b> IMALI THANUJA HETTIARACHCHI<br>
<b>Sent:</b> Tuesday, 5 June 2012 1:32 PM<br>
<b>To:</b> fieldtrip@science.ru.nl<br>
<b>Subject:</b> Creating a MRI based headmodel<br>
</font><br>
</div>
<div></div>
<div>
<div class="WordSection1">
<p class="MsoNormal">Dear All,</p>
<p class="MsoNormal"> </p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal">I started with fieldTrip recently and I am trying to create a BEM headmodel using the mri data (<span style="FONT-FAMILY: 'Courier New'; COLOR: #a020f0; FONT-SIZE: 10pt">standard_mri.mat</span>) available on the
 website. I use the following code</p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"> </p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">load standard_mri.mat</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">mri_orig=mri;</span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span> </p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">% Realign the data to the CTF system</span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt"></span> </p>
<p style="TEXT-AUTOSPACE: ; MARGIN-LEFT: 36pt" class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">cfg = [];</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: ; MARGIN-LEFT: 36pt" class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">cfg.method = 'interactive';</span></p>
<p style="TEXT-AUTOSPACE: ; MARGIN-LEFT: 36pt" class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">% use n,l,r fudicials</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: ; MARGIN-LEFT: 36pt" class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">mri_realign = ft_volumerealign(cfg, mri_orig);</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: ; MARGIN-LEFT: 36pt" class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt"></span> </p>
<p style="TEXT-AUTOSPACE: ; MARGIN-LEFT: 36pt" class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">cfg = [];</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: ; MARGIN-LEFT: 36pt" class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">cfg.resolution = 1; % mm</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: ; MARGIN-LEFT: 36pt" class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">cfg.dim = mri_orig.dim;</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: ; MARGIN-LEFT: 36pt" class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">mri_reslice = ft_volumereslice(cfg, mri_realign);</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span> </p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt">%%
</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">Segmenting the data</span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span> </p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">cfg = [];</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">cfg.output= {'scalp','skull','brain'};</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">cfg.coordinates    = 'ctf';
</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">cfg.keepintermediate = 'no';</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">[mri_segment] = ft_volumesegment(cfg, mri_reslice);
</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">mri_combine = mri_reslice;</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">mri_combine.seg  = mri_segment.scalp + 3*mri_segment.skull + 6*mri_segment.brain;</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">mri_combine.mask = (mri_combine.seg)>0;</span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span> </p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">%%  Plot data</span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span> </p>
<p style="TEXT-AUTOSPACE: ; MARGIN-LEFT: 36pt" class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">cfg = [];</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: ; MARGIN-LEFT: 36pt" class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">cfg.interactive   = 'no';</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: ; MARGIN-LEFT: 36pt" class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">cfg.method='slice';
</span></p>
<p style="TEXT-AUTOSPACE: ; MARGIN-LEFT: 36pt" class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">cfg.funparameter  = 'seg';</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: ; MARGIN-LEFT: 36pt" class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">cfg.funcolormap   = 'jet';</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: ; MARGIN-LEFT: 36pt" class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">cfg.funcolorlim = [0 7];</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: ; MARGIN-LEFT: 36pt" class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">cfg.opacitylim    = [0 1.5];</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: ; MARGIN-LEFT: 36pt" class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">cfg.maskparameter = 'mask';</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: ; MARGIN-LEFT: 36pt" class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">figure , ft_sourceplot(cfg,mri_combine);</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: ; MARGIN-LEFT: 36pt" class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt"></span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">%% Generating the mesh</span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span> </p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">    cfg=[];</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">    cfg.tissue=[1 2 3];</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">    cfg.numvertices=[5000 3000 800];</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">    cfg.sourceunits=mri_segment.unit;</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">    scalp=(mri_segment.scalp)&~(mri_segment.skull | mri_segment.brain);</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">    skull=2*(mri_segment.skull);</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">    brain=3*(mri_segment.brain);</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt"></span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">    mri_segment.seg= scalp+skull+brain;</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">    bnd = ft_prepare_mesh(cfg, mri_segment);</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt"></span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt">%</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">% View meshes a transparent plot</span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span> </p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">figure (2)</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">tr1=TriRep(bnd(1).tri,bnd(1).pnt(:,1),bnd(1).pnt(:,2),bnd(1).pnt(:,3));</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">tr2=TriRep(bnd(2).tri,bnd(2).pnt(:,1),bnd(2).pnt(:,2),bnd(2).pnt(:,3));</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">tr3=TriRep(bnd(3).tri,bnd(3).pnt(:,1),bnd(3).pnt(:,2),bnd(3).pnt(:,3));</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">       trisurf(tr1,'facealpha',0.1); hold on</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">       trisurf(tr2,'facealpha',0.2); hold on</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">       trisurf(tr3)</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">   
</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">     </span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">%% BEM Computation-calculating the related electromagnetic model</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt"></span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">Cskin_surface= 0.33; %scalp</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">Couter_skull_surface=0.0042; %skull</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">Cinner_skull_surface=0.33; %brain</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">vol=[];</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">for i=1:3</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">vol.bnd(i).tri=bnd(i).tri;</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">vol.bnd(i).pnt=bnd(i).pnt;</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">end</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">vol.cond=[Cskin_surface Couter_skull_surface Cinner_skull_surface];</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">cfg=[];</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">cfg.method         = 'openmeeg';</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">vol = ft_prepare_headmodel(cfg, vol);</span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt"></span><span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 12pt"></span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal">When I run the code at the stage of generating the headmodel with
<span style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">ft_prepare_headmodel,
</span><span style="COLOR: black">I get an error  as;</span></p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal">??? Error using ==> surface_nesting at 24</p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal">the compartment nesting cannot be determined</p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"> </p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal">Error in ==> ft_headmodel_bem_openmeeg at 96</p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal">order = surface_nesting(vol.bnd, 'insidefirst');</p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"> </p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal">With the limited experience with fieldTrip and headmodels I assume that this is because the meshes are overlapping.</p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"> </p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal">I would really appreciate any guidance and any suggestions given to make this work.</p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"> </p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal">Many thanks in advance.</p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"> </p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal">Kind regards</p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal">Imali</p>
<p style="TEXT-AUTOSPACE: " class="MsoNormal"> </p>
<p class="MsoNormal"><b><span style="FONT-FAMILY: 'Times New Roman','serif'">Imali Thanuja Hettiarachchi</span></b></p>
<p class="MsoNormal"><span style="FONT-FAMILY: 'Times New Roman','serif'">PhD Candidate</span></p>
<p class="MsoNormal"><span style="FONT-FAMILY: 'Times New Roman','serif'">Centre for Intelligent Systems research</span></p>
<p class="MsoNormal"><span style="FONT-FAMILY: 'Times New Roman','serif'">Deakin University,
</span><span style="FONT-FAMILY: 'Times New Roman','serif'; COLOR: black; FONT-SIZE: 10pt">Geelong 3217, Australia.</span></p>
<p class="MsoNormal"><span style="FONT-FAMILY: 'Times New Roman','serif'; COLOR: black; FONT-SIZE: 10pt">Email:
<a href="mailto:ith@deakin.edu.au" target="_blank"><span style="COLOR: blue">ith@deakin.edu.au</span></a><br>
</span><span style="FONT-FAMILY: 'Times New Roman','serif'"><a href="http://www.deakin.edu.au/cisr" target="_blank"><span style="COLOR: blue">www.deakin.edu.au/cisr</span></a></span></p>
<p class="MsoNormal"><span style="FONT-FAMILY: 'Times New Roman','serif'"></span> </p>
<p class="MsoNormal"><span style="FONT-FAMILY: 'Helvetica','sans-serif'; COLOR: black; FONT-SIZE: 9pt"><img id="Picture_x0020_1" border="0" alt="Description: Description: Description: cid:1216BE20-1800-4A47-8B9F-E7B9D94831CD@deakin.edu.au" src="cid:image001.jpg@01CD431E.D3C538D0" width="70" height="73"></span><span style="FONT-FAMILY: 'Tahoma','sans-serif'; COLOR: black; FONT-SIZE: 10pt"></span></p>
<p class="MsoNormal"><span style="FONT-FAMILY: 'Tahoma','sans-serif'; COLOR: black; FONT-SIZE: 10pt"></span> </p>
<p class="MsoNormal"><span style="FONT-FAMILY: 'Tahoma','sans-serif'; COLOR: black; FONT-SIZE: 10pt"><br>
<br>
</span><span></span></p>
<p class="MsoNormal"> </p>
</div>
</div>
</div>
</div>
</body>
</html>