<div dir="ltr">Iman, let's clarify further: are you asking how to compute the <b>geodesic distance</b> between two vertices on a mesh? i.e. you have a scalp mesh segmented from a subject's MRI using Freesurfer or NFT or whatever, and you want to know the distance between two vertices along the mesh, each of which is the nearest point on the mesh to a given electrode location? <div>




<br></div><div>Obviously elec_distance.m will not do this. But if this is your question, you can find plenty of Matlab programs and tutorials for computing geodesic distance on a mesh by googling "matlab geodesic distance mesh." Also, a 2-sec google search revealed that Freesurfer's mris_pmake() function will return the inter-vertex distance on a mesh (tho' not exactly geodesic distance) using Djikstra's algorithm: <a href="https://mail.nmr.mgh.harvard.edu/pipermail//freesurfer/2011-April/017978.html." target="_blank">https://mail.nmr.mgh.harvard.edu/pipermail//freesurfer/2011-April/017978.html.</a> (Ironically, this was also a question that was re-posted several times there). EEGLAB or NFT may have a function for this as well, but I don't recall specifically.<div>




<div><div><br></div><div>You stated <span style="color:rgb(31,73,125);font-family:Calibri,sans-serif;font-size:15px;text-align:justify">"there is +/- 4 cm difference between using spherical model and real head on average". </span> There is a 4 cm difference in what? Co-registered electrode locations? Inter-electrode distance? If the latter, how are you calculating distance (given that this is the topic of your post)? And of course, warped electrode locations (and thus electrode distance) may be fairly different if you warp to a spherical model versus an MNI head model versus using an individual subject's head model.</div>




<div><br></div><div>It seems like there are at least two separate issues here and it's not clear which you're asking about: (1) how to best localize/co-register each electrode to it's nearest point on the scalp surface (i.e. vertices of a suitable scalp mesh) or (2) how best to measure/approximate the distance between two points on the scalp (i.e. mesh geodesic distance, shortest path length (Dijkstra's algorithm), radial distance, euclidean distance, etc).</div>




<div><br></div><div>Other important factors: are your electrode locations digitized (e.g. using a Polhemus digitizer) and co-registered to the individual subject head model? Or are you assuming standard 10-5 (or whatever) locations and either aligning/warping the electrode locations to the head model (e.g. EEGLAB's coregister.m) or warping the head model to the electrode locations (e.g. NFT's <span style="line-height:1.1em;background-color:rgb(249,249,249)">warping_main_function.m</span>)? If you don't have digitized locations you may easily have >>4 cm of error between assumed and true electrode locations, which will propagate into any distance measurements, irregardless of the distance metric you use.</div>




</div><div><span style="color:rgb(31,73,125);font-family:Calibri,sans-serif;font-size:15px;text-align:justify"><br></span></div><div>Tim</div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Tue, Dec 18, 2012 at 1:25 AM, Iman M.Rezazadeh <span dir="ltr"><<a href="mailto:irezazadeh@ucdavis.edu" target="_blank">irezazadeh@ucdavis.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">




<div lang="EN-US" link="blue" vlink="purple"><div><p><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Thanks Tim for your response ! and your two cents: ) <u></u><u></u></span></p>


<p style="text-align:justify"><u></u><span style="font-size:11pt;font-family:Symbol;color:rgb(31,73,125)"><span>·<span style="font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;font-family:'Times New Roman'">        </span></span></span><u></u><span dir="LTR"></span><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Ok let me be clear. If we have electrode location file and fit anatomical head model ( not spherical ) the results will different . So, my question is “ <span style="background-color:yellow">Is there ANY ANATOLICAL MODEL based on the electrode locations/labels that can help us to measure the inter-electrode distance?”</span> I have done a test over 3 different individual scalp and there is +/- 4 cm difference between using spherical model and real head on average.<u></u><u></u></span></p>




