[FieldTrip] ft_prepare_neighbours

"Jörn M. Horschig" jm.horschig at donders.ru.nl
Thu Mar 6 11:24:43 CET 2014

Hi Beom,

did your code produce an error?

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:

cfg = [];
cfg.method        = 'triangulation';
cfg.layout        = lay;
cfg.channel       = 'all'; % that way you only need to run this once for 
*all* your subjects
cfg.feedback      = 'yes';
neighbours = ft_prepare_neighbours(cfg);

Then, if you are unhappy with the result, for modifcation you can use
cfg = [];
cfg.neighbours = neighbours;
cfg.enableedit = 'yes';
neighbours = ft_neighboursplot(cfg);

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 

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).

And finally, yes, using preprocessed data is possible.

Should you have any other questions, feel free to ask.


On 3/6/2014 2:09 AM, Beom Jun Min wrote:
> Hello
> I have a problem with channel repair.
> Firstly, I created my own layout because I cannot apply my data into 
> the offered layout files.
> 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.
> QuikCap_NSL_128 does not match either.
> Anyway, I created own customized layout, and usual preprocessing steps 
> were done.
> However, there were some bad recording channels so I removed them 
> during preprocessing.
> Moreover, the removed channels are different among the subjects, and 
> now it becomes a big problem for analyzing the data.
> So I tried channel repair process, but encountered with errors.
> >>>
> cfg = [];
> cfg.method        = 'template';
> cfg.template      = 'bj_plot.mat';
> cfg.layout        = lay;
> cfg.channel       = 'T7'; % channels for which neighbours should be found
> cfg.feedback      = 'yes';
> neighbours = ft_prepare_neighbours(cfg, data);
> >>>
> I think I have to use 'template' method because, there are some 
> missing channels serially.
> And here are my question.
> 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.
> 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.)
> Finally, at 'data' field, is it possible to assign a finalized 
> preprocessed data?
> And after ft_prepare_neighbours,
> >>>
> cfg = [];
> cfg.method         = 'spline'
> % cfg.badchannel     = 'T7';
> cfg.missingchannel = 'T7';
> cfg.neighbours     = neighbours;
> cfg.trials         = 'all'
> interpolated = ft_channelrepair(cfg, data)
> Is that right?
> -- 
> BeomJun Min, M.D.
> Department of Medical System Engineering (DMSE)
> Gwangju Institute of Science and Technology (GIST)
> 261 Cheomdan-gwagiro(Oryong-dong), Buk-gu, Gwangju
> 500-712, Republic of Korea (South)
> Phone: +82-62-715-3266 / Fax: +82-62-715-3244
> E-mail: mbj0310 at gmail.com <mailto:mbj0310 at gmail.com>, 
> http://bmssa.gist.ac.kr <http://bmssa.gist.ac.kr/>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip

Jörn M. Horschig
PhD Student
Donders Institute for Brain, Cognition and Behaviour
Centre for Cognitive Neuroimaging
Radboud University Nijmegen
Neuronal Oscillations Group
FieldTrip Development Team

P.O. Box 9101
NL-6500 HB Nijmegen
The Netherlands

E-Mail: jm.horschig at donders.ru.nl
Tel:    +31-(0)24-36-68493
Web: http://www.ru.nl/donders

Visiting address:
Trigon, room 2.30
Kapittelweg 29
NL-6525 EN Nijmegen
The Netherlands

More information about the fieldtrip mailing list