<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Dear Richard,</div><div><br><br class="Apple-interchange-newline"><blockquote type="cite"><div ocsi="0" fpstyle="1" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div style="direction: ltr; font-family: Tahoma; font-size: 10pt;">Dear Fieldtrippers,<br><br>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.</div></div></blockquote>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. </div><div><br></div><div><a href="http://www.fieldtriptoolbox.org/tutorial/networkanalysis">http://www.fieldtriptoolbox.org/tutorial/networkanalysis</a></div><div><br></div><div>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:</div><div><br></div><div><a href="https://www.youtube.com/watch?v=ZBwh0Vm4fh4">https://www.youtube.com/watch?v=ZBwh0Vm4fh4</a></div><div><blockquote type="cite"><div ocsi="0" fpstyle="1" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div style="direction: ltr; font-family: Tahoma; font-size: 10pt;"> 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. </div></div></blockquote><div>cfg = [];</div><div><pre class="code"><font face="Helvetica">cfg.dataset = ‘yourdataset';
cfg.trialdef.triallength = 4;
cfg.trialdef.ntrials = Inf;
cfg = ft_definetrial(cfg);
cfg.channel = {‘EEG'};
data = ft_preprocessing(cfg);</font></pre><pre class="code"><font face="Helvetica"><span style="white-space: normal;">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.</span></font></pre><div><br></div></div><br><blockquote type="cite"><div ocsi="0" fpstyle="1" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div style="direction: ltr; font-family: Tahoma; font-size: 10pt;">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.<br><br>Thus, my questions are:<br>1. How to handle parcellating data? Shoud I use a)"toi" in ft_freqanalysis as a sliding window or b) split at trial definition?<br>If a: how does freqanalysis handle multiple trials? I currently use this:<br> cfg.method = 'wavelet';<br> cfg.output = 'powandcsd';<br> cfg.channel = 1:64;<br> cfg.foilim = [0 70];<br> cfg.toi = [5 10 15 20 25 30 35 40 45 50 55]<br> [freq_data] = ft_freqanalysis(cfg, data_iccleaned) % run over ICA cleaned data<br><br>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?<br></div></div></blockquote><div><br></div><div>Then for a given frequency in this example 8-12 Hz you could do this:</div><pre class="code"><font face="Helvetica">cfg = [];
cfg.method = 'mtmfft';
cfg.output = 'fourier';
cfg.keeptrials = 'yes';
cfg.tapsmofrq = 2;
cfg.foi = 10;
freq_data = ft_freqanalysis(cfg, data);</font></pre><div>and subsequently use ft_connectivityanalysis with the metric of your choice. </div><blockquote type="cite"><div ocsi="0" fpstyle="1" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div style="direction: ltr; font-family: Tahoma; font-size: 10pt;"><br>If b: how can you split trial in different epochs of a certain length and how does ft_freqanalysis handle multiple trials?<br></div></div></blockquote><div><br></div>there are two functions you might want to check: ft_redefinetrial and ft_selectdata<br><blockquote type="cite"><div ocsi="0" fpstyle="1" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div style="direction: ltr; font-family: Tahoma; font-size: 10pt;"><br>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?<br></div></div></blockquote>I would definitely remove the channel but there are certainly other opinions on that. <br><blockquote type="cite"><div ocsi="0" fpstyle="1" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div style="direction: ltr; font-family: Tahoma; font-size: 10pt;"><br>3. Can you set the interval length for ft_freqanalysis (and if so, how)? It currently takes 0.02Hz increments, is that standard?<br></div></div></blockquote>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:</div><div><a href="https://www.youtube.com/watch?v=vwPpSglPJTE">https://www.youtube.com/watch?v=vwPpSglPJTE</a> <br><blockquote type="cite"><div ocsi="0" fpstyle="1" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div style="direction: ltr; font-family: Tahoma; font-size: 10pt;"><br>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:<br><br> cfg.method = 'wpli';<br> wpli_data = ft_connectivityanalysis(cfg, freq_data);<br></div></div></blockquote>see above<br><blockquote type="cite"><div ocsi="0" fpstyle="1" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div style="direction: ltr; font-family: Tahoma; font-size: 10pt;"><br>5. Is it possible to automatically obtain the wpli adjacency matrix per frequency band?<br></div></div></blockquote>no, you have to decide what value corresponds to a connection = 1 and what not =0<br><blockquote type="cite"><div ocsi="0" fpstyle="1" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div style="direction: ltr; font-family: Tahoma; font-size: 10pt;"> Is there a fieldtrip function to average over a range of frequencies (and/or timepoints/trils) from the ft_connectivity analysis output?<br></div></div></blockquote>ft_selectdata with cfg.avgoverfreq = ‘yes'<br><blockquote type="cite"><div ocsi="0" fpstyle="1" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div style="direction: ltr; font-family: Tahoma; font-size: 10pt;"> 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)?<br></div></div></blockquote>I don’t get that one.</div><div><br></div><div>Good luck</div><div>tzvetan</div><div><br></div></body></html>