[FieldTrip] ft_channelrepair issue

Schoffelen, J.M. (Jan Mathijs) janmathijs.schoffelen at donders.ru.nl
Fri Mar 25 08:17:55 CET 2022


Hi Arkadij,

Errors are often the result of an interaction between the cfg and the data. The cfg in principle looks good, so I suspect an issue with the data in relation to the cfg.

As you mention yourself, only the ‘average’ method works for you. This is because - as is mentioned in the help documentation of the function - your data most likely lacks an ‘elec’ field (and you don’t have one specified correctly in the cfg).

The sensor description (for EEG data this is called ‘elec’) contains the sensor positions in 3D, and this information is needed for the more ‘advanced’ repair methods.

A ‘layout’ is used for plotting, and this contains a set of positions of the electrodes projected onto the (2D) plane.

So, long story short, I’d recommend you to stick with the ‘average’ method.

Best wishes,
Jan-Mathijs




On 24 Mar 2022, at 20:16, Arkadiy Lobov via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:

Hello,

My name is Arkadij, and I am a research assistant in SELab, the University of Essex in the UK. Currently, I am learning how to pre-process and analyse EEG data.

I am having a problem trying to repair a bad channel. The only method I can use from ft_channelrepair is "average". The other options (weighted, spline, slap) lead to an error. So please check the script and an error message:

if rd.repchan(s)
            cfg =[];
            cfg.channel = {'all', '-VEOG', '-HEOG','-ECG'};
            cfg.method = 'distance';
            cfg.layout = customlay;
            neighbours = ft_prepare_neighbours(cfg, data);
            cfg =[];
            cfg.neighbours = neighbours;
            cfg.method = 'weighted';
            cfg.elec = 'easycap_custom.mat';
            cfg.senstype = 'eeg';
            cfg.trials = 'all';
            if strcmp (rd.subj,'8'), cfg.neighbours(1).label = 'C2';  cfg.neighbours(1).neighblabel = {'FC2', 'C4','CP2','Cz'}; cfg.badchannel = {'C2'}; end
            data = ft_channelrepair(cfg, data);
        end

Unable to perform assignment because the size of the left side is 64-by-3 and the size of the right side is 64-by-2.

Error in ft_datatype_sens (line 454)
        sens.chanpos(selsens,:) = chanpos(selpos,:);

Error in ft_datatype_sens (line 240)
    sens      = ft_datatype_sens(sens, new_argin{:});

Error in ft_datatype_sens (line 207)
    sens      = ft_datatype_sens(sens, new_argin{:});

Error in ft_datatype_sens (line 180)
    sens      = ft_datatype_sens(sens, new_argin{:});

Error in ft_read_sens (line 614)
sens = ft_datatype_sens(sens);

Error in ft_fetch_sens (line 149)
  sens = ft_read_sens(cfg.elec, 'senstype', 'eeg');

Error in ft_channelrepair (line 168)
  sens = ft_fetch_sens(cfg, data);


I've followed the error all the way down to the ft_datatype_sens, which says that channels position should be Mx3 structure. However, as I understood, configuration for EEG cap layout is usually done in 2D. So, my humble interpretation of the error is that ft_datatype_sens requires a 3-column channels position structure (3D?), whereas the layout I am using has only 2 columns (64x2).

Also, I've created a 3D layout through ft_prepare_layout and another 3-column layout through Matlab coding, both based on data channel labels. None of these layouts helped to solve an issue. I've got the same error. I am only learning about EEG pre-processing, and maybe the 'average' approach for repairing bad channels would be sufficient. However, even after interpolating with the 'average' approach, the signal of the bad channel looks completely irrelevant.

I will appreciate any suggestions about this issue, as well as comments regarding my interpretations. Thank you!

with best wishes
Arkadij
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!8yHtECz5aDE3ndikGhn-ykaAoymI1CTXiwe-0Gt1G5rnWiERzfewZviEuWfsXwJCBo6JYIfOGeAATUt_Pmvb-UbKWyzjgZSdj2StoQ$

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20220325/9de8c532/attachment.htm>


More information about the fieldtrip mailing list