[FieldTrip] Problems with ft_channelrepair
Schoffelen, J.M. (Jan Mathijs)
jan.schoffelen at donders.ru.nl
Fri May 28 21:07:07 CEST 2021
Hi Gema,
It seems that ft_channelrepair is in the air today. Just for the record, this will be the last e-mail I will answer on the discussion list today, specifically one about ft_channelrepair…
I think that using the non-preferred ‘weighted’ method in ft_channelrepair does not require an elec description. However, you should specifiy cfg.badchannel as a cell-array (at least that’s what I gather from the function’s help, and what I think I understand from the low level errors you report).
In other words, rather than cfg.badchannel = ‘C1’, you should call cfg.badchannel = {‘C1’};
Then I would think that the following could work...
cfg = [];
cfg.method = 'weighted';
cfg.badchannel = {‘C1'};
cfg.neighbours = neighbours;
cfg.trials = 'all';
interp = ft_channelrepair(cfg, data_tms_raw_sim);
Best wishes,
Jan-Mathijs
On 28 May 2021, at 20:59, Gema Mijancos via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:
El El mié, 14 abr 2021 a las 17:55, Gema Mijancos <gemamm98 at gmail.com<mailto:gemamm98 at gmail.com>> escribió:
Dear community,
My name is Gema Mijancos Martínez and I am working at UPC (Univeristat Politècnica de Catalunya). Currently we are analysing TMS-EEG signals.
I have a bad channel that I would like to repair, using ft_channelrepair.
This is the code that I used:
cfg = [];
cfg.channel = 'all'
cfg.method = 'distance';
cfg.layout = 'elec1010';
cfg.neighbourdist = 10;
neighbours = ft_prepare_neighbours(cfg, data_tms_raw_sim);
cfg = [];
cfg.method = 'weighted';
cfg.badchannel = 'C1';
cfg.neighbours = neighbours;
cfg.trials = 'all';
interp = ft_channelrepair(cfg, data_tms_raw_sim);
As I do have a channel (is not a missing one) I did not include cfg.elec into the cfg (because reading the documentation it does not say is compulsory to add it). However, I get the following error, which I think is related to cfg.elec. I do not understand why I get this error:
Error in ft_channelrepair (line 136)
sens = ft_fetch_sens(cfg, data);
Nevertheless, I decided to include cfg.elec:
cfg.elec = 'C:\Users\MIJANCOS MARTINEZ 2\Desktop\BECA\MATLAB CODE\Scripts\Channel_info_EEG_64_sens');
which is a matlab strcutrure containing the label of the channel, their position and the position of the electrodes (information needed by ft_datatype_sens: sens.lablel, sens.chanpos and sens.elecpos).
However, when I run this code, I get another error:
Error using cell/unique>celluniqueR2012a (line 249)
Elements of cell array input A must be character vectors (row vectors of class char).
Error in cell/unique (line 142)
[varargout{1:nlhs}] = celluniqueR2012a(varargin{1},logical(flaginds(1:5)));
Error in cell/setdiff>cellsetdiffR2012a (line 303)
uA = unique(a,order);
Error in cell/setdiff (line 129)
[varargout{1:nlhs}] = cellsetdiffR2012a(varargin{1:2},logical(flaginds(1:3)));
Error in ft_channelrepair (line 162)
cfg.missingchannel = setdiff(cfg.missingchannel, data.label, 'stable');
Error in Preprocessing_TMS_EEG (line 137)
[interp] = ft_channelrepair(cfg, data_tms_raw_sim);
I have read some threads regarding this issue, and one of the solutions was to use cfg.layout instead of cfg.elec. Thus, I used the easycap-M10.txt available in Fieldtrip/template but I get the same error as before.
I would really appreciate if anyone could provide some help in understanding why I need to provide cfg.elec (which it is what I need to do, perhaps I am wrong in my initial assumption) and why I am getting the errors that I just mentioned.
Best regards,
Gema Mijancos
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!tR_Wn_W-C0wQqeOq0GKehcJpj4gp_ncAk2HuRTdkxY3DGgD8KbPEVXzOjNmJjxFLua0Lg1gU$
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20210528/2158e069/attachment.htm>
More information about the fieldtrip
mailing list