<p style="text-align:justify"><u></u><span style="font-size:11pt;font-family:Symbol;color:rgb(31,73,125)"><span>·<span style="font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;font-family:'Times New Roman'">        </span></span></span><u></u><span dir="LTR"></span><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"> <u></u><u></u></span></p>




<p><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Best,<u></u><u></u></span></p><p><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Iman<u></u><u></u></span></p>




<p><b><span style="font-size:10pt;font-family:Tahoma,sans-serif">From:</span></b><span style="font-size:10pt;font-family:Tahoma,sans-serif"> Tim Mullen [mailto:<a href="mailto:mullen.tim@gmail.com" target="_blank">mullen.tim@gmail.com</a>] <br>




<b>Sent:</b> Tuesday, December 18, 2012 1:04 AM<br><b>To:</b> Iman M.Rezazadeh<br><b>Cc:</b> Makoto Miyakoshi; UCSD EEG List<br><b>Subject:</b> Re: Inter-Electrode Distance<u></u><u></u></span></p><div><div><p>

<u></u> <u></u></p><div><p>No worries, Iman -- just my two cents :) The email mailing list format is also not the easiest format to search and follow up on old posts. But I do think it helps reduce everyone's inbox clutter (and likely ensures you get a faster/better response) if new posts make clear how the given problem is not addressed by previously posted solutions.<u></u><u></u></p>




<div><p><u></u> <u></u></p></div><div><p>In the 2010 thread Arno describes a solution for the electrode distance on the scalp assuming a spherical head model, and this is implemented in the function elec_distance.m, which you referred to. Asking "does <span style="font-size:10pt;font-family:Arial,sans-serif;color:rgb(80,0,80)">elec_distance.m</span> work properly?" is something you can probably quickly answer yourself :) Do you have reason to think this function is not working properly? Is this not the solution you were hoping for? The more specific and clear your question, the more help can be provided by the community.<u></u><u></u></p>




</div><div><p><u></u> <u></u></p><div><p>Tim<u></u><u></u></p></div></div><div><p style="margin-bottom:12pt"><u></u> <u></u></p><div><p>On Mon, Dec 17, 2012 at 4:51 PM, Iman M.Rezazadeh <<a href="mailto:irezazadeh@ucdavis.edu" target="_blank">irezazadeh@ucdavis.edu</a>> wrote:<u></u><u></u></p>




<div><div><p><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Tim, I have   searched the forum and if you look at my email you can see that I mentioned the function name as well. Also what Steve pointed at is sth different ! </span><u></u><u></u></p>




<p><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Anyhow, thanks for the reminder for reading the archives and internet search </span><span style="font-size:11pt;font-family:Wingdings;color:rgb(31,73,125)">J</span><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">  and I would add reading more carefully the emails </span><span style="font-size:11pt;font-family:Wingdings;color:rgb(31,73,125)">J</span><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"> </span><u></u><u></u></p>




<p><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Iman</span><u></u><u></u></p><p><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"> </span><u></u><u></u></p>




<p><b><span style="font-size:10pt;font-family:Tahoma,sans-serif">From:</span></b><span style="font-size:10pt;font-family:Tahoma,sans-serif"> Tim Mullen [mailto:<a href="mailto:mullen.tim@gmail.com" target="_blank">mullen.tim@gmail.com</a>] <br>




<b>Sent:</b> Monday, December 17, 2012 4:18 PM<br><b>To:</b> Makoto Miyakoshi<br><b>Cc:</b> Iman M.Rezazadeh; UCSD EEG List<br><b>Subject:</b> Re: Inter-Electrode Distance</span><u></u><u></u></p><div><div><p>

 <u></u><u></u></p><p>Iman, a general rule of forums and mailing lists (such as EEGLAB) is to first search the forum/list archives for a solution. In this case, the question has been addressed at least once before: i.e. search for 'inter-electrode distance' in the subject lines for 2010 -- <a href="http://sccn.ucsd.edu/pipermail/eeglablist/2010/subject.html" target="_blank">http://sccn.ucsd.edu/pipermail/eeglablist/2010/subject.html</a>. If you can't find a solution in the archives (or after a little internet searching), then by all means post to the list :)<u></u><u></u></p>




