[FieldTrip] channel order changes after ft_channelrepair

Frédéric Roux f.roux at bcbl.eu
Tue Mar 10 15:05:18 CET 2015

Dear all,

I just noted that after calling ft_channelrepair
the order of channel labels in my Neuromag 306 data has changed.

The code I am using is as follows (fieldtrip-20150115):

% get the labels from the reference layout
cfg = [];
cfg.layout = 'neuromag306planar.lay';

[ref_lay] = ft_prepare_layout(cfg);

% eliminate COMNT and SCALE labels
ref_lay.label = ref_lay.label(1:204);

% get the labels of channels present in the data
orig_label = meg_data.label;

% compare labels from reference layout with original data
idx = zeros(length(ref_lay.label),1);
for it = 1:length(ref_lay.label)
   idx(it) = any(strcmp(ref_lay.label(it),orig_label));

% load the template neighbourhood structure from fieldtrip

cfg = [];
cfg.neighbours = neighbours;
cfg.missingchannel = find(idx==0);
cfg.method = 'spline';

[meg_data] = ft_channelrepair(cfg,meg_data);

When I then look at meg_data.label I can see
that the missing channels were added at the
end of the channel label list instead of
being integrated in the list at the position where they
would be found in the channel list of the template layout.

For instance

meg_data.label(end) = 'MEG1133';


ref_lay.label(end) = 'MEG2643';

Does anyone know why this happens and how this can be avoided or
compensated? I am guessing that later on in the analysis pipeline
this can become problematic as the mapping between the new labels
and the spatial coordinates does not correspond anymore.

Any help or suggestions would be highly appreciated!


Frédéric Roux
Postdoctoral Scientist
f.roux at bcbl.eu
Tel: +34 943 309 300 Ext 211
Fax: +34 943 309 052

Legal disclaimer/Aviso legal/Lege-oharra: www.bcbl.eu/legal-disclaimer

More information about the fieldtrip mailing list