[FieldTrip] channel repair script

"Jörn M. Horschig" jm.horschig at donders.ru.nl
Thu Sep 20 10:09:53 CEST 2012


Hi Dmitri,

looking at your script it seems that the error occurs even right at the 
start. You said you are doing this (the very first lines that you pasted)

cfg=[];
cfg.layout = 'EEG1010.lay';
data.elec = ft_prepare_layout(cfg);
neighbours = ft_prepare_neighbours(cfg, good_data)


which means that you call ft_prepare_neighbours with a configuration 
structure which only has cfg.layout and nothing else. However, you did 
not specify a method how neighbours should be defined. If you look up 
the help from ft_prepare_neighbours, you will see what methods are 
available. Note that these are distinct from cfg.method for other 
functions. Every function has it's own cfg-settings, which are mostly 
independent from those of other functions. For example 'nearest' is not 
an method for ft_prepare_neighbours but for ft_channelrepair. Likewise, 
'mtmfft' is a method for ft_freqanalysis, but not for any other method.

I would strongly advise you to start with FieldTrip by going through our 
tutorials:
http://fieldtrip.fcdonders.nl/tutorial
This is the easiest way to get acquainted and used to the way FieldTrip 
works with cfg-and data-structures.

And then check our frequently asked questions:
http://fieldtrip.fcdonders.nl/faq
In your case, especially
http://fieldtrip.fcdonders.nl/faq/how_can_i_define_neighbouring_sensors
http://fieldtrip.fcdonders.nl/faq/how_does_ft_prepare_neighbours_work


Should you need any more assistance, feel free to ask.

Best,
Jörn


On 9/20/2012 9:54 AM, Dmitri Filimonov wrote:
> Dear Jörn,
>
> Thank you for answering, but unfortunately it doesn't work anyway. I tried
> that also. It always gives
>
> "The field cfg.method is required"
>
> I've put several possible cfg.methods = *(like cfg.method = 'mtmfft' (in
> case if program wants me to set spectra calculating parameters); or
> 'nearest' (in case of neighbour selection method). Non of this works, yet
> I am trying to deal with it now.
>
> Best wishes,
> Dmitri
>
>
>
>
>> Dear Dmitri,
>>
>> I think you are confusing things here.
>> Note that you are calling two FieldTrip functions subsequently. The
>> error message you are receiving results from ft_prepare_neighbours.
>> ft_prepare_neighbours needs a different cfg than ft_channelrepair. The
>> call you are making, does however not make much sense, because you
>> already called that function a few lines before. So just drop that
>> cfg.neighbours = ft_prepare_neighbours(...) line and replace it by
>> cfg.neighbours = neighbours. Thereby, you are removing the function call
>> that results in an error (and you already did that call), and I guess
>> everything will work fine.
>>
>> Best,
>> Jörn
>>
>> On 9/18/2012 10:00 AM, Dmitri Filimonov wrote:
>>> Dear Sir/Madam,
>>>
>>> My name is Dmitri Filimonov, I am a master student in University of
>>> Tartu
>>> (Estonia), using fieldtrip for EEG data analysis. I would like to ask
>>> some
>>> assistance with fieldtrip script.
>>> The task is to repair some EEG channels, so need to use
>>> ft_channelrepair.
>>> And I tried to do that after artifact rejection, so I could first see,
>>> which channels are noisy or disabled. I tried multiple combinations, yet
>>> there are still problems with the script.
>>> It looks like:
>>>
>>>>> channels_to_repair={'Fp1', 'Fp2'};
>>> layout_file=('C:\ fieldtrip-20120703\template\layout\EEG1010.lay');
>>>
>>> cfg=[];
>>> cfg.layout = 'EEG1010.lay';
>>> data.elec = ft_prepare_layout(cfg);
>>> neighbours = ft_prepare_neighbours(cfg, good_data)
>>> cfg = ft_checkconfig(cfg, 'required', {'method'});
>>> cfg.method = 'distance';  (or ‘nearest’)
>>> cfg.badchannel=channels_to_repair;
>>> cfg.neighbours = ft_prepare_neighbours (cfg, good_data);
>>> G_data = ft_channelrepair(cfg, dood_data);
>>> (Good_data –is a processed and filtered data, yet containing channels,
>>> which have to be repaired.)
>>> After processing the program gives me several errors:
>>>
>>> reading layout from file EEG1010.lay
>>> the call to "ft_prepare_layout" took 0 seconds and an estimated NaN MB
>>> ??? Error using ==> ft_checkconfig at 151
>>> The field cfg.method is required
>>> Error in ==> ft_prepare_neighbours at 77
>>> cfg = ft_checkconfig(cfg, 'required', {'method'});
>>>
>>> Other combinations emerge similar errors, or
>>>
>>> Error in ==> ft_neighbourselection at 30
>>> neighbours = ft_prepare_neighbours(varargin{:});
>>>
>>> Can you give me some help, what kind of ‘method’ exactly program wants
>>> me
>>> to mention (type)?
>>>
>>> Yours sincerely,
>>> Dmitri
>>>
>>>
>>>
>>> _______________________________________________
>>> 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
>>
>> Contact:
>> 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
>>
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
> _______________________________________________
> 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

Contact:
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