<div><p> <u></u><u></u></p></div><div><p>Also, I just saw that Steve noted this topic came up a few days ago on the list...<u></u><u></u></p></div><div><p> <u></u><u></u></p>

</div><div><p>Tim<u></u><u></u></p></div><div><p style="margin-bottom:12pt"> <u></u><u></u></p><div><p>On Mon, Dec 17, 2012 at 3:54 PM, Makoto Miyakoshi <<a href="mailto:mmiyakoshi@ucsd.edu" target="_blank">mmiyakoshi@ucsd.edu</a>> wrote:<u></u><u></u></p>




<p>Dear Iman,<u></u><u></u></p><div><p> <u></u><u></u></p></div><div><p>Why don't you try it first since the function is already there :-)<u></u><u></u></p></div>
<div>
<p> <u></u><u></u></p></div><div><p>Makoto<u></u><u></u></p></div><div><p> <u></u><u></u></p><div><p>2012/12/17 Iman M.Rezazadeh <<a href="mailto:irezazadeh@ucdavis.edu" target="_blank">irezazadeh@ucdavis.edu</a>><u></u><u></u></p>




<div><div><blockquote style="border-style:none none none solid;border-left-color:rgb(204,204,204);border-left-width:1pt;padding:0in 0in 0in 6pt;margin:5pt 0in 5pt 4.8pt"><p> <u></u><u></u></p><div><div>

<p>Hi,<u></u><u></u></p><p>Could you please let me know how can I measure the inter-electrode distance on the head surface? Does elec_distance.m woeks properly? <u></u><u></u></p><p>

 <u></u><u></u></p><p><span style="font-family:Arial,sans-serif">Iman M.Rezazadeh, PhD</span><u></u><u></u></p><p><span style="font-family:Arial,sans-serif">Postdoctoral Research Fellow</span><u></u><u></u></p>


<p><span style="font-family:Arial,sans-serif">Center for Mind and Brain</span><u></u><u></u></p><p><span style="font-family:Arial,sans-serif">University of California, Davis</span><u></u><u></u></p>

<p><span style="font-family:Arial,sans-serif"><a href="mailto:irezazadeh@ucdavis.edu" target="_blank">irezazadeh@ucdavis.edu</a></span><u></u><u></u></p><p><span style="font-family:Arial,sans-serif">Cell:<a href="tel:310-490-1808" target="_blank">310-490-1808</a></span><u></u><u></u></p>




<p><span style="font-family:Arial,sans-serif">Skype: Imanmr</span><u></u><u></u></p><p> <u></u><u></u></p></div></div></blockquote></div></div></div><p>

<span style="color:rgb(136,136,136)"><br><br clear="all"></span><u></u><u></u></p><div><p> <u></u><u></u></p></div><p style="margin-bottom:12pt"><span style="color:rgb(136,136,136)">-- <br>Makoto Miyakoshi<br>


JSPS Postdoctral Fellow for Research Abroad<br>Swartz Center for Computational Neuroscience<br>Institute for Neural Computation, University of California San Diego</span><u></u><u></u></p></div></div><p>

<br><br clear="all"><u></u><u></u></p><div><p> <u></u><u></u></p></div><p>-- <br>---------  αντίληψη -----------<u></u><u></u></p></div></div></div></div></div></div><p>

<br><br clear="all"><u></u><u></u></p><div><p><u></u> <u></u></p></div><p>-- <br>---------  αντίληψη -----------<u></u><u></u></p></div></div></div></div></div></div></blockquote></div>

<br><br clear="all"><div><br></div>-- <br>---------  αντίληψη -----------<br>
</div></div>