<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
<div dir="ltr">
<div>Dear Fieldtrip community, <br>
<br>
<div>I have a question regarding source reconstruction using the 'dics' method applied to EEG data.
<br>
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?
<br>
<br>
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?<br>
<br>
</div>
<div>As a template I used <a href="http://www.fieldtriptoolbox.org/tutorial/beamformer">
http://www.fieldtriptoolbox.org/tutorial/beamformer</a><br>
</div>
<div>Please, find my script below.<br>
</div>
<div> <br>
Thank you in advance!<br>
<br>
</div>
<div>Kind Regards,<br>
</div>
<div>Elena <br>
</div>
<div><br>
</div>
<div><br>
</div>
Script:<br>
<br>
% freqanalysis<br>
cfg = [];<br>
cfg.toilim = [-0.5 -0.1]; % prestimulus<br>
Pre = ft_redefinetrial(cfg, MyData);<br>
cfg = [];<br>
cfg.toilim = [0.9 1.3]; % poststimulus<br>
Post = ft_redefinetrial(cfg, MyData);<br>
cfg = [];<br>
dataAll = ft_appenddata([], Pre, Post);<br>
<br>
cfg = [];<br>
cfg.method = 'mtmfft';<br>
cfg.output = 'powandcsd'<br>
cfg.keeptrials = 'no';<br>
cfg.taper = 'dpss';<br>
cfg.foi = 35;<br>
cfg.tapsmofrq = 4;<br>
<br>
freq_Pre = ft_freqanalysis(cfg, Pre);<br>
freq_Post = ft_freqanalysis(cfg, Post);<br>
freq_PrePost = ft_freqanalysis(cfg, dataAll);<br>
<br>
%% headmodel preparation --- with standard brain<br>
mri = ft_read_mri('Subject01.mri');<br>
cfg = [];<br>
cfg.dim = mri.dim;<br>
mri = ft_volumereslice(cfg,mri);<br>
<br>
cfg = [];<br>
cfg.output = {'gray','white','csf','skull','scalp'}<br>
segmentedmri = ft_volumesegment(cfg, mri);<br>
<br>
cfg = [];<br>
cfg.shift = 0.3;<br>
cfg.method = 'hexahedral';<br>
cfg.tissue = {'gray','white','csf','skull','scalp'}<br>
cfg.numvertices = [800, 800, 800, 400, 200];<br>
cfg.unit = segmentedmri.unit<br>
bndFEM = ft_prepare_mesh(cfg,segmentedmri);<br>
<br>
cfg = [];<br>
cfg.method ='simbio';<br>
cfg.conductivity = [0.33 0.14 1.79 0.01 0.43];<br>
vol_simbio_lowresol = ft_prepare_headmodel(cfg, bndFEM);<br>
<br>
</div>
%% loading aligned electrodes<br>
<div>load elec_aligned % 109 EEG electrodes<br>
<br>
%% leadfield preparation<br>
cfg = [];<br>
cfg.elec = elec_aligned;<br>
cfg.vol = vol_simbio_lowresol;<br>
cfg.channel = 'all';<br>
cfg.reducerank = 3; % 3 for eeg<br>
cfg.grid.unit = 'mm';<br>
cfg.grid.resolution = 10;<br>
leadfield_FEM_lowresol = ft_prepare_leadfield(cfg);<br>
<br>
%% sourceanalysis<br>
cfg = [];<br>
cfg.frequency = 35;<br>
cfg.vol = vol_simbio_lowresol;<br>
cfg.grid = leadfield_FEM_lowresol<br>
cfg.projectnoise = 'yes';<br>
cfg.method = 'dics';<br>
cfg.dics.projectnoise = 'yes';<br>
cfg.dics.lambda = '5%';<br>
cfg.dics.keepfilter = 'yes';<br>
cfg.dics.realfilter = 'yes';<br>
sourceAll = ft_sourceanalysis(cfg, freq_PrePost);<br>
cfg.grid.filter = sourceAll.avg.filter;<br>
<br>
sourcePre_con = ft_sourceanalysis(cfg, freq_Pre);<br>
<br>
sourcePost_con = ft_sourceanalysis(cfg, freq_Post);<br>
<br>
sourceDiff = sourcePost_con;<br>
sourceDiff.avg.pow = (sourcePost_con.avg.pow - sourcePre_con.avg.pow) ./ sourcePre_con.avg.pow;<br>
<br>
%% sourceplot<br>
cfg = [];<br>
cfg.downsample = 2;<br>
cfg.parameter = 'pow';<br>
sourceDiffInt = ft_sourceinterpolate(cfg, sourceDiff, mri);<br>
<br>
cfg = [];<br>
sourceDiffIntNorm = ft_volumenormalise(cfg, sourceDiffInt);<br>
<br>
cfg = [];<br>
cfg.method = 'glassbrain';<br>
cfg.funparameter = 'pow';<br>
cfg.maskparameter = cfg.funparameter;<br>
ft_sourceplot(cfg, sourceDiffIntNorm);<br>
<br>
<div><br>
</div>
</div>
</div>
</body>
</html>