<p>Hi Jarang,</p>
<p>Thanks for the code!</p>
<p>I'm happy I could help you!</p>
<p>Best,</p>
<p>Hanneke</p>
<div class="gmail_quote">Op 27 jun. 2012 13:00 schreef "Jarang Hahm" <<a href="mailto:jarang.hahm@gmail.com">jarang.hahm@gmail.com</a>> het volgende:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Dear Hanneke,<div><br></div><div><br></div><div>Thanks to you, I properly found neighbours. :-)</div><div><br></div><div>And I confirmed it by plotting the neighbours. To do this, I modified a code 'ft_plotneighbours' for correcting a mismatch between the channel position and label.</div>
<div><br></div><div>You also probably need this code, so I have attatched what I modified. :-)</div><div><br></div><div><br></div><div>Thanks!</div><div><br></div><div><br></div><div>Best,</div><div><br></div><div><br></div>
<div>Jarang Hahm</div><div><br><br>
<div class="gmail_quote">On Mon, Jun 25, 2012 at 6:01 PM, Hanneke van Dijk <span dir="ltr"><<a href="mailto:Hanneke.vanDijk@med.uni-duesseldorf.de" target="_blank">Hanneke.vanDijk@med.uni-duesseldorf.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear Jarang,<div><br></div><div>Coincidentily I have been working on the same problem a few weeks ago. </div><div><br>
</div>
<div>First of all you should take care that you repair a horizontal gradiometer with neighbouring horizontal gradiometers and vertical ones with vertical ones. This is not built into fieldtrip yet.</div>
<div><br></div><div>I have have made a partial fix, which works with the 'layout' option but not with the 'grad' method. I have attached the function I addapted from Fieldtrip, and the layout files that seperatly name the different gradiometers (made by Elisabeth May ;-) )</div>
<div><br></div><div>I hope it somehow helps you!</div><div><br></div><div>Best regards,</div><div><br></div><div>Hanneke van Dijk</div><div><br></div><div>________________________________________________________________</div>
<div><p class="MsoNormal"><span style="font-size:12px"><br></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt">Hanneke van Dijk, PhD</span></p>
<p class="MsoNormal"><a href="http://www.uniklinik-duesseldorf.de/deutsch/unternehmen/institute/KlinNeurowiss/Team/HannekevanDijk/page.html" target="_blank"><span lang="DE" style="font-size:9.0pt;color:blue">http://www.uniklinik-duesseldorf.de/deutsch/unternehmen/institute/KlinNeurowiss/Team/HannekevanDijk/page.html</span></a><span style="font-size:9.0pt"></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt">Institute for Clinical Neuroscience,</span></p>
<p class="MsoNormal"><span style="font-size:9.0pt">Heinrich Heine Universit</span><span lang="DE" style="font-size:9.0pt">ä</span><span style="font-size:9.0pt">t D</span><span lang="DE" style="font-size:9.0pt">ü</span><span style="font-size:9.0pt">sseldorf,
Germany</span></p>
<p class="MsoNormal"><a href="mailto:Hanneke.vanDijk@med.uni-duesseldorf.de" target="_blank"><span style="font-size:9.0pt">Hanneke.vanDijk@med.uni-duesseldorf.de</span></a><span style="font-size:9.0pt"></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt">Tel. <a href="tel:%2B49%20%280%29%20211%2081%2013074" value="+492118113074" target="_blank">+49 (0) 211 81 13074</a> </span></p>
<p class="MsoNormal"><span style="font-size:9.0pt">__________________________________________ </span></p><br><div class="gmail_quote"><div><div>On Mon, Jun 25, 2012 at 4:57 AM, Jarang Hahm <span dir="ltr"><<a href="mailto:jarang.hahm@gmail.com" target="_blank">jarang.hahm@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>Dear FieldTrip user.<div><br></div><div><br></div><div><br></div><div><div>Hi, I'm processing MEG data of Neuromag 306 system after removing some bad channels using fieldtrip-20120620 toolbox.</div>
<div><br></div><div>
<br>
</div><div><br></div><div>To repair the bad channels with its neighbours, I firstly found the neighbor of all channel based on distance using 'ft_prepare_neighbours'.</div><div><br></div><div>However, the outcome of neighbour was far more than default distance, 4cm, from a target channel.</div>
<div><br></div><div>So, I checked thoroughly the code 'ft_prepare_neighbours', finding it used information of channel label and position from data’s hdr.grad to find neighbour of the target.</div><div><br></div><div>
<br></div><div><br></div><div>The problem is channel label and position in hdr.grad are arranged differently.</div><div><br></div><div>As far as I found, both information come from different source: the channel label was from code 'fiff_read_meas_info', while the channel position was from ‘channelposition’ in 'ft_datatype_sens'. </div>
<div><br></div><div>And the channel label is sorted into the sensor location, e. g. MEG 0113, MEG 0112, MEG 0111, MEG 0122, etc, however, the channel position is arranged along the sensor type (magnetometer and gradiometer) according to its ending number (1, 2, or 3), e.g. MEG 0111, MEG 0121, MEG 0131, ...., MEG 0112, MEG 0122, MEG 0132, ...MEG 0113, MEG 0123, MEG 0133, etc.</div>
<div><br></div><div>Thus, the label and position of channel in hdr.grad were mismatched so that we got somewhat weired neighbour after using 'ft_prepare_neighbours'.</div><div><br></div><div><br></div><div>It should be matched correctly to find the proper neighbour and ensure the result of repair as well.</div>
<div><br></div><div>In fact, the code 'channelposition' in 'ft_datatype_sens' yield the channel label as well as the channel position. It might help to solve this problem. </div><div><br></div><div><br></div>
<div><br></div><div>Is there any other way to solve this problem?</div><div><br></div><div><br></div><div><br></div><div><br></div><div>Best,</div><div><br></div>
<div><br>Jarang Hahm</div><div><br></div><br>
</div>
<br></div></div>_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br></blockquote></div><br></div>
<br>_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div>함자랑 드림.<br>
</div>
<div><br>Jarang Hahm</div>
<div><br>Interdisciplinary Program in Cognitive Science<br>Seoul National University</div><div>Seoul, Korea, Republic of.<br><a href="tel:%2B82-10-9079-3121" value="+821090793121" target="_blank">+82-10-9079-3121</a></div>
<br>
</div>
<br>_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br></blockquote></div>