Source analysis on timelockdata

Christine Gruetzner christine.gruetzner at GOOGLEMAIL.COM
Tue Dec 22 17:00:56 CET 2009


Hi everyone,

I got a problem with performing source analysis (minimum norm estimate) on
timelockdata, and I would be very glad if anyone could help me out!
So far, I've done the following steps (using fieldtrip version 20091221):

1) Compute timelockanalysis with cfg.latency = [0.05 0.4] and baseline
correction for condition 1 and 2
2) Source analysis with cfg. method = 'mne' on the timelock data, using
inverse grids
In the output from the source analysis I have avg.pow = 4560x211 for each
subject (211 = number of time samples)

The problem is that I can't compute sourcegrandaverage (see code below) on
these data (error at sourcegrandaverage at 178, dat(:,i) = tmp(:));
I already tried to put the single datasets directly into sourcestatistics,
but this doesn't work either (error: "the function requires source or volume
data as input")

I guess the problem is caused by the time dimension in the timelock data -
does anyone have an idea how to handle this information in source analysis /
source grandaverage / source statistics?

Best
Christine

%-------------------------------------------------
% Code for Source Statistics

datapath =
'/data/home1/ctillman/data/MooneyMEEGFieldtripAnalysis/ERF/Pilot/MNE/';

DataFaceFiles = {
'ERF_Task_BaseCorr_PreprocNew1secbase_ABA04_MooneyFacesMEEG_20070625_0_cond_1SRC_MNE_0p5iws_lambda05.mat';
'ERF_Task_BaseCorr_PreprocNew1secbase_BBA06_MooneyFacesMEEG_20080318_0_cond_1SRC_MNE_0p5iws_lambda05.mat';
'ERF_Task_BaseCorr_PreprocNew1secbase_CSA25_MooneyFacesMEEG_20070912_0_cond_1SRC_MNE_0p5iws_lambda05.mat';
'ERF_Task_BaseCorr_PreprocNew1secbase_FSA04_MooneyFacesMEEG_20070529_0_cond_1SRC_MNE_0p5iws_lambda05.mat';
'ERF_Task_BaseCorr_PreprocNew1secbase_GDE03_MooneyFacesMEEG_20071002_0_cond_1SRC_MNE_0p5iws_lambda05.mat';
'ERF_Task_BaseCorr_PreprocNew1secbase_IFS20_MooneyFacesMEEG_20070809_0_cond_1SRC_MNE_0p5iws_lambda05.mat';
'ERF_Task_BaseCorr_PreprocNew1secbase_IKE28_MooneyFacesMEEG_20070329_0_cond_1SRC_MNE_0p5iws_lambda05.mat';
'ERF_Task_BaseCorr_PreprocNew1secbase_JHA07_MooneyFacesMEEG_20070327_0_cond_1SRC_MNE_0p5iws_lambda05.mat';
'ERF_Task_BaseCorr_PreprocNew1secbase_JPA05_MooneyFacesMEEG_20080403_0_cond_1SRC_MNE_0p5iws_lambda05.mat';
'ERF_Task_BaseCorr_PreprocNew1secbase_MKA21_MooneyFacesMEEG_20070711_0_cond_1SRC_MNE_0p5iws_lambda05.mat';
'ERF_Task_BaseCorr_PreprocNew1secbase_MMA07_MooneyFacesMEEG_20070706_0_cond_1SRC_MNE_0p5iws_lambda05.mat';
'ERF_Task_BaseCorr_PreprocNew1secbase_PSS16_MooneyFacesMEEG_20080312_0_cond_1SRC_MNE_0p5iws_lambda05.mat';
'ERF_Task_BaseCorr_PreprocNew1secbase_SNI05_MooneyFacesMEEG_20080313_0_cond_1SRC_MNE_0p5iws_lambda05.mat';
'ERF_Task_BaseCorr_PreprocNew1secbase_TWS22_MooneyFacesMEEG_20070831_0_cond_1SRC_MNE_0p5iws_lambda05.mat';
'ERF_Task_BaseCorr_PreprocNew1secbase_UWA31_MooneyFacesMEEG_20070914_0_cond_1SRC_MNE_0p5iws_lambda05.mat';
};

DataInvertedFiles = {
'ERF_Task_BaseCorr_PreprocNew1secbase_ABA04_MooneyFacesMEEG_20070625_0_cond_4SRC_MNE_0p5iws_lambda05.mat';
'ERF_Task_BaseCorr_PreprocNew1secbase_BBA06_MooneyFacesMEEG_20080318_0_cond_4SRC_MNE_0p5iws_lambda05.mat';
'ERF_Task_BaseCorr_PreprocNew1secbase_CSA25_MooneyFacesMEEG_20070912_0_cond_4SRC_MNE_0p5iws_lambda05.mat';
'ERF_Task_BaseCorr_PreprocNew1secbase_FSA04_MooneyFacesMEEG_20070529_0_cond_4SRC_MNE_0p5iws_lambda05.mat';
'ERF_Task_BaseCorr_PreprocNew1secbase_GDE03_MooneyFacesMEEG_20071002_0_cond_4SRC_MNE_0p5iws_lambda05.mat';
'ERF_Task_BaseCorr_PreprocNew1secbase_IFS20_MooneyFacesMEEG_20070809_0_cond_4SRC_MNE_0p5iws_lambda05.mat';
'ERF_Task_BaseCorr_PreprocNew1secbase_IKE28_MooneyFacesMEEG_20070329_0_cond_4SRC_MNE_0p5iws_lambda05.mat';
'ERF_Task_BaseCorr_PreprocNew1secbase_JHA07_MooneyFacesMEEG_20070327_0_cond_4SRC_MNE_0p5iws_lambda05.mat';
'ERF_Task_BaseCorr_PreprocNew1secbase_JPA05_MooneyFacesMEEG_20080403_0_cond_4SRC_MNE_0p5iws_lambda05.mat';
'ERF_Task_BaseCorr_PreprocNew1secbase_MKA21_MooneyFacesMEEG_20070711_0_cond_4SRC_MNE_0p5iws_lambda05.mat';
'ERF_Task_BaseCorr_PreprocNew1secbase_MMA07_MooneyFacesMEEG_20070706_0_cond_4SRC_MNE_0p5iws_lambda05.mat';
'ERF_Task_BaseCorr_PreprocNew1secbase_PSS16_MooneyFacesMEEG_20080312_0_cond_4SRC_MNE_0p5iws_lambda05.mat';
'ERF_Task_BaseCorr_PreprocNew1secbase_SNI05_MooneyFacesMEEG_20080313_0_cond_4SRC_MNE_0p5iws_lambda05.mat';
'ERF_Task_BaseCorr_PreprocNew1secbase_TWS22_MooneyFacesMEEG_20070831_0_cond_4SRC_MNE_0p5iws_lambda05.mat';
'ERF_Task_BaseCorr_PreprocNew1secbase_UWA31_MooneyFacesMEEG_20070914_0_cond_4SRC_MNE_0p5iws_lambda05.mat';

};

