Problems plotting sourcestatistics

Michael Wibral michael.wibral at WEB.DE
Fri Oct 19 11:08:46 CEST 2007


Dear Fieldtrippers,

we have a problem plotting results from multisubject source statistics. The problem seems to be due to the fact that sourcestats are calculated only on the 'inside' voxels and the source stats are returned in a small box (i.e. fewer voxels) because of the omitted 'outside'. If I then you sourceinterpolate to get template MRI and sourcestats together sourceinterpolate seems to think there is a need to stretch the stats voxels (because there are fewer of them than voxels in the anatomy) - smearing the stast all over the anatomy - mostly outside of the brain.
Plotting normalized single subjects beamforming images works fine, though. Plotting the results using matlab's 'slice' method also works fine. I pasted the code we used below.

Any help is greatly appreciated,

Michael Wibral


%%%%%%%%%%%%CODE%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%code for normalization%%%%%%%%%%%%%%%%%%%%%%%%%%

Design = {
          'MKA21_sourceUprightPreInt.mat',     'MKA21_sourceUprightPostInt.mat',     'MKA21_sourceDiffInt.mat'  ;
..........more files.......
    };

PathName = '/net/M036-LFS1/srv/data1/home1/ctillman/data/MooneyMEEGFieldtripAnalysis/BeamformingFieldtrip/';

for i = 1:size(Design,1)


    % Normalization of condition 1 files
    fullnamePre = strcat(PathName,Design{i,1});
    subjectID = Design{i,1}(1:5);
    disp(strcat('*******loading ', fullnamePre));
    load(fullnamePre);
    cfg = [];
    cfg.coordinates = 'ctf';
    cfg.template = '/net/M036-LFS1/srv/data1/home1/ctillman/tools/spm2/templates/T1.mnc';
    % Normalise
    sourceUprightPreIntNorm = volumenormalise(cfg,sourceUprightPreInt);
    sourceUprightPreNormOutfile = strcat(PathName, subjectID,'_SourceUprightPreIntNorm.mat');
    save(sourceUprightPreNormOutfile, 'sourceUprightPreIntNorm');
    clear sourceUprightPreIntNorm;

    % Normalization of condition 2 files
     ..........

    % Normalization of condition 3 files
    ..........

    % check whether normalized data plot OK (they do)
    cfg = [];
    cfg.template = '/net/M036-LFS1/srv/data1/home1/ctillman/tools/spm2/templates/T1.mnc';
    cfg.method = 'slice';
    cfg.funparameter = 'avg.pow';
    cfg.maskparameter = cfg.funparameter;
    cfg.funcolorlim = [0.0 1.2];
    cfg.opacitylim = [0.0 1.2];
    cfg.opacitymap = 'rampup';
    figure;
    sourceplot(cfg,sourceUprightDiffIntNorm);
    clear sourceUprightDiffIntNorm;
end

%%%%%%%%%%%%code for sourcestatistics%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

clear all;

path = '/net/M036-LFS1/srv/data1/home1/ctillman/data/MooneyMEEGFieldtripAnalysis/BeamformingFieldtrip/';

UprightPreNorm = {'MKA21_SourceUprightPreIntNorm.mat';
                  ..........more files......................

};

UprightPostNorm = {'MKA21_SourceUprightPostIntNorm.mat';
                   ...................more files......................
};

% 1. Load sourceUprightPreIntNorm
for i = 1:length(UprightPreNorm)
    fullnamePre = strcat(path,UprightPreNorm{i,1});
    UprightPre{i} = load(fullnamePre);
end

% Fix the structure properties for easier handling
for l = 1:size(UprightPre,2)
        UprightPre{l} = UprightPre{l}.sourceUprightPreIntNorm;
end

% 2. Load sourceUprightPostIntNorm
for i = 1:length(UprightPreNorm)
    fullnamePost = strcat(path,UprightPostNorm{i,1});
    UprightPost{i} = load(fullnamePost);
end

% Fix the structure properties for easier handling
for l = 1:size(UprightPost,2)
        UprightPost{l} = UprightPost{l}.sourceUprightPostIntNorm;
end

% prepare multisubject data for sourcestatistics (to identify common 'inside' voxels)
% using sourcegrandaverage
cfg = [];
cfg.keepindividual = 'yes';
PostGrandAvg = sourcegrandaverage(cfg,...
    UprightPost{1},...
    UprightPost{2},...
    UprightPost{3},...
    UprightPost{4},...
UprightPost{5},...
UprightPost{6},...
UprightPost{7},...
UprightPost{8},...
UprightPost{9},...
UprightPost{10},...
UprightPost{11},...
UprightPost{12},...
UprightPost{13},...
UprightPost{14},...
UprightPost{15},...
UprightPost{16},...
UprightPost{17});

cfg = [];
cfg.keepindividual = 'yes';
PreGrandAvg = sourcegrandaverage(cfg,...
    UprightPre{1},...
    UprightPre{2},...
    UprightPre{3},...
    UprightPre{4},...
UprightPre{5},...
UprightPre{6},...
UprightPre{7},...
UprightPre{8},...
UprightPre{9},...
UprightPre{10},...
UprightPre{11},...
UprightPre{12},...
UprightPre{13},...
UprightPre{14},...
UprightPre{15},...
UprightPre{16},...
UprightPre{17});


% 3. Compute source statistics (uncorrected at the moment)
cfg = [];
nSubjects = length(UprightPreNorm);
a = [1:nSubjects];
b = ones(1,nSubjects);
cfg.design = [a a; b (2*b)];
cfg.ivar = 2; % independent variable: condition
cfg.uvar = 1; % subjects
cfg.method = 'montecarlo';
cfg.numrandomization = 200;
cfg.parameter = 'pow';
cfg.statistic = 'depsamplesT';
sourceStat = sourcestatistics(cfg,PostGrandAvg,PreGrandAvg);
sourceStatOutfileName = strcat(path,'sourceStat.mat');
save(sourceStatOutfileName, 'sourceStat');

% 4. Plot statistics (code runs but plots are nonsensical)
load(strcat(path,'sourceStat.mat'));
MRIFilename = strcat(path, 'StandardMRI.mat');  % contains an MRI variable named StandardMRI
load(MRIFilename);
cfg = [];
cfg.funparameter = 'stat';
sourceInterp = sourceinterpolate(cfg, sourceStat, StandardMRI);
cfg = [];
cfg.method = 'slice';
cfg.funparameter = 'stat';
cfg.maskparameter = cfg.funparameter;
cfg.funcolorlim = [2.0 10.2];
cfg.opacitylim = [2.0 10.2];
cfg.opacitymap = 'rampup';
figure;
sourceplot(cfg, sourceInterp);




----------------------------------
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/fcdonders/fieldtrip.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Michael Wibral.vcf
Type: text/x-vcard
Size: 443 bytes
Desc: not available
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20071019/976d4481/attachment-0001.vcf>


More information about the fieldtrip mailing list