[FieldTrip] ft_sourcestatistics does not recognize source input data

Werkle, Markus werkle at mpib-berlin.mpg.de
Mon Jan 2 12:41:56 CET 2017

Dear Fieldtrippers,

happy new year to everyone here!

This is the second attempt to get help on an issue with ft_sourcestatistics. As I still can not figure out where the problem resides, I give it a new try.

My goal is to use a common DICS filter to reconstruct single-trial data in three conditions. Afterwards, I want to run a test for a linear effect across the conditions. I thought to follow closely the descriptions in http://www.fieldtriptoolbox.org/example/common_filters_in_beamforming , especially in the way I extract the single-trial data. However, when I run ft_sourcestatistics, the single trial source data is not recognized as source data ...

Any ideas on what went wrong?

Below is the code and error-messages:

When I run the code below:

src_descrcfg = [];
src_descrcfg.keeptrials = 'yes';
src00 = ft_sourcedescriptives(src_descrcfg,src00);
src01 = ft_sourcedescriptives(src_descrcfg,src01);
src11 = ft_sourcedescriptives(src_descrcfg,src11);

src_statscfg = [];
src_statscfg.parameter   = 'trial.pow';
src_statscfg.method      = 'analytic';
src_statscfg.statistic   = 'indepsamplesregrT';
src_statscfg.alpha       = 0.05;
src_statscfg.correctm    = 'no';

src_statscfg.design(1,:)  = [ones(1,src00.df) 2*ones(1,src01.df) 3*ones(1,src11.df)];
src_statscfg.ivar         = 1; % the 1st row in cfg.design contains the independent variable

src_stat = ft_sourcestatistics(src_statscfg, src00, src01, src11);

I get the following output and error message:

original data contained 201 trials
the call to "ft_sourcedescriptives" took 0 seconds and required the additional allocation of an estimated 48 MB
original data contained 113 trials
the call to "ft_sourcedescriptives" took 0 seconds and required the additional allocation of an estimated 0 MB
original data contained 46 trials
the call to "ft_sourcedescriptives" took 0 seconds and required the additional allocation of an estimated 0 MB
Index exceeds matrix dimensions.

Error in ft_datatype_source (line 187)
            val{indx(k)}(1,:,:,:) = dat{indx(k)};

Error in ft_checkdata (line 251)
  data = ft_datatype_source(data);

Error in ft_sourcestatistics (line 100)
  varargin{i} = ft_checkdata(varargin{i}, 'datatype', 'source', 'feedback', 'no');

src00, src01, and src11 are source-solutions from a dics-beamformer with the following content:

src00 =

          freq: 9.7656
     cumtapcnt: [201x1 double]
           dim: [27 36 30]
        inside: [29160x1 logical]
           pos: [29160x3 double]
        method: 'rawtrial'
         trial: [1x201 struct]
            df: 201
           cfg: [1x1 struct]
    sampleinfo: [201x2 double]
        rating: [201x2 double]
          stim: {201x3 cell}

The source-solutions were based on a common dics-filter after running the following code:

% compute single trial spectra
mtmfftcfg.keeptrials = 'yes';
mtmfft_singletrl = ft_freqanalysis(mtmfftcfg,data);

% project all trials through common spatial filter %
dics_alltrl_cfg = [];
dics_alltrl_cfg = dics_commoncfg;
dics_alltrl_cfg.grid.filter = dics_common.avg.filter; % use the common filter computed in the previous step!
dics_alltrl_cfg.rawtrial    = 'yes';      % project each single trial through the filter. Only necessary if you are interested in reconstructing single trial data

tmp_dics_all = ft_sourceanalysis(dics_alltrl_cfg, mtmfft_singletrl); % contains the source estimates for all trials/both

Any ideas, why the data is not recognized as source-data when calling ft_sourcestatistics (obviously it is recognized correctly with ft_sourcedescriptives ...).

Thank you very much for your help.

Best regards,

Dr. Markus Werkle-Bergner, Dipl. Psych.
Senior Research Scientist (W2)

Jacobs Foundation Research Fellow 2017-2019

Max Planck Institute for Human Development
Center for Lifespan Psychology

Lentzeallee 94, 14195 Berlin

Tel.: 0049 (0)30 82406 447 Fax.: 0049 (0)30 824 99 39
Mail: werkle at mpib-berlin.mpg.de

More information about the fieldtrip mailing list