[FieldTrip] EEG source reconstruction using DICS method
Elena Krugliakova
krugliakova.es at gmail.com
Mon Jan 9 12:48:20 CET 2017
Dear Fieldtrip community,
I have a question regarding source reconstruction using the 'dics' method applied to EEG data.
I have two problems: first, even with 32GB of RAM it takes 9 hours to call one ft_sourceanalysis. Maybe, there is a way to optimise the procedure somehow?
Second, at the end of analysis I obtain a very strange figure, on which I see activity localised outside the mri scan. Mistake on which step of analysis might cause this problem?
As a template I used http://www.fieldtriptoolbox.org/tutorial/beamformer
Please, find my script below.
Thank you in advance!
Kind Regards,
Elena
Script:
% freqanalysis
cfg = [];
cfg.toilim = [-0.5 -0.1]; % prestimulus
Pre = ft_redefinetrial(cfg, MyData);
cfg = [];
cfg.toilim = [0.9 1.3]; % poststimulus
Post = ft_redefinetrial(cfg, MyData);
cfg = [];
dataAll = ft_appenddata([], Pre, Post);
cfg = [];
cfg.method = 'mtmfft';
cfg.output = 'powandcsd'
cfg.keeptrials = 'no';
cfg.taper = 'dpss';
cfg.foi = 35;
cfg.tapsmofrq = 4;
freq_Pre = ft_freqanalysis(cfg, Pre);
freq_Post = ft_freqanalysis(cfg, Post);
freq_PrePost = ft_freqanalysis(cfg, dataAll);
%% headmodel preparation --- with standard brain
mri = ft_read_mri('Subject01.mri');
cfg = [];
cfg.dim = mri.dim;
mri = ft_volumereslice(cfg,mri);
cfg = [];
cfg.output = {'gray','white','csf','skull','scalp'}
segmentedmri = ft_volumesegment(cfg, mri);
cfg = [];
cfg.shift = 0.3;
cfg.method = 'hexahedral';
cfg.tissue = {'gray','white','csf','skull','scalp'}
cfg.numvertices = [800, 800, 800, 400, 200];
cfg.unit = segmentedmri.unit
bndFEM = ft_prepare_mesh(cfg,segmentedmri);
cfg = [];
cfg.method ='simbio';
cfg.conductivity = [0.33 0.14 1.79 0.01 0.43];
vol_simbio_lowresol = ft_prepare_headmodel(cfg, bndFEM);
%% loading aligned electrodes
load elec_aligned % 109 EEG electrodes
%% leadfield preparation
cfg = [];
cfg.elec = elec_aligned;
cfg.vol = vol_simbio_lowresol;
cfg.channel = 'all';
cfg.reducerank = 3; % 3 for eeg
cfg.grid.unit = 'mm';
cfg.grid.resolution = 10;
leadfield_FEM_lowresol = ft_prepare_leadfield(cfg);
%% sourceanalysis
cfg = [];
cfg.frequency = 35;
cfg.vol = vol_simbio_lowresol;
cfg.grid = leadfield_FEM_lowresol
cfg.projectnoise = 'yes';
cfg.method = 'dics';
cfg.dics.projectnoise = 'yes';
cfg.dics.lambda = '5%';
cfg.dics.keepfilter = 'yes';
cfg.dics.realfilter = 'yes';
sourceAll = ft_sourceanalysis(cfg, freq_PrePost);
cfg.grid.filter = sourceAll.avg.filter;
sourcePre_con = ft_sourceanalysis(cfg, freq_Pre);
sourcePost_con = ft_sourceanalysis(cfg, freq_Post);
sourceDiff = sourcePost_con;
sourceDiff.avg.pow = (sourcePost_con.avg.pow - sourcePre_con.avg.pow) ./ sourcePre_con.avg.pow;
%% sourceplot
cfg = [];
cfg.downsample = 2;
cfg.parameter = 'pow';
sourceDiffInt = ft_sourceinterpolate(cfg, sourceDiff, mri);
cfg = [];
sourceDiffIntNorm = ft_volumenormalise(cfg, sourceDiffInt);
cfg = [];
cfg.method = 'glassbrain';
cfg.funparameter = 'pow';
cfg.maskparameter = cfg.funparameter;
ft_sourceplot(cfg, sourceDiffIntNorm);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170109/6968429b/attachment-0001.html>
More information about the fieldtrip
mailing list