Hi everyone,<br>
<br>
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! <br>
So far, I've done the following steps (using fieldtrip version 20091221):<br>
<br>
1) Compute timelockanalysis with cfg.latency = [0.05 0.4] and baseline correction for condition 1 and 2<br>
2) Source analysis with cfg. method = 'mne' on the timelock data, using inverse grids <br>
In the output from the source analysis I have avg.pow = 4560x211 for each subject (211 = number of time samples)<br>
<br>
The problem is that I can't compute sourcegrandaverage (see code below)
on these data (error at sourcegrandaverage at 178, dat(:,i) = tmp(:));<br>
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")<br>
<br>
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? <br>
<br>
Best<br>
Christine<br>
<br>
%-------------------------------------------------<br>
% Code for Source Statistics<br>
<br>
datapath = '/data/home1/ctillman/data/MooneyMEEGFieldtripAnalysis/ERF/Pilot/MNE/';<br>
<br>
DataFaceFiles = {<br>
'ERF_Task_BaseCorr_PreprocNew1secbase_ABA04_MooneyFacesMEEG_20070625_0_cond_1SRC_MNE_0p5iws_lambda05.mat';<br>
'ERF_Task_BaseCorr_PreprocNew1secbase_BBA06_MooneyFacesMEEG_20080318_0_cond_1SRC_MNE_0p5iws_lambda05.mat';<br>
'ERF_Task_BaseCorr_PreprocNew1secbase_CSA25_MooneyFacesMEEG_20070912_0_cond_1SRC_MNE_0p5iws_lambda05.mat';<br>
'ERF_Task_BaseCorr_PreprocNew1secbase_FSA04_MooneyFacesMEEG_20070529_0_cond_1SRC_MNE_0p5iws_lambda05.mat';<br>
'ERF_Task_BaseCorr_PreprocNew1secbase_GDE03_MooneyFacesMEEG_20071002_0_cond_1SRC_MNE_0p5iws_lambda05.mat';<br>
'ERF_Task_BaseCorr_PreprocNew1secbase_IFS20_MooneyFacesMEEG_20070809_0_cond_1SRC_MNE_0p5iws_lambda05.mat';<br>
'ERF_Task_BaseCorr_PreprocNew1secbase_IKE28_MooneyFacesMEEG_20070329_0_cond_1SRC_MNE_0p5iws_lambda05.mat';<br>
'ERF_Task_BaseCorr_PreprocNew1secbase_JHA07_MooneyFacesMEEG_20070327_0_cond_1SRC_MNE_0p5iws_lambda05.mat';<br>
'ERF_Task_BaseCorr_PreprocNew1secbase_JPA05_MooneyFacesMEEG_20080403_0_cond_1SRC_MNE_0p5iws_lambda05.mat';<br>
'ERF_Task_BaseCorr_PreprocNew1secbase_MKA21_MooneyFacesMEEG_20070711_0_cond_1SRC_MNE_0p5iws_lambda05.mat';<br>
'ERF_Task_BaseCorr_PreprocNew1secbase_MMA07_MooneyFacesMEEG_20070706_0_cond_1SRC_MNE_0p5iws_lambda05.mat';<br>
'ERF_Task_BaseCorr_PreprocNew1secbase_PSS16_MooneyFacesMEEG_20080312_0_cond_1SRC_MNE_0p5iws_lambda05.mat';<br>
'ERF_Task_BaseCorr_PreprocNew1secbase_SNI05_MooneyFacesMEEG_20080313_0_cond_1SRC_MNE_0p5iws_lambda05.mat';<br>
'ERF_Task_BaseCorr_PreprocNew1secbase_TWS22_MooneyFacesMEEG_20070831_0_cond_1SRC_MNE_0p5iws_lambda05.mat';<br>
'ERF_Task_BaseCorr_PreprocNew1secbase_UWA31_MooneyFacesMEEG_20070914_0_cond_1SRC_MNE_0p5iws_lambda05.mat';<br>
};<br>
<br>
DataInvertedFiles = {<br>
'ERF_Task_BaseCorr_PreprocNew1secbase_ABA04_MooneyFacesMEEG_20070625_0_cond_4SRC_MNE_0p5iws_lambda05.mat';<br>
'ERF_Task_BaseCorr_PreprocNew1secbase_BBA06_MooneyFacesMEEG_20080318_0_cond_4SRC_MNE_0p5iws_lambda05.mat';<br>
'ERF_Task_BaseCorr_PreprocNew1secbase_CSA25_MooneyFacesMEEG_20070912_0_cond_4SRC_MNE_0p5iws_lambda05.mat';<br>
'ERF_Task_BaseCorr_PreprocNew1secbase_FSA04_MooneyFacesMEEG_20070529_0_cond_4SRC_MNE_0p5iws_lambda05.mat';<br>
'ERF_Task_BaseCorr_PreprocNew1secbase_GDE03_MooneyFacesMEEG_20071002_0_cond_4SRC_MNE_0p5iws_lambda05.mat';<br>
'ERF_Task_BaseCorr_PreprocNew1secbase_IFS20_MooneyFacesMEEG_20070809_0_cond_4SRC_MNE_0p5iws_lambda05.mat';<br>
'ERF_Task_BaseCorr_PreprocNew1secbase_IKE28_MooneyFacesMEEG_20070329_0_cond_4SRC_MNE_0p5iws_lambda05.mat';<br>
'ERF_Task_BaseCorr_PreprocNew1secbase_JHA07_MooneyFacesMEEG_20070327_0_cond_4SRC_MNE_0p5iws_lambda05.mat';<br>
'ERF_Task_BaseCorr_PreprocNew1secbase_JPA05_MooneyFacesMEEG_20080403_0_cond_4SRC_MNE_0p5iws_lambda05.mat';<br>
'ERF_Task_BaseCorr_PreprocNew1secbase_MKA21_MooneyFacesMEEG_20070711_0_cond_4SRC_MNE_0p5iws_lambda05.mat';<br>
'ERF_Task_BaseCorr_PreprocNew1secbase_MMA07_MooneyFacesMEEG_20070706_0_cond_4SRC_MNE_0p5iws_lambda05.mat';<br>
'ERF_Task_BaseCorr_PreprocNew1secbase_PSS16_MooneyFacesMEEG_20080312_0_cond_4SRC_MNE_0p5iws_lambda05.mat';<br>
'ERF_Task_BaseCorr_PreprocNew1secbase_SNI05_MooneyFacesMEEG_20080313_0_cond_4SRC_MNE_0p5iws_lambda05.mat';<br>
'ERF_Task_BaseCorr_PreprocNew1secbase_TWS22_MooneyFacesMEEG_20070831_0_cond_4SRC_MNE_0p5iws_lambda05.mat';<br>
'ERF_Task_BaseCorr_PreprocNew1secbase_UWA31_MooneyFacesMEEG_20070914_0_cond_4SRC_MNE_0p5iws_lambda05.mat';<br>
   <br>
};<br>
<br>
template =
load('/data/home1/ctillman/data/MooneyMEEGFieldtripAnalysis/Beamforming/MNIgrids/Grids0p5_170109/MNItemplate_170109_-0p5iws.mat');<br>
Nx = length(template.template_grid.xgrid);<br>
Ny = length(template.template_grid.ygrid);<br>
Nz = length(template.template_grid.zgrid);<br>
%--------------------------------------------------------------------------<br>
<br>
for i = 1:length(DataFaceFiles)<br>
    fullname1 = strcat(datapath,DataFaceFiles{i,1});<br>
    DataFace{i} = load(fullname1);<br>
end<br>
<br>
for i = 1:length(DataInvertedFiles)<br>
    fullname2 = strcat(datapath,DataInvertedFiles{i,1});<br>
    DataInverted{i} = load(fullname2);<br>
end<br>
<br>
%--------------------------------------------------------------------------<br>
% Fixing the structure properties<br>
% Absolute power difference<br>
for l = 1:length(DataFaceFiles)<br>
   <br>
   <br>
   DataFace{l}.DataERFOut.xgrid = template.template_grid.xgrid;<br>
   DataFace{l}.DataERFOut.ygrid = template.template_grid.ygrid;<br>
   DataFace{l}.DataERFOut.zgrid = template.template_grid.zgrid;<br>
   DataFace{l}.DataERFOut.dim = [Nx Ny Nz];<br>
   DataFace{l}.DataERFOut.pos = template.template_grid.pos;<br>
   DataFace{l}.DataERFOut.inside = template.template_grid.inside;<br>
   DataFace{l}.DataERFOut.outside = template.template_grid.outside;<br>
   DataFace{l} = DataFace{l}.DataERFOut; <br>
   <br>
end<br>
    <br>
for l = 1:length(DataInvertedFiles)   <br>
    <br>
   <br>
    DataInverted{l}.DataERFOut.xgrid = template.template_grid.xgrid;<br>
    DataInverted{l}.DataERFOut.ygrid = template.template_grid.ygrid;<br>
    DataInverted{l}.DataERFOut.zgrid = template.template_grid.zgrid;<br>
    DataInverted{l}.DataERFOut.dim = [Nx Ny Nz];<br>
    DataInverted{l}.DataERFOut.pos = template.template_grid.pos;<br>
    DataInverted{l}.DataERFOut.inside = template.template_grid.inside;<br>
    DataInverted{l}.DataERFOut.outside = template.template_grid.outside;<br>
    DataInverted{l} = DataInverted{l}.DataERFOut;<br>
   <br>
end<br>
<br>
% Compute grand average for Condition 1 and 2<br>
cfgGA = [];<br>
cfgGA.keepindividual = 'yes';<br>
% cfg.parameter = 'pow';<br>
% create command strings for the computation:<br>
commandstr1 = strcat ('DataGAFace', '= sourcegrandaverage(cfgGA');<br>
commandstr2 = strcat ('DataGAInverted',  '= sourcegrandaverage(cfgGA');<br>
<br>
  for l = 1 : length(DataFace)<br>
    commandstr1 = strcat(commandstr1, ',DataFace{', num2str(l) , '}');<br>
end<br>
% finalize command strings<br>
commandstr1 = strcat(commandstr1,');');<br>
eval(commandstr1) % yields DataGADiff;<br>
<br>
for l = 1 : length(DataInverted)<br>
    commandstr2 = strcat(commandstr2, ',DataInverted{', num2str(l) , '}');<br>
end<br>
% finalize command strings<br>
commandstr2=strcat(commandstr2,');');<br>
eval(commandstr2) % yields DataGADiff;<br>
<br>
cfg = [];<br>
cfg.dimord = 'voxel';<br>
cfg.dim = [15 19 16];<br>
nSubjects = length(DataFaceFiles);<br>
a = [1:nSubjects];<br>
b = ones(1,nSubjects);<br>
cfg.design = [a a; b (2*b)];<br>
cfg.uvar = 1; % "subject" is unit of observation<br>
cfg.ivar = 2; % row<br>
cfg.method = 'montecarlo';<br>
cfg.correctm = 'fdr';<br>
cfg.alpha = 0.05;<br>
cfg.numrandomization = 6000;<br>
cfg.parameter = 'pow';<br>
cfg.statistic = 'depsamplesT';<br>
<br>
sourceStat = sourcestatistics(cfg, DataGAFace, DataGAInverted);<br>
<br clear="all"><br>
<br>-- <br>Christine Grützner, geb.Tillmann<br>Max-Planck-Institut für Hirnforschung<br>Abt. Neurophysiologie<br>Deutschordenstr. 46<br>60528 Frankfurt am Main<br>Germany<br><br>Phone: +49 (0)69/6301-83225<br>E-Mail: <a href="mailto:tillmann@mpih-frankfurt.mpg.de" target="_blank">tillmann@mpih-frankfurt.mpg.de</a><br>

<a href="http://www.mpih-frankfurt.mpg.de/global/Np/Staff/tillmann.htm" target="_blank">http://www.mpih-frankfurt.mpg.de/global/Np/Staff/tillmann.htm</a><br><br>
<p>----------------------------------</p>
<p>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.</p>
<p>  http://listserv.surfnet.nl/archives/fieldtrip.html</p>
<p>  http://www.ru.nl/fcdonders/fieldtrip/</p>