[FieldTrip] ft_channelrepair shows no effect at all

Eelke Spaak eelke.spaak at donders.ru.nl
Tue Aug 19 09:14:44 CEST 2014


Hi Katrin,

Hmm, the MATLAB version difference points to a potential bug in the
code. Could you tell me which version it now works on, and which
version it did not work on earlier?

ICA not working on your repaired data makes sense, and the cause is in
fact pretty much what you mentioned yourself. The data in the repaired
channels are now linear combinations (i.e. weighted sums) of the data
in other channels, so the rank of your data (number of orthogonal data
vectors) is now smaller than the number of channels. In other words,
your data is rank deficient. ICA does not work properly on
rank-deficient data. There are a few solutions to this.

I would not recommend including the bad channels in the ICA. Your
second suggestion would be better: compute ICA on the data without the
bad channels, then interpolate them after backprojecting to channel
space. A third option would be to reduce the dimensionality of the ICA
input data to its 'true' dimensionality. If you specify
cfg.numcomponent = N when calling ft_componentanalysis, the data will
first undergo PCA, keeping N dimensions. In your case you would need
to set N to be maximally the number of recorded channels minus the
number of interpolated ones. This third option is probably the easiest
and best way to go.

Lastly, the fact that ICA still works if you repair the channels in
other software is possibly due to this other software applying some
form of non-linear algorithm to repair the channels. In that case the
rank of your data might not be altered.

Best,
Eelke

On 19 August 2014 00:09, KatrinH Heimann <katrinheimann at gmail.com> wrote:
> Dear Eelke,
>
> ok, so i installed an older version of matlab (which also solved some other
> problems with fieldtrip) and now it works. However I am running into another
> problem with it. Maybe you can help too:
> If I try to run the ICA after the bad channel replacement it takes hours and
> wchange just does not get lower. In my naive thinking I thought that might
> be due to the fact that the replaced channels are recognized as
> interpolations of the others??? But what could I do otherwise?: I thought
> about doing the bcr later, but that means that my ica suffers from all the
> electrode jumps from my bad channels. or I just exclude them from the ica -
> but how to proceed then: apply the reject component function on the data
> without the channels and then replace them? sorry, I am just a bit lost. The
> weirdest thing is: if I replace the channels with the help of another
> software before even processing the data, the ica works perfectly later in
> fieldtrip. WHY????
> Would be wonderful if you could give me another hand... Thanks so much in
> advance!!!
> Katrin
>
>
> 2014-08-18 10:18 GMT+02:00 Eelke Spaak <eelke.spaak at donders.ru.nl>:
>
>> Dear Katrin,
>>
>> When I look at the data you've shown me, in fact I do see an effect of
>> ft_channelrepair. I run your code:
>>
>> load ('ERP_Francesca17obs90_clean.mat')
>>
>> %% Preparing neighbours for channel repair
>>
>> cfg_neighb = [];
>> cfg_neighb.feedback = 'yes';
>> cfg_neighb.method = 'triangulation';
>> cfg_neighb.layout = 'GSN-HydroCel-129.sfp';
>> neighbours = ft_prepare_neighbours(cfg_neighb, obs90_data_clean2);
>>
>> % Interpolate and put into new data structure
>> cfg = [];
>> cfg.badchannel = {'E49', 'E68'};
>> cfg.layout = 'GSN-HydroCel-129.sfp';
>> cfg.method = 'nearest';
>> cfg.neighbours = neighbours;
>> obs90_data_channelrepaired = ft_channelrepair(cfg,obs90_data_clean2);
>>
>> followed by:
>>
>> dat1=obs90_data_clean2;
>> dat2=obs90_data_channelrepaired;
>>
>> x=dat1.trial{1}(68,:); % 68 is channel index of E68
>> y=dat2.trial{1}(68,:);
>> plot(x);hold on;plot(y,'r');
>>
>> x=dat1.trial{1}(49,:);
>> y=dat2.trial{1}(49,:);
>> figure;
>> plot(x);hold on;plot(y,'r')
>>
>> and the two figures that come up are shown in the attachments. The
>> original (blue) and channel-repaired (red) traces are clearly
>> different. These plots are for trial 1, but the same result holds when
>> I plot a different trial.
>>
>> Does it work on your end too now?
>>
>> Best,
>> Eelke
>>
>> On 14 August 2014 08:57, Eelke Spaak <eelke.spaak at donders.ru.nl> wrote:
>> > OK just checking :) In that case, could you post a small snippet of
>> > data and the actual cfg you used (including which channels to repair)
>> > on e.g. dropbox or so? Then I can have a look.
>> >
>> > Best,
>> > Eelke
>> >
>> > On 13 August 2014 22:12, KatrinH Heimann <katrinheimann at gmail.com>
>> > wrote:
>> >> Dear Eelke, yes, sure, sorry, I did that. No effect.
>> >>
>> >>
>> >> 2014-08-13 21:55 GMT+02:00 Eelke Spaak <eelke.spaak at donders.ru.nl>:
>> >>
>> >>> Dear Katrin,
>> >>>
>> >>> Have you tried putting the labels of the channels you want
>> >>> interpolated
>> >>> into the cfg.badchannel array?
>> >>>
>> >>> Best,
>> >>> Eelke
>> >>>
>> >>> Op 13 aug. 2014 19:24 schreef "KatrinH Heimann"
>> >>> <katrinheimann at gmail.com>:
>> >>>>
>> >>>> Dear all. I am trying to replace bad channels.
>> >>>> This is my code (very basic I think):%% Preparing neighbours for
>> >>>> channel
>> >>>> repair
>> >>>>
>> >>>>
>> >>>>
>> >>>> cfg_neighb          = [];
>> >>>>
>> >>>> cfg_neighb.feedback = 'yes';
>> >>>>
>> >>>> cfg_neighb.method   = 'triangulation';
>> >>>>
>> >>>> cfg_neighb.layout   = 'GSN-HydroCel-129.sfp';
>> >>>>
>> >>>> neighbours          = ft_prepare_neighbours(cfg_neighb, obs_data);
>> >>>>
>> >>>>
>> >>>>
>> >>>> % Interpolate and put into new data structure
>> >>>>
>> >>>>  cfg                      = [];
>> >>>>
>> >>>>  cfg.badchannel           = {};
>> >>>>
>> >>>>  cfg.layout               = 'GSN-HydroCel-129.sfp';
>> >>>>
>> >>>>  cfg.method               = 'nearest';
>> >>>>
>> >>>>  cfg.neighbours           = neighbours;
>> >>>>
>> >>>>  obs_data_channelrepaired       = ft_channelrepair(cfg,obs_data)
>> >>>>
>> >>>>
>> >>>> I do not get any error but fieldtrip even tells me that the
>> >>>> interpolation
>> >>>> worked. However I do not see ANY trace of it in my data when
>> >>>> inspecting it
>> >>>> afterwards. I also tried to change the method (to average) - no
>> >>>> change.
>> >>>> Anybody who can help me with that?
>> >>>> Thanks a million
>> >>>> Katrin
>> >>>>
>> >>>>
>> >>>>
>> >>>> _______________________________________________
>> >>>> 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
>> >>
>> >>
>> >>
>> >> _______________________________________________
>> >> 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
>
>
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip



More information about the fieldtrip mailing list