[FieldTrip] Multiple source inversion problems for group MNE analysis

Peter Goodin pgoodin at swin.edu.au
Thu May 1 07:30:41 CEST 2014


Hi Fieldtrip list,

I'm trying to do group source analysis using MNE but have run into a bit of a snag.

After running ft_sourceanalysis (data is 1600ms / 901 data points, source model has been made via SPM (8196 verticies), head model through segmentation of the individual's MRI - all looks to be aligned, similar to the output of SPM (see  and plots sensibly using ft_sourcemovie) I've tried running ft_sourceinterpolation using the data on an individual's MRI (freshly read in using ft_read_mri) or the SPM T1 template (also using ft_read_mri).

If using the individual's MRI (dimensions = 256 256 176), with or without downsampling, after an hour or so I get an out of memory error and that's that. Running it with the template works fine and is finished ~90 seconds. The results using ft_sourceplot (ortho method) however don't look right (see interp.jpg). Additionally there's no field in the interpolated's cfg about anatomy afterward.

So taking another route and just trying to use ft_sourcegrandaverage on the output of ft_sourcelocalisation I'm met with
"??? Error using ==> ft_sourcegrandaverage at 111
different grid locations in source reconstructions"

I have absolutely no idea what I'm doing wrong and would appreciate any help. An abridged version of the script I'm using for mass conversion to source space is below:


    sourcemodel = ft_read_headshape(gii_list(i,:)); <-- this is the ...2cortex_8196.surf.gii mesh from spm

    mri = ft_read_mri([structdir mri_list(i,1:end-2)]); <--- individual participant's raw MRI in nii form.

    cfg = [];
    cfg.coordsys = 'spm';
    cfg.output = {'brain'};
    seg = ft_volumesegment(cfg, mri);

    cfg = [];
    cfg.method = 'singleshell';
    conductionmodel = ft_prepare_headmodel(cfg, seg);

    conductionmodel = ft_convert_units(conductionmodel,'cm');
    conductionmodel = ft_convert_units(conductionmodel,'mm');


 %%Check everything's aligned correctly:

    figure;hold on;
    subplot(1,2,1), ft_plot_vol(conductionmodel, 'facecolor', [0 0 1]);alpha 0.5;
    ft_plot_mesh(sourcemodel, 'edgecolor', [0 1 0]); camlight
    ft_plot_sens(sens, 'style', 'r*');
    subplot(1,2,2), ft_plot_vol(conductionmodel, 'facecolor', [0 0 1]);alpha 0.5;
    ft_plot_mesh(sourcemodel, 'edgecolor', [0 1 0]); camlight
    ft_plot_sens(sens, 'style', 'r*'); view([90 0]);
    view([90 0])
    gcf;
    suptitle([gii_list(i,2:5) ' source model']);
    saveas(gcf, [gii_list(i,2:6) 'source model.tiff']);
    close(gcf);

    assignin('base', [gii_list(i,2:6) 'sourcemodel'], sourcemodel); <--- rename hold variable to participant number
    assignin('base', [gii_list(i,2:6) 'conductionmodel'], conductionmodel); <--- ditto

    save([gii_list(i,2:6) 'model'], [gii_list(i,2:6) 'sourcemodel'], [gii_list(i,2:6) 'conductionmodel'], '-v6');

%% CREATE LEADFIELD & LOCALISED DATA

    load(sens_data_list(i,:)); <--- Load sensor space condition data
    conds_list = (who('*nback*av'))  <--- Create participant specific list

    datcm = eval(conds_list{1,1});
    dat = datcm;
    dat.grad = ft_convert_units(datcm.grad, 'mm');

    %Leadfield goes here <--- Mostly taken from the tutorial

    cfg = [];
    cfg.grad = dat.grad; % sensor positions
    cfg.channel = 'MEG'; % the used channels
    cfg.grid.pos = sourcemodel.pnt; % source points <---Does this have something to do with the problem?
    cfg.grid.inside = 1:size(sourcemodel.pnt,1); % all source points are inside of the brain <--- Or this?
    cfg.vol = conductionmodel; % volume conduction model
    leadfield = ft_prepare_leadfield(cfg);

    assignin('base', [conds_list{1,1} '_leadfield'], leadfield);
    save([gii_list(i,2:6) 'model'], [conds_list{1,1} '_leadfield'], '-v6', '-append');

    clear dat;

    for k = 1:size(conds_list,1);
        disp('---');
        disp(['Creating source data for ' conds_list{k,1}]);
        disp('---');
        datcm = eval(conds_list{k,1});
        dat = datcm;
        dat.grad = ft_convert_units(datcm.grad, 'mm');

    %Inversion goes here  <--- Mostly taken from the tutorial
        cfg  = [];
        cfg.method = 'mne';
        cfg.grid = leadfield;
        cfg.vol = conductionmodel;
        cfg.mne.prewhiten = 'yes';
        cfg.mne.lambda = 3;
        cfg.mne.scalesourcecov = 'yes';
        sourcedat = ft_sourceanalysis(cfg,dat);

        assignin('base', [conds_list{k,1} '_source'], sourcedat);

        k = k + 1;
    end

%%General saving stuff

        a = who('*C_av_source');
        b = a(1:2:end,1);

        save([sourcedatadir gii_list(i,2:6) 'condep_conds'], char(b(1,1)), '-v6');

        for l = 2:size(b,1);
            save([sourcedatadir gii_list(i,2:6) 'condep_conds'], char(b(l,1)), '-append', '-v6');
            l = l + 1;
        end

       save([sourcedatadir gii_list(i,2:6) 'source'],  '*_source', '-v6');

Thanks again,

Peter

__________________________
Peter Goodin,
BSc (Hons), Ph.D Candidate.

Brain and Psychological Sciences Research Centre (BPsych)
Swinburne University,
Hawthorn, Vic, 3122
http://www.swinburne.edu.au/swinburneresearchers/index.php?fuseaction=profile&pid=4149

Monash Alfred Psychiatry Research Centre (MAPrc)
Level 4, 607 St Kilda Road,
Melbourne 3004
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20140501/c440f173/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: interp.jpg
Type: image/jpeg
Size: 17514 bytes
Desc: interp.jpg
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20140501/c440f173/attachment.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: c112_source model.tiff
Type: image/tiff
Size: 233110 bytes
Desc: c112_source model.tiff
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20140501/c440f173/attachment.tiff>


More information about the fieldtrip mailing list