<div dir="ltr"><div>Hi Maria,</div><div><br></div><div>I think there is more than one solution for what you are aiming to do. Maybe a more experienced user or developer could show you the most straightforward way (?).</div><div><br></div><div>IMO, using LCMV is more direct for this application because with DICS you will need to provide the reference signal (i.e., the source timecourse from the other condition). Therefore, you will need to apply LCMV anyway.</div><div> </div><div>You could apply a band-pass filter to the channel activity before localizing the frequency band of interest with LCMV. Alternatively, you could obtain the virtual channels (without band pass) and define the frequency bands of interest when computing the coherence as in the tutorial (see ft_freqanalysis steps at <a href="http://www.fieldtriptoolbox.org/tutorial/coherence#computing_the_coherence">http://www.fieldtriptoolbox.org/tutorial/coherence#computing_the_coherence</a>).</div><div>With DICS, in this case, I see it more intricate: 1) obtain the source timecourses of condition 2 with LCVM; 2) compute the cross spectral density between all data channels and each source timecourse (reference signal); 3) compute DICS for each reference signal. Of course, you don't need to compute the coherence for the whole brain, but only for the source of interest. For each reference signal, you could change the cfg.grid.inside value to include only the position of the voxel of interest (the same voxel of the reference signal).</div><div>I hope this helps. </div><div><br></div><div>Best,Maité</div><div><br></div><div>Hi Maité,</div><div><br></div><div>Many thanks for your advice again!</div><div><br></div><div>I have been wondering whether I could calculate coherence straight from the cross spectros without reference signals or virtual channels by using beamformer_dics. In beamformer_dics, it seems to be possible to define the location of the dipole with which coherence is computed (i.e. refdip). However, I am not sure if it is possible to calculate the coherence between the same brain region in two different conditions. </div><div><br></div><div>Best,</div><div>Maria   </div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-06-29 12:57 GMT+03:00 Maria Hakonen <span dir="ltr"><<a href="mailto:maria.hakonen@gmail.com" target="_blank">maria.hakonen@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><pre style="white-space:pre-wrap;color:rgb(0,0,0)">Hi Maria,
for obtaining the sources timecourses (aka virtual channels) you can follow the tutorials pasted below. 

Best,Maité

<a href="http://www.fieldtriptoolbox.org/tutorial/connectivity#extract_the_virtual_channel_time-series" target="_blank">http://www.fieldtriptoolbox.<wbr>org/tutorial/connectivity#<wbr>extract_the_virtual_channel_<wbr>time-series</a>

<a href="http://www.fieldtriptoolbox.org/tutorial/shared/virtual_sensors#extract_the_virtual_channel_time-series" target="_blank">http://www.fieldtriptoolbox.<wbr>org/tutorial/shared/virtual_<wbr>sensors#extract_the_virtual_<wbr>channel_time-series</a>

</pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)">Hi Maité<span style="font-family:arial,sans-serif;color:rgb(34,34,34);font-size:12.8px">,</span></pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)">Thank for your answer again!</pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)">However, I would need to calculate coherence within certain frequency bands and, therefore, I would like to use dics. The examples in the links seem to use lcmv. Could you please let me know how I can get coherence between conditions using dics?</pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)">Best,</pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)">Maria</pre></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">2017-06-26 12:45 GMT+03:00 Maria Hakonen <span dir="ltr"><<a href="mailto:maria.hakonen@gmail.com" target="_blank">maria.hakonen@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><pre style="white-space:pre-wrap;color:rgb(0,0,0)">Hi Maria,
maybe in this case it is better that you export the sources timecourses, build a data matrix with them and treat them in the same way as you did with the channels. 

Best,Maité 
</pre><div><br></div><div>Hi <span style="color:rgb(0,0,0);white-space:pre-wrap">Maité</span>,</div><div><br></div><div>Could you please yet let me know how to get the sources timecources? source = ft_sourceanalysis(cfg, freq); only gives  </div><div><div>source = </div><div><br></div><div>         freq: 18</div><div>    cumtapcnt: [180x1 double]</div><div>          dim: [19 15 15]</div><div>       inside: [4275x1 logical]</div><div>          pos: [4275x3 double]</div><div>       method: 'average'</div><div>          avg: [1x1 struct]</div><div>          cfg: [1x1 struct]</div></div><div><br></div><div>Best,</div><div>Maria</div></div><div class="m_-6513418432658247377HOEnZb"><div class="m_-6513418432658247377h5"><div class="gmail_extra"><br><div class="gmail_quote">2017-06-25 13:53 GMT+03:00 Maria Hakonen <span dir="ltr"><<a href="mailto:maria.hakonen@gmail.com" target="_blank">maria.hakonen@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><pre style="white-space:pre-wrap;color:rgb(0,0,0)"><font face="tahoma, sans-serif">Hi Maité,</font></pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)"><font face="tahoma, sans-serif">Thank you for your answer!</font></pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)"><font face="tahoma, sans-serif">I have managed to calculate the coherence between two conditions in the sensor space in the way you suggested. However, I haven't managed to calculate the coherence between conditions in the source space (i.e. Appendix 1 in <a href="http://www.fieldtriptoolbox.org/tutorial/coherence" target="_blank">http://www.fieldtriptoolbox.or<wbr>g/tutorial/coherence</a>). ft_sourceanalysis doesn't have channelcmb. I wonder if anyone has any solutions for this?</font></pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)"><font face="tahoma, sans-serif">BTW. I didn't get the answer to my question in my email but found it from Fieldtrip archive. However, I have also got some other emails from fieldtrip discussion forum.</font></pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)"><font face="tahoma, sans-serif">Best,</font></pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)"><font face="tahoma, sans-serif">Maria</font></pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)"><br></pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)">Hi Maria,
Here it is a possible solution. First, rename channels from one of both conditions: for example, for condition 2, {'ch01cond2', 'ch02cond2', ...}. Then, append the data from both conditions. In ft_freqanalysis introduce all the channels combinations you want: 

cfg.channel    = {'MEG' 'ch01cond2' 'ch02cond2' ...};
cfg.channelcmb = {'ch01' 'ch01cond2'; 'ch02' 'ch02cond2'};
As I understand, you could use the same channelcmb later on in ft_connectivityanalysis.
I hope it helps.
Best wishes,Maité</pre><div><div class="m_-6513418432658247377m_504364528174944664h5"><br><br><div dir="ltr"><div><div><div>Dear FieldTrip experts,<br><br></div>I have just started to use Fieldtrip and would like to estimate coherence between MEG responses measured in two different conditions from the same cortical areas. The example in Appendix 1 is close to what I would like to do:<br><a href="http://www.fieldtriptoolbox.org/tutorial/coherence" target="_blank">http://www.fieldtriptoolbox.or<wbr>g/tutorial/coherence</a><br><br></div>However, in the example, coherence is calculated between the reference signal (EMG) and all MEG channels. Could it be possible to calculate coherence between each MEG channel in one condition and the same MEG channels in the other condition, that is: <br>ch1 in cond1 vs. ch1 in cond2, ch2 in cond1 vs. ch2 in cond2, ... <br><br></div>As far as I understand, the example in Appendix 1 would do this: <br><div><div>ch1 in cond1 vs. all channels in cond2, ch2 in cond ch1 all channels in cond2, ...<br><br></div><div>Best,<br></div><div>Maria<br></div></div></div>
</div></div></div><br></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>