[FieldTrip] Connectivity analysis after applying Welch's method

"Jörn M. Horschig" jm.horschig at donders.ru.nl
Wed Jul 30 10:28:50 CEST 2014


Hi Dragos,

while quickly browisng through your mail, it appears to me that you 
simply need to set single_epoch_freq.dimord = 'rpt_chan_freq'. FieldTrip 
is using the dimord field to infer the order of the dimensions 
(*dim*ension *ord*er). The actual dimensions of powspctrm and crsspctrm 
are now inconsistent with the dimord specifications.

Best,
Jörn


On 7/30/2014 1:18 AM, Dragos Stanciu wrote:
> Dear FieldTrippers,
>
> I'm Dragos Stanciu and I'm working on my MSc in Neuroinformatics 
> dissertation at the University of Edinburgh. My project involves 
> analysis of resting-state functional connectivity using graph theory 
> in Alzheimer's disease based on MEG data.
>
> Each of my subjects has a number of 10s epochs (trials) associated 
> with him/her. I was able to compute the coherence and weighted phase 
> lag index measures (with /ft_freqanalysis /and 
> /ft_connectivityanalysis) /by treating my 10s epochs as trials, but 
> now I would like to reduce the amount of noise in the estimation of 
> the frequency spectrum by employing Welch's method.
>
> For this, I split each 10s epoch in 2s segments (minitrials) with 50% 
> overlap:
>
>     [sep_epoch_data] = ft_redefinetrial(cfg_cut, single_epoch_data)/. /
>
>
> I then apply /ft_preprocessing /on the minitrials:
>
>      [processed_single_epoch] = ft_preprocessing(cfg, sep_epoch_data);
>
> I then do frequency analysis on the preprocessed segmented data:
>
>     [single_epoch_freq] = ft_freqanalysis(cfg_freq,
>     processed_single_epoch);
>
> where
>
>     display(cfg_freq)
>             method: 'mtmfft'
>              taper: 'hanning'
>             foilim: [0.5000 4]
>             output: 'powandcsd'
>            channel: {148x1 cell}    % 148 channels labelled from A1 to
>     A148
>          keeptrial: 'no'     % don't keep the minitrials, as we want
>     to average them
>         keeptapers: 'no'
>
> Please note that I average the minitrials (/keeptrial = 'no'/) as I 
> want to get an average of the frequencies.
>
> The resulting /single_epoch_freq/ structure looks like:
>
>     display(single_epoch_freq)
>     label: {148x1 cell}
>            dimord: 'chan_freq'
>              freq: [0.5001 1.0002 1.5004 2.0005 2.5006 3.0007 3.5008
>     4.0009]
>         powspctrm: [148x8 double]
>          labelcmb: {10878x2 cell}     % channel combinations (148*147/2)
>         crsspctrm: [10878x8 double]
>               cfg: [1x1 struct]
>
>
> The last step is to append the averaged frequency structures of each 
> 10s epoch together and perform connectivity analysis on the main 10s 
> epochs. I do the concatenation like so:
> freq_avgs_powspctrm = [freq_avgs_powspctrm; 
> permute(single_epoch_freq.powspctrm, [3,1,2])];
>
> freq_avgs_crsspctrm = [freq_avgs_crsspctrm; 
> permute(single_epoch_freq.crsspctrm, [3,1,2])];
>
> The idea behind /permute(..., [3, 1, 2])/ is that I want the first 
> dimension to represent trials, the second dimension channel 
> combinations and the third dimension frequencies, as this is needed 
> for the input of /ft_connectivity_wpli /(Repetitions x 
> Channelcombination (x Frequency)).
>
> I then call stat_conn = ft_connectivityanalysis(cfg_conn, freq_avgs);
> where:
>
>     display(cfg_conn)
>          method: 'wpli_debiased'
>         channel: {148x1 cell}
>
> and
>
>     display(freq_avgs)
>          powspctrm: [4x148x8 double]      % as I have 4 ten second epochs
>         crsspctrm: [4x10878x8 double]     % as I have 4 ten second epochs
>             label: {148x1 cell}
>            dimord: 'chan_freq'
>              freq: [0.5001 1.0002 1.5004 2.0005 2.5006 3.0007 3.5008
>     4.0009]
>          labelcmb: {10878x2 cell}
>               cfg: [1x1 struct]
>
>
> The error that I get when running /ft_connectivityanalysis/ is:
>
>     Error using cat
>     CAT arguments dimensions are not consistent.
>     Error in ft_checkdata>fixcsd (line 1170)
>         data.crsspctrm = cat(catdim, data.powspctrm, data.crsspctrm);
>
>
> When debugging, /catdim/ is equal to 1. The error occurs because the 
> 2nd dimension of data.powspctrm and data.crsspctrm are not equal 
> (former is 148, latter is 10878). Do you have any suggestions on 
> getting around this problem? Should I construct /freq_avgs /(data 
> input to ft_connectivityanalysis) differently? I'm also open to 
> different approaches to working out Welch's method in FieldTrip.
>
> Please download this archive that contains my test script and 4 
> example 10s epochs of a subject: 
> https://www.dropbox.com/s/js7pztai02f5p27/Welch_fieldtrip.zip The code 
> should make things clearer (or the opposite).
> Observations: I thought about using /ft_freqanalysis_mtmwelch/, but 
> apparently it's deprecated.
>
> Thank you all in advance for your feedback.
>
> Kind regards,
> Dragos Stanciu
>
>
> _______________________________________________
> 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




More information about the fieldtrip mailing list