[FieldTrip] data segmenting and frequency analysis

Tzvetan Popov tzvetan.popov at uni-konstanz.de
Wed May 20 21:23:26 CEST 2015


Dear Richard,


> Dear Fieldtrippers,
> 
> Being somewhat new to using fieldtrip I was hoping someone would be able to help me sort out some parcellation and data-handling issues. In short: I'm working with resting state EEG data, recorded with a 64-channel BioSemi system and would like to do some graph based analyses on this.
you might check this page that illustrates a way to do this. It is in source space yet in your case you’ll stay on the electrode level. 

http://www.fieldtriptoolbox.org/tutorial/networkanalysis

Keep in mind that sensor/electrode level connectivity metrics, regardless of the metric, come with some difficulties that are not trivial to solve. Maybe is good if you consult this lecture first:

https://www.youtube.com/watch?v=ZBwh0Vm4fh4
> The data is 4 minutes (eyes-open, eyes-closed 1-minute epochs) and ideally I would like to split these two 1 minute eyes-closed parts into 30*4s epochs.
cfg = [];
cfg.dataset              = ‘yourdataset'; 
cfg.trialdef.triallength = 4;
cfg.trialdef.ntrials     = Inf;
cfg = ft_definetrial(cfg);
cfg.channel     = {‘EEG'};
data = ft_preprocessing(cfg);
If you generate several of these data structures corresponding to your 1-minute epochs you can do data = ft_appenddata([],data1,data2). This way you combine them in one data structure.


> After this I would like to run a wavelet decomposition for the frequency analysis and obtain the adjacency matrix based on weighted phase lag index.
> 
> Thus, my questions are:
> 1. How to handle parcellating data? Shoud I use a)"toi" in ft_freqanalysis as a sliding window or b) split at trial definition?
> If a: how does freqanalysis handle multiple trials? I currently use this:
>     cfg.method = 'wavelet';
>     cfg.output = 'powandcsd';
>     cfg.channel = 1:64;
>     cfg.foilim = [0 70];
>     cfg.toi = [5 10 15 20 25 30 35 40 45 50 55]
>     [freq_data] = ft_freqanalysis(cfg, data_iccleaned) % run over ICA cleaned data
> 
> Which does give me 11 fragments, but I am not sure how the two 1-minute epochs/trials are handled in this or if they are adequately handles in the subsequent ft_connectivityanalysis?

Then for a given frequency in this example 8-12 Hz you could do this:
cfg            = [];
cfg.method     = 'mtmfft';
cfg.output     = 'fourier';
cfg.keeptrials = 'yes';
cfg.tapsmofrq  = 2;
cfg.foi        = 10;
freq_data = ft_freqanalysis(cfg, data);
and subsequently use ft_connectivityanalysis with the metric of your choice. 
> 
> If b: how can you split trial in different epochs of a certain length and how does ft_freqanalysis handle multiple trials?

there are two functions you might want to check: ft_redefinetrial and ft_selectdata
> 
> 2. How to deal with faulty or noisy channels? If there are some noisy channels, do you remove these? Removing channels does not seem ideal as it would mean having to deal with uneven graphs (graphs with different numbers of nodes). Leaving them in might bias the wpli estimation?
I would definitely remove the channel but there are certainly other opinions on that. 
> 
> 3. Can you set the interval length for ft_freqanalysis (and if so, how)? It currently takes 0.02Hz increments, is that standard?
You can-  cfg.foi = [0:1:100] gives you 0 to 100 Hz in steps of 1 Hz. Whether or not your frequency resolution is 1 Hz is different issue. You might check out this lecture too:
https://www.youtube.com/watch?v=vwPpSglPJTE 
> 
> 4. Is it necessary to tell ft_connectivityanalysis to use mutliple trials/segments? I currently get the message saying it needs more than 1 trial, even though ft_freqanalysis returns an x*x*11 matrix (and I'm assuming the 11 are the windows set for the wavelet decomposition). I am just using this:
> 
>     cfg.method = 'wpli';
>     wpli_data = ft_connectivityanalysis(cfg, freq_data);
see above
> 
> 5. Is it possible to automatically obtain the wpli adjacency matrix per frequency band?
no, you have to decide what value corresponds to a connection = 1 and what not =0
>     Is there a fieldtrip function to average over a range of frequencies (and/or timepoints/trils) from the ft_connectivity analysis output?
ft_selectdata with cfg.avgoverfreq = ‘yes'
>     Is there a fieldtrip function to convert individal wpli's back to a complete channel*channel matrix as opposed to the 1D vector is seems to return (that lists each individual wpli)?
I don’t get that one.

Good luck
tzvetan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20150520/4a10c29b/attachment-0002.html>


More information about the fieldtrip mailing list