template =
load('/data/home1/ctillman/data/MooneyMEEGFieldtripAnalysis/Beamforming/MNIgrids/Grids0p5_170109/MNItemplate_170109_-0p5iws.mat');
Nx = length(template.template_grid.xgrid);
Ny = length(template.template_grid.ygrid);
Nz = length(template.template_grid.zgrid);
%--------------------------------------------------------------------------

for i = 1:length(DataFaceFiles)
    fullname1 = strcat(datapath,DataFaceFiles{i,1});
    DataFace{i} = load(fullname1);
end

for i = 1:length(DataInvertedFiles)
    fullname2 = strcat(datapath,DataInvertedFiles{i,1});
    DataInverted{i} = load(fullname2);
end

%--------------------------------------------------------------------------
% Fixing the structure properties
% Absolute power difference
for l = 1:length(DataFaceFiles)


   DataFace{l}.DataERFOut.xgrid = template.template_grid.xgrid;
   DataFace{l}.DataERFOut.ygrid = template.template_grid.ygrid;
   DataFace{l}.DataERFOut.zgrid = template.template_grid.zgrid;
   DataFace{l}.DataERFOut.dim = [Nx Ny Nz];
   DataFace{l}.DataERFOut.pos = template.template_grid.pos;
   DataFace{l}.DataERFOut.inside = template.template_grid.inside;
   DataFace{l}.DataERFOut.outside = template.template_grid.outside;
   DataFace{l} = DataFace{l}.DataERFOut;

end

for l = 1:length(DataInvertedFiles)


    DataInverted{l}.DataERFOut.xgrid = template.template_grid.xgrid;
    DataInverted{l}.DataERFOut.ygrid = template.template_grid.ygrid;
    DataInverted{l}.DataERFOut.zgrid = template.template_grid.zgrid;
    DataInverted{l}.DataERFOut.dim = [Nx Ny Nz];
    DataInverted{l}.DataERFOut.pos = template.template_grid.pos;
    DataInverted{l}.DataERFOut.inside = template.template_grid.inside;
    DataInverted{l}.DataERFOut.outside = template.template_grid.outside;
    DataInverted{l} = DataInverted{l}.DataERFOut;

end

% Compute grand average for Condition 1 and 2
cfgGA = [];
cfgGA.keepindividual = 'yes';
% cfg.parameter = 'pow';
% create command strings for the computation:
commandstr1 = strcat ('DataGAFace', '= sourcegrandaverage(cfgGA');
commandstr2 = strcat ('DataGAInverted',  '= sourcegrandaverage(cfgGA');

  for l = 1 : length(DataFace)
    commandstr1 = strcat(commandstr1, ',DataFace{', num2str(l) , '}');
end
% finalize command strings
commandstr1 = strcat(commandstr1,');');
eval(commandstr1) % yields DataGADiff;

for l = 1 : length(DataInverted)
    commandstr2 = strcat(commandstr2, ',DataInverted{', num2str(l) , '}');
end
% finalize command strings
commandstr2=strcat(commandstr2,');');
eval(commandstr2) % yields DataGADiff;

cfg = [];
cfg.dimord = 'voxel';
cfg.dim = [15 19 16];
nSubjects = length(DataFaceFiles);
a = [1:nSubjects];
b = ones(1,nSubjects);
cfg.design = [a a; b (2*b)];
cfg.uvar = 1; % "subject" is unit of observation
cfg.ivar = 2; % row
cfg.method = 'montecarlo';
cfg.correctm = 'fdr';
cfg.alpha = 0.05;
cfg.numrandomization = 6000;
cfg.parameter = 'pow';
cfg.statistic = 'depsamplesT';

sourceStat = sourcestatistics(cfg, DataGAFace, DataGAInverted);



-- 
Christine Grützner, geb.Tillmann
Max-Planck-Institut für Hirnforschung
Abt. Neurophysiologie
Deutschordenstr. 46
60528 Frankfurt am Main
Germany

Phone: +49 (0)69/6301-83225
E-Mail: tillmann at mpih-frankfurt.mpg.de
http://www.mpih-frankfurt.mpg.de/global/Np/Staff/tillmann.htm

----------------------------------
The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20091222/2bc0814f/attachment.html>


More information about the fieldtrip mailing list