<div dir="ltr">Hi there,<div><br></div><div>I am following the protocol (<a href="http://www.fieldtriptoolbox.org/tutorial/human_ecog/#anatomical-workflow">http://www.fieldtriptoolbox.org/tutorial/human_ecog/#anatomical-workflow</a>) here and intending to plot subcortical segmentation along with the brain surface mesh. </div><div><br></div><div>However, I am noticing that when I convert the subcortical volume into a mesh using the code below, the mesh seems to be in a different coordinate space than the native freesurfer space, such that my electrodes and lh.pial rendering don't line up with the subcortical mesh. </div><div><br></div><div>Would anyone be able to advise why this is happening?</div><div><br></div><div>Best,</div><div>Danny</div><div>Stanford University</div><div><br></div><div><pre class="gmail-highlight" style="box-sizing:border-box;font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:13.2px;margin-top:0px;margin-bottom:0px;overflow:auto;color:rgb(33,37,41);background:rgb(240,240,240)"><code style="box-sizing:border-box;font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:inherit;color:inherit;word-break:normal"><span class="gmail-n" style="box-sizing:border-box">seg</span> <span class="gmail-o" style="box-sizing:border-box;color:rgb(102,102,102)">=</span> <span class="gmail-n" style="box-sizing:border-box">keepfields</span><span class="gmail-p" style="box-sizing:border-box">(</span><span class="gmail-n" style="box-sizing:border-box">atlas</span><span class="gmail-p" style="box-sizing:border-box">,</span> <span class="gmail-p" style="box-sizing:border-box">{</span><span class="gmail-s1" style="box-sizing:border-box;color:rgb(64,112,160)">'dim'</span><span class="gmail-p" style="box-sizing:border-box">,</span> <span class="gmail-s1" style="box-sizing:border-box;color:rgb(64,112,160)">'unit'</span><span class="gmail-p" style="box-sizing:border-box">,</span><span class="gmail-s1" style="box-sizing:border-box;color:rgb(64,112,160)">'coordsys'</span><span class="gmail-p" style="box-sizing:border-box">,</span><span class="gmail-s1" style="box-sizing:border-box;color:rgb(64,112,160)">'transform'</span><span class="gmail-p" style="box-sizing:border-box">});</span>
<span class="gmail-n" style="box-sizing:border-box">seg</span><span class="gmail-o" style="box-sizing:border-box;color:rgb(102,102,102)">.</span><span class="gmail-n" style="box-sizing:border-box">brain</span> <span class="gmail-o" style="box-sizing:border-box;color:rgb(102,102,102)">=</span> <span class="gmail-n" style="box-sizing:border-box">mask_rha</span><span class="gmail-p" style="box-sizing:border-box">;</span>
<span class="gmail-n" style="box-sizing:border-box">cfg</span>             <span class="gmail-o" style="box-sizing:border-box;color:rgb(102,102,102)">=</span> <span class="gmail-p" style="box-sizing:border-box">[];</span>
<span class="gmail-n" style="box-sizing:border-box">cfg</span><span class="gmail-o" style="box-sizing:border-box;color:rgb(102,102,102)">.</span><span class="gmail-n" style="box-sizing:border-box">method</span>      <span class="gmail-o" style="box-sizing:border-box;color:rgb(102,102,102)">=</span> <span class="gmail-s1" style="box-sizing:border-box;color:rgb(64,112,160)">'iso2mesh'</span><span class="gmail-p" style="box-sizing:border-box">;</span>
<span class="gmail-n" style="box-sizing:border-box">cfg</span><span class="gmail-o" style="box-sizing:border-box;color:rgb(102,102,102)">.</span><span class="gmail-n" style="box-sizing:border-box">radbound</span>    <span class="gmail-o" style="box-sizing:border-box;color:rgb(102,102,102)">=</span> <span class="gmail-mi" style="box-sizing:border-box;color:rgb(64,160,112)">2</span><span class="gmail-p" style="box-sizing:border-box">;</span>
<span class="gmail-n" style="box-sizing:border-box">cfg</span><span class="gmail-o" style="box-sizing:border-box;color:rgb(102,102,102)">.</span><span class="gmail-n" style="box-sizing:border-box">maxsurf</span>     <span class="gmail-o" style="box-sizing:border-box;color:rgb(102,102,102)">=</span> <span class="gmail-mi" style="box-sizing:border-box;color:rgb(64,160,112)">0</span><span class="gmail-p" style="box-sizing:border-box">;</span>
<span class="gmail-n" style="box-sizing:border-box">cfg</span><span class="gmail-o" style="box-sizing:border-box;color:rgb(102,102,102)">.</span><span class="gmail-n" style="box-sizing:border-box">tissue</span>      <span class="gmail-o" style="box-sizing:border-box;color:rgb(102,102,102)">=</span> <span class="gmail-s1" style="box-sizing:border-box;color:rgb(64,112,160)">'brain'</span><span class="gmail-p" style="box-sizing:border-box">;</span>
<span class="gmail-n" style="box-sizing:border-box">cfg</span><span class="gmail-o" style="box-sizing:border-box;color:rgb(102,102,102)">.</span><span class="gmail-n" style="box-sizing:border-box">numvertices</span> <span class="gmail-o" style="box-sizing:border-box;color:rgb(102,102,102)">=</span> <span class="gmail-mi" style="box-sizing:border-box;color:rgb(64,160,112)">1000</span><span class="gmail-p" style="box-sizing:border-box">;</span>
<span class="gmail-n" style="box-sizing:border-box">cfg</span><span class="gmail-o" style="box-sizing:border-box;color:rgb(102,102,102)">.</span><span class="gmail-n" style="box-sizing:border-box">smooth</span>      <span class="gmail-o" style="box-sizing:border-box;color:rgb(102,102,102)">=</span> <span class="gmail-mi" style="box-sizing:border-box;color:rgb(64,160,112)">3</span><span class="gmail-p" style="box-sizing:border-box">;</span>
<span class="gmail-n" style="box-sizing:border-box">cfg</span><span class="gmail-o" style="box-sizing:border-box;color:rgb(102,102,102)">.</span><span class="gmail-n" style="box-sizing:border-box">spmversion</span>  <span class="gmail-o" style="box-sizing:border-box;color:rgb(102,102,102)">=</span> <span class="gmail-s1" style="box-sizing:border-box;color:rgb(64,112,160)">'spm12'</span><span class="gmail-p" style="box-sizing:border-box">;</span>
<span class="gmail-n" style="box-sizing:border-box">mesh_rha</span> <span class="gmail-o" style="box-sizing:border-box;color:rgb(102,102,102)">=</span> <span class="gmail-n" style="box-sizing:border-box">ft_prepare_mesh</span><span class="gmail-p" style="box-sizing:border-box">(</span><span class="gmail-n" style="box-sizing:border-box">cfg</span><span class="gmail-p" style="box-sizing:border-box">,</span> <span class="gmail-n" style="box-sizing:border-box">seg</span><span class="gmail-p" style="box-sizing:border-box">);</span></code></pre></div></div>