<html><head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
</head><body bgcolor="#FFFFFF" text="#000000">Dear Elena,<br>
<br>
Question 1:<br>
I assume the reason it takes so long is that you are using a FEM-based
headmodel. For FEM, ft_sourceanalysis computes a huge transfer matrix
on-the-fly (by calling prepare_headmodel - ft_prepare_vol_sens -
sb_transfer) every time you do a source reconstruction. For more
information see
<a class="moz-txt-link-freetext" href="http://bugzilla.fieldtriptoolbox.org/show_bug.cgi?id=1967">http://bugzilla.fieldtriptoolbox.org/show_bug.cgi?id=1967</a> .<br>
<br>
You can circumvent the issue by computing the transfer matrix beforehand
and changing the code in a way that it doesnt compute a new transfer
matrix if you have already provided one. <br>
<br>
Alternatively you could use a BEM headmodel (dipoli if possible since
bemcp seems to have issues
<a class="moz-txt-link-freetext" href="http://bugzilla.fieldtriptoolbox.org/show_bug.cgi?id=2817">http://bugzilla.fieldtriptoolbox.org/show_bug.cgi?id=2817</a>).<br>
<br>
Question 2:<br>
Did you check your segmentation, the headmodel and the coregistration of
electrodes/head every step of the way? If you fill all inside voxels
with 1s and plot that, do you see an obvious shift/rotation of the
"activity" in relation to the MRI?<br>
<br>
Best,<br>
Jens<br>
<blockquote style="border: 0px none;"
cite="mid:7cd6ae18b167496c939bc39a69057d44@EXPRD01.hosting.ru.nl"
type="cite">
<div style="margin:30px 25px 10px 25px;" class="__pbConvHr"><div
style="width:100%;border-top:2px solid #EDF1F4;padding-top:10px;"> <div
style="display:inline-block;white-space:nowrap;vertical-align:middle;width:49%;">
<a moz-do-not-send="true" href="mailto:krugliakova.es@gmail.com"
style="color:#485664
!important;padding-right:6px;font-weight:500;text-decoration:none
!important;">Elena Krugliakova</a></div> <div
style="display:inline-block;white-space:nowrap;vertical-align:middle;width:48%;text-align:
right;"> <font color="#909AA4"><span style="padding-left:6px">Montag,
9. Januar 2017 12:48</span></font></div> </div></div>
<div style="color:#909AA4;margin-left:24px;margin-right:24px;"
__pbrmquotes="true" class="__pbConvBody">
<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
<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 moz-do-not-send="true"
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>
<div>_______________________________________________<br>fieldtrip
mailing list<br><a class="moz-txt-link-abbreviated" href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br><a class="moz-txt-link-freetext" href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></div></div>
</blockquote>
<br>
</body></html>