Back to the main page.

Bug 491 - ft_channelrepair - mismatch in fixed channels

Status CLOSED FIXED
Reported 2011-02-12 16:41:00 +0100
Modified 2011-03-31 14:13:55 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P1 normal
Assigned to: Jörn M. Horschig
URL:
Tags:
Depends on:
Blocks:
See also:

Yossi Arzouan - 2011-02-12 16:41:55 +0100

When the data.label and sens.label are not of the same length, shouldn’t the line : repair(k,l) = 1/distance; be replaced by : l1 = match_str(data.label, sens.label{l}); repair(k,l1) = 1/distance; Other wish I think there is a mismatch of the fixed channels. Running the attached script show the problem, the two figures are not identical. If one then fix these two lines in the ft_channelrepair.m file and run the script again the two plots figures will be similar. % a testing script : load testBadChns % ploting MEG chns channelSelection = ft_channelselection('MEG', data.hdr.label); [selectedChnsLabel, selectedChnsIndx, tmp] = intersect(data.label, channelSelection) figure; plot(data.trial{1}(selectedChnsIndx,:)') title(' from A chns') % the bad chns are (A204 A74) cfgTmp = []; % set the default configuration cfgTmp.neighbourdist = 4; cfgTmp.trials = 'all'; cfgTmp.inputfile = []; cfgTmp.outputfile = []; cfgTmp.badchannel = {'A204';'A74'} [goodchanlabels, goodchanindcs] = setdiff(data.label,cfgTmp.badchannel); channelSelection1 = ft_channelselection('MEG', goodchanlabels); [selectedChnsLabel1, selectedChnsIndx1, tmp] = intersect(data.label, channelSelection1); figure; plot(data.trial{1}(selectedChnsIndx1,:)') title(' from A chns - manualy excluding bad chns (A204 A74)') % using ft_channelrepair to fix teh bad chns [interp] = ft_channelrepair(cfgTmp, data) ; channelSelection = ft_channelselection('MEG', data.label); [selectedChnsLabel, selectedChnsIndx, tmp] = intersect(data.label, channelSelection) figure; plot(interp.trial{1}(selectedChnsIndx,:)') title(' from A chns - after fixing bad chns with channelrepair') replace the line : repair(k,l) = 1/distance; by : l1 = match_str(data.label, sens.label{l}); repair(k,l1) = 1/distance; and rerun the script again Best Wishes Yossi


Jörn M. Horschig - 2011-03-09 12:12:03 +0100

I cannot really reproduce the error you have, but given that repair is a matrix of size [Nchans x Nchans] and that the scalar 'l' is an index of the sensor and not of the channels, your proposed fix makes sense. As a note, I guess you are aware that repairchannel does only interpolate missing channels, meaning that removing a channel and repairing it will result in a different time-course than it had originally. Apart from that, this double-looping is extremely inefficient, but that's for another time. The fix will be included in the FTP FieldTrip version coming out tonight, or in the SVN version from this moment onwards.


Robert Oostenveld - 2011-03-31 14:13:55 +0200

changed the status of most recently resolved/fixed bugs into "CLOSED"