<div dir="ltr"><div>Alternatively, you could create a .sfp file for cfg.elecfile of the ft_channelrepair. If your channels are equidistant the equation for determining the neighbours should be fairly straightforward, as long as you have at least the phi and theta coordinates.<br>
<br>I talk about it in this thread:<br><a href="http://mailman.science.ru.nl/pipermail/fieldtrip/2013-November/007213.html">http://mailman.science.ru.nl/pipermail/fieldtrip/2013-November/007213.html</a><br><br></div>Here is the conclusion I came to: <br>
<br><pre>"For future reference, because I don't remember seeing anything on the
fieldtrip FAQ about this and it may be useful to somebody else, the
important thing is to turn the phi/theta from degrees into radians, and
then applying a trigonometric function to get the X, Y, and Z coordinates.

You can do all of these steps in 3 excel functions:

X = COS(RADIANS(Phi))*SIN(RADIANS(Theta))
Y = SIN(RADIANS(Theta))*SIN(RADIANS(Phi))
Z = =COS(RADIANS(Theta))

This link on the easycap website (
<a href="http://www.easycap.de/easycap/e/downloads/how_to_read_3d.htm">http://www.easycap.de/easycap/e/downloads/how_to_read_3d.htm</a>) explains the
coordinate system.

I then typed up the channel name, x, y, and z coordinates in a four column
notepad document saved as a .sfp file, and used that as my cfg.elecfile."
</pre>I'm not sure if this is your problem, but I didn't see a cfg.elecfile parameter in your code, so hopefully this helps.<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Mar 6, 2014 at 5:24 AM, "Jörn M. Horschig" <span dir="ltr"><<a href="mailto:jm.horschig@donders.ru.nl" target="_blank">jm.horschig@donders.ru.nl</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Beom,<br>
<br>
did your code produce an error?<br>
<br>
Generally, the 'template' method tries to look for already defined 'template' neighbours. However, as far as I understoog you only created a 'layout', which define where electrodes are placed, but not whether they are neighbours or not. I would advice you to use these settings:<br>

<br>
cfg = [];<br>
cfg.method        = 'triangulation';<br>
cfg.layout        = lay;<br>
cfg.channel       = 'all'; % that way you only need to run this once for *all* your subjects<br>
cfg.feedback      = 'yes';<br>
neighbours = ft_prepare_neighbours(cfg);<br>
<br>
Then, if you are unhappy with the result, for modifcation you can use<br>
cfg = [];<br>
cfg.neighbours = neighbours;<br>
cfg.enableedit = 'yes';<br>
neighbours = ft_neighboursplot(cfg);<br>
<br>
in that plot, you can click around to mark channels as being neighbours or not. When you are happy, save that neighbour structure and make sure to use it for all your subjects, so that there is no bias for individual subjects.<br>

<br>
Note that the data variable is used nowhere now, because that would cause missing sensors to be removed from the neighbour structure, but you probably do not want that (or if you do, then use it).<br>
<br>
And finally, yes, using preprocessed data is possible.<br>
<br>
Should you have any other questions, feel free to ask.<br>
<br>
Best,<br>
Jörn<div><div class="h5"><br>
<br>
<br>
On 3/6/2014 2:09 AM, Beom Jun Min wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
<br>
Hello<br>
<br>
I have a problem with channel repair.<br>
<br>
Firstly, I created my own layout because I cannot apply my data into the offered layout files.<br>
As far as I know, my EEG data was acquired through SynAmps 2 system with 128 electrodes, but I cannot find a suitable layout files.<br>
QuikCap_NSL_128 does not match either.<br>
<br>
Anyway, I created own customized layout, and usual preprocessing steps were done.<br>
However, there were some bad recording channels so I removed them during preprocessing.<br>
Moreover, the removed channels are different among the subjects, and now it becomes a big problem for analyzing the data.<br>
<br>
So I tried channel repair process, but encountered with errors.<br>
<br>
>>><br>
cfg = [];<br>
cfg.method        = 'template';<br>
cfg.template      = 'bj_plot.mat';<br>
cfg.layout        = lay;<br>
cfg.channel       = 'T7'; % channels for which neighbours should be found<br>
cfg.feedback      = 'yes';<br>
neighbours = ft_prepare_neighbours(cfg, data);<br>
>>><br>
<br>
I think I have to use 'template' method because, there are some missing channels serially.<br>
And here are my question.<br>
Is it possible to assign my own layout in the cfg.template or cfg.layout? Actually at this step, I do not understand how to proceed.<br>
Also, there are many missing channels differ from each subject, but I am not sure which channels should be placed in the cfg.channel. (T7 is one of the missing channel in a subject in my case.)<br>
Finally, at 'data' field, is it possible to assign a finalized preprocessed data?<br>
<br>
And after ft_prepare_neighbours,<br>
<br>
>>><br>
cfg = [];<br>
cfg.method         = 'spline'<br>
% cfg.badchannel     = 'T7';<br>
cfg.missingchannel = 'T7';<br>
cfg.neighbours     = neighbours;<br>
cfg.trials         = 'all'<br>
interpolated = ft_channelrepair(cfg, data)<br>
<br>
Is that right?<br>
<br>
<br>
-- <br>
BeomJun Min, M.D.<br>
<br>
Department of Medical System Engineering (DMSE)<br>
Gwangju Institute of Science and Technology (GIST)<br>
261 Cheomdan-gwagiro(Oryong-dong), Buk-gu, Gwangju<br>
500-712, Republic of Korea (South)<br>
Phone: <a href="tel:%2B82-62-715-3266" value="+82627153266" target="_blank">+82-62-715-3266</a> / Fax: <a href="tel:%2B82-62-715-3244" value="+82627153244" target="_blank">+82-62-715-3244</a><br></div></div>
E-mail: <a href="mailto:mbj0310@gmail.com" target="_blank">mbj0310@gmail.com</a> <mailto:<a href="mailto:mbj0310@gmail.com" target="_blank">mbj0310@gmail.com</a>>, <a href="http://bmssa.gist.ac.kr" target="_blank">http://bmssa.gist.ac.kr</a> <<a href="http://bmssa.gist.ac.kr/" target="_blank">http://bmssa.gist.ac.kr/</a>><br>

<br>
<br>
______________________________<u></u>_________________<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/<u></u>mailman/listinfo/fieldtrip</a><br>
</blockquote>
<br>
<br>
-- <br>
Jörn M. Horschig<br>
PhD Student<br>
Donders Institute for Brain, Cognition and Behaviour<br>
Centre for Cognitive Neuroimaging<br>
Radboud University Nijmegen<br>
Neuronal Oscillations Group<br>
FieldTrip Development Team<br>
<br>
P.O. Box 9101<br>
NL-6500 HB Nijmegen<br>
The Netherlands<br>
<br>
Contact:<br>
E-Mail: <a href="mailto:jm.horschig@donders.ru.nl" target="_blank">jm.horschig@donders.ru.nl</a><br>
Tel:    <a href="tel:%2B31-%280%2924-36-68493" value="+31243668493" target="_blank">+31-(0)24-36-68493</a><br>
Web: <a href="http://www.ru.nl/donders" target="_blank">http://www.ru.nl/donders</a><br>
<br>
Visiting address:<br>
Trigon, room 2.30<br>
Kapittelweg 29<br>
NL-6525 EN Nijmegen<br>
The Netherlands<br>
<br>
______________________________<u></u>_________________<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/<u></u>mailman/listinfo/fieldtrip</a><br>
</blockquote></div><br></div>