[FieldTrip] Channel_selection

Federico Grande fgrande at cbs.mpg.de
Thu Nov 28 09:49:21 CET 2013


Thank you all!

All the best,

Federico

----- Original Message -----
From: "Cristiano Micheli" <michelic72 at gmail.com>
To: "FieldTrip discussion list" <fieldtrip at science.ru.nl>
Sent: Thursday, November 28, 2013 3:11:12 AM
Subject: Re: [FieldTrip] Channel_selection



Dear Federico il Grande 


Allow 'badchstr' to be a cellarray of strings like this: 




badchstr = {'label2' 'labe8' ... 'label199'}; 





Try this: 

chstr = { 'all' }; 

for i=1:numel(badchstr) 

chstr(i+1) = cellstr(sprintf( '-%s ' ,badchstr{i})); 

end 




cfg = []; 

cfg.channel = chstr; 

dataclean = ft_preprocessing(cfg,data); 




Best, 

Cristiano 




On Wed, Nov 27, 2013 at 11:13 AM, Max Cantor < mcantor at umich.edu > wrote: 






Here is how I do it: 


allchan = ft_read_header(dataset); 


(preprocess) 


allchan.label = [allchan.label; implicitref]; 


(after artifact rejection/ICA/etc.) 

badchan = ft_channelselection('gui', allchan.label); 



This gives me the channel labels for all channels, with the implicitref added back in (normally this is removed), then a gui which lets me remove bad channels manually after preprocessing/artifact rejection/ICA/etc. 


Hope this helps. 


Max Cantor 
Research Assistant 
Computational Neurolinguistics Lab 
University of Michigan 





On Wed, Nov 27, 2013 at 10:46 AM, "Jörn M. Horschig" < jm.horschig at donders.ru.nl > wrote: 


Hi Frederico, 

I think the best solution is to not use fieldtrip but plain matlab function. This is a small example that might help you: 

>> allchans = {'Fz', 'Cz', 'CPz'}; 
>> badchans = {'Fz', 'Cz'}; 
>> idx = ismember(allchans, badchans) 

idx = 

1 1 0 

You can then use the idx variable and logical indexing to get the good channels: 

>> allchans(~idx) 

ans = 

'CPz' 

And then use cfg.channel = allchans(~idx). 

Be aware that ismember is a tricky function, because it returns the indices of the first vector as the first return variable and the respective same for the second vector as the second return variable, so order does matter. Just give it a try and play a bit around with it and you'll see. 

Best, 
Jörn 




Federico Grande wrote: 


Hello everyone, 

In order to clean a little bit more my measurements, I have developed a method which detects bad channels, and now, once I have the labels of the bad channels, I want to give it to ft_preprocessing, but I don't know how. I've been looking on ft_channelselection, and it seems that there is an option , by using some like channel={'all','-channel to exclude'}. I have an array with the labels of this channels that I want to exclude, but I don't know why, it seems that I am not using it in the proper way. I have tried with cfg.channel= {'all','-badSelections'} (badSelections is my array), and it doesn't work, since after processing, still appear all the channels in the dat.label. 

Any suggestion? 

Thank you very much!! 

All the best, 

Federico Grande 
______________________________ _________________ 
fieldtrip mailing list 
fieldtrip at donders.ru.nl 
http://mailman.science.ru.nl/ mailman/listinfo/fieldtrip 


-- 
Jörn M. Horschig 
PhD Student 
Donders Institute for Brain, Cognition and Behaviour 
Centre for Cognitive Neuroimaging 
Radboud University Nijmegen 
Neuronal Oscillations Group 
FieldTrip Development Team 

P.O. Box 9101 
NL-6500 HB Nijmegen 
The Netherlands 

Contact: 
E-Mail: jm.horschig at donders.ru.nl 
Tel: +31-(0)24-36-68493 
Web: http://www.ru.nl/donders 

Visiting address: 
Trigon, room 2.30 
Kapittelweg 29 
NL-6525 EN Nijmegen 
The Netherlands 



______________________________ _________________ 
fieldtrip mailing list 
fieldtrip at donders.ru.nl 
http://mailman.science.ru.nl/ mailman/listinfo/fieldtrip 


_______________________________________________ 
fieldtrip mailing list 
fieldtrip at donders.ru.nl 
http://mailman.science.ru.nl/mailman/listinfo/fieldtrip 


_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl
http://mailman.science.ru.nl/mailman/listinfo/fieldtrip




More information about the fieldtrip mailing list