<html xmlns:v="urn:schemas-microsoft-com:vml" 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 14 (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;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";
        mso-fareast-language:EN-GB;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-GB link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Hi Steve,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I did the attached scripts a couple of years ago for a colleague, and looking at it today I can’t work out what I was doing. But I’ve tried it just now and it seems to work, but probably best to check it thoroughly yourself if you want to use it.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>The script ‘SetupGetAdjacent.m’ makes a hashtable containing all the adjacent vertices from a specified surf file (normally in your subjects directory).<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>At the bottom of this script a function is called (‘getadjacent.m’) – This function accepts the central vertex label (as a number), an integer i (a distance/’radius’ from the central vertex you are interested in, measured in vertices), and the hashtable you have just created. The function gives out a) a list of the vertices ringing the centre vertex at a radius i and b) a list of the vertices *<b>inside</b>* this ring.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>So if you ask for getadjacent(‘4756’, 1, ‘myfile.surf’) you get out:<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>adjacents =  the 6 neighbouring vertices to the central vertex<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>passed = the value of the central vertex itself<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>if you ask for getadjacent(‘4756’, 2, ‘myfile.surf’) you get:<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>adjacents  = the 12 vertices forming a ring around the central vertex at with a radius of 2 <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>passed = all the vertices inside this ring. <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>etc.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I should be clear that, unfortunately, this is not done on a downsampled, ‘morphgraded’ mesh, ie 642, 2562, 10242 vertices (if you choose ‘—morphgrade 3,4 or 5’ etc), which is what you were asking for. However, due to the way that the surf vertices are labelled, one can get an ‘adjacent’ list or a ‘passed’ list that *only* contains vertices that are in the ‘morphgraded’ mesh by simply deleting any vertices from ‘adjacents’ or ’passed’ which have a label higher than 642 (or 2562, 10242 or whatever the size of your morphgraded source mesh is). So if you did --morphgrade 5 when you did your estimation, and selected a radius of 10 for getadjacent(), then if you delete any vertices in the resulting ‘passed’ list that are greater than 10242, then you will be left with only ‘passed’ vertices you have estimation values for.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Hope this is helpful,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>a<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Stephen Politzer-Ahles [mailto:politzerahless@gmail.com] <br><b>Sent:</b> 15 May 2013 05:23<br><b>To:</b> A.C.G. Thwaites<br><b>Subject:</b> Re: [Mne_analysis] Identifying adjacent sources<o:p></o:p></span></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><div><div><p class=MsoNormal style='margin-bottom:12.0pt'>Hi Andy,<o:p></o:p></p></div><p class=MsoNormal>Thanks, I appreciate it!<o:p></o:p></p></div><div><p class=MsoNormal style='margin-bottom:12.0pt'><o:p>&nbsp;</o:p></p><div><p class=MsoNormal>On Mon, May 13, 2013 at 11:36 AM, &lt;<a href="mailto:acgt2@cam.ac.uk" target="_blank">acgt2@cam.ac.uk</a>&gt; wrote:<o:p></o:p></p><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Hi Steve – I’ve found it, but I can’t remember how it works, so I’ll send it tomorrow!</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>&nbsp;</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Andy</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>&nbsp;</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> <a href="mailto:mne_analysis-bounces@nmr.mgh.harvard.edu" target="_blank">mne_analysis-bounces@nmr.mgh.harvard.edu</a> [mailto:<a href="mailto:mne_analysis-bounces@nmr.mgh.harvard.edu" target="_blank">mne_analysis-bounces@nmr.mgh.harvard.edu</a>] <b>On Behalf Of </b>Stephen Politzer-Ahles<br><b>Sent:</b> 11 May 2013 09:02<br><b>To:</b> <a href="mailto:mne_analysis@nmr.mgh.harvard.edu" target="_blank">mne_analysis@nmr.mgh.harvard.edu</a><br><b>Subject:</b> [Mne_analysis] Identifying adjacent sources</span><o:p></o:p></p><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>&nbsp;<o:p></o:p></p><div><div><div><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;margin-bottom:12.0pt'>Hello,<o:p></o:p></p></div><p class=MsoNormal style='mso-margin-top-alt:auto;margin-bottom:12.0pt'>Is there a straighforward method to figure out, for any cortical source or vertex, what the adjacent cortical sources/vertices are? <o:p></o:p></p></div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>More specifically, I have extracted .amp timecourse files for each participant and condition that look something like this:<br>&nbsp;&nbsp;&nbsp; 100779 9.76119e-13 9.8006e-13 1.01097e-12 1.0584e-12<br>&nbsp;&nbsp;&nbsp; 102810 5.77402e-13 4.74985e-13 6.13183e-13 8.53066e-13<br>&nbsp;&nbsp;&nbsp; 103338 7.69642e-13 1.13359e-12 1.48948e-12 1.78157e-12<br>&nbsp;&nbsp;&nbsp; 103374 6.44688e-13 8.72736e-13 1.09166e-12 1.24282e-12<o:p></o:p></p></div><p class=MsoNormal style='mso-margin-top-alt:auto;margin-bottom:12.0pt'>where the first number in each row is the vertex that timecourse comes from (and the following columns are the current estimates at each timepoint). I'm interested in doing a permutation-based spatiotemporal clustering test, so what I'd like to be able to do is, for each of those vertices, to get a list of which sources are adjacent to it. (Not necessarily which vertices are adjacent to it, since my understanding is that the cortical sources represent just a subset of the vertices present in the original tesselation.) I assume that after triangulation there must be some record of this, or some way to find it out, but I can't figure out where to find it. By the way, my structural images were segmented in Freesurfer, so the triangulations are in .surf files rather than .tri files.<o:p></o:p></p></div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Any advice is greatly appreciated! Thank you,<br>Steve Politzer-Ahles<br clear=all><o:p></o:p></p><div><div><div><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><br>-- <br>Stephen Politzer-Ahles<br>University of Kansas<br>Linguistics Department<br><a href="http://people.ku.edu/~sjpa/" target="_blank">http://people.ku.edu/~sjpa/</a> <o:p></o:p></p></div></div></div></div></div></div></div></div></div></div></div><p class=MsoNormal><br><br clear=all><br>-- <br>Stephen Politzer-Ahles<br>University of Kansas<br>Linguistics Department<br><a href="http://people.ku.edu/~sjpa/" target="_blank">http://people.ku.edu/~sjpa/</a> <o:p></o:p></p></div></div></body></html>