Back to the main page.

Bug 941 - ft_channelrepair doesn't reconstruct channel well

Status CLOSED FIXED
Reported 2011-09-07 12:49:00 +0200
Modified 2011-09-14 14:33:50 +0200
Product: FieldTrip
Component: preproc
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P1 normal
Assigned to: Jörn M. Horschig
URL:
Tags:
Depends on:
Blocks:
See also:

Anne van Hoogmoed - 2011-09-07 12:49:11 +0200

I've tried to use ft_channelrepair to reconstruct a channel (channel 25). However, if I plot the results, the values of the repaired channel do not lie within the range of the values of the neighbours used to reconstruct the channel. Shouldn't that be the case? I've used the following script: data_eeg_clean.elec = elec_new; cfg = []; cfg.badchannel = {'25'}; cfg.neighbours = neighbours; data_eeg_repaired = ft_channelrepair(cfg,data_eeg_clean); cfg = []; cfg.channel = {'19','20','24','25','26'}; ft_databrowser(cfg, data_eeg_clean);


Anne van Hoogmoed - 2011-09-07 12:52:22 +0200

Created attachment 130 data


Robert Oostenveld - 2011-09-07 12:55:21 +0200

Thanks for the data. Someone will look at it soon. A test script should be made that demonstrates the problem. I have already copied the data to /home/common/.../data/test/bug941.mat


Jörn M. Horschig - 2011-09-12 12:39:37 +0200

Hey Anne, The fixed function should be on /home/common/ within a few minutes. The problem was caused by the default behaviour of the Matlab function 'setdiff'. This function sorts it's input alphabetically, leading to a different order for channels in the function than they are ordered in the data. Since your channels are called something like '1', '2', (...) '10', '11', (...), setdiff set the order to '1', '10', '11', (...), '2', '20', (...). Thus, the sensor indices did not match anymore and so the sensors taken for averaging were completely wrong. I fixed this by sorting the indices that setdiff returns numerically - so that the output is consistent again with the labeling in the data. @Robert: This behaviour might have caused wrong interpolation for others that use channelrepair, should we tell people(==mailing list) that there was a bug in this function?


Robert Oostenveld - 2011-09-12 13:12:15 +0200

(In reply to comment #3) > @Robert: This behaviour might have caused wrong interpolation for others that > use channelrepair, should we tell people(==mailing list) that there was a bug > in this function? Yes, good idea.


Robert Oostenveld - 2011-09-14 14:33:50 +0200

I closed all the bugs that were in the status RESOLVED. This includes the ones that we just discussed in the weekly fieldtrip meeting, but also the bugs that we did not discuss.