<html><head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head><body bgcolor="#FFFFFF" text="#000000">Dear Elena,<br>
I'm glad the first problem is solved. <br>
<br>
About the second one: Are you referring to the yellowish background
outside of the brain? My first guess would be that this is a mere
plotting issue. Can you check whether there actually are non-NAN or even
non-zero values for grid points marked as 'outside' (before
interpolation and before and after contrasting)? If not, you know it is a
problem with the plotting.<br>
<br>
Best,<br>
Jens<br>
<span>
</span><br>
<blockquote style="border: 0px none;"
cite="mid:CACnpnhQuabYFA3ToZMRBr8s4wQwfj1RZD_fqJs-mksM0ST86Zw@mail.gmail.com"
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">Donnerstag,
19. Januar 2017 13:55</span></font></div> </div></div>
<div style="color:#909AA4;margin-left:24px;margin-right:24px;"
__pbrmquotes="true" class="__pbConvBody"><div dir="ltr"><div><div><div><div>Dear
Jens,<br><br></div>Thank you for your answer!<br></div>1. Indeed, I
found where ft_sourceanalysis starts to recompute transfer matrix and
just loaded precomputed headmodel and sensors. Now everything is fine,
and it takes several seconds to run ft_sourceanalysis.<br></div>2. About
homogeneous "noise outside the mri scan". <br>Noise appears after I
calculate difference between two sources, following tutorial <a
moz-do-not-send="true"
href="http://www.fieldtriptoolbox.org/tutorial/beamformer">http://www.fieldtriptoolbox.org/tutorial/beamformer</a>.
However, sourceplot for not-contrasted conditions looks good. Maybe you
could give me an advice, how to get rid of this background noise.<br><br></div><div>Kind
Regards,<br></div><div>Elena<br><br><br><br></div><div><br>With
difference calculation:<br><br>cfg = [];<br>cfg.elec
= elec;<br>cfg.headmodel = vol;<br>cfg.grid =
leadfield;<br>cfg.keepleadfield = 'yes' <br>cfg.projectnoise
= 'yes';<br>cfg.frequency = [10 15];<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>sourcePNandBS = ft_sourceanalysis(cfg,
freq_PNandBS);<br>cfg.grid.filter = sourcePNandBS.avg.filter;<br>sourcePN
= ft_sourceanalysis(cfg, freq_PN_Post);<br>sourceBS =
ft_sourceanalysis(cfg, freq_BS_Post);<br><b>sourceDiff.avg.pow =
(sourcePN.avg.pow - sourceBS.avg.pow) ./ sourceBS.avg.pow;</b><br><br>cfg
= [];<br>cfg.parameter = 'avg.pow';<br>sourceDiffInt =
ft_sourceinterpolate(cfg, sourceDiff, mri);<br><br>cfg = [];<br>sourceDiffIntNorm
= ft_volumenormalise(cfg, sourceDiffInt);<br><br>cfg = [];<br>cfg.method
= 'ortho';<br>cfg.funparameter = 'avg.pow';<br>cfg.maskparameter =
cfg.funparameter;<br>cfg.opacitymap = 'rampup'; <br>ft_sourceplot(cfg,
sourceDiffIntNorm);<br><br></div> figure<br><div><img name="image.png"
alt="Inline images 1" src="cid:part1.05090806.00080807@uni-tuebingen.de"
height="249" width="332"><div><br><br><br> <br>Without difference
calculation:<br><br>cfg = [];<br>cfg.elec
= elec;<br>.......... <br>sourcePNandBS =
ft_sourceanalysis(cfg, freq_PNandBS);<br><br>cfg.grid.filter =
sourcePNandBS.avg.filter;<br><br>sourcePN =
ft_sourceanalysis(cfg, freq_PN_Post);<br>sourcePN.avg.pow =
sourcePN.avg.pow ./ sourcePN.avg.noise;<br><br>cfg = [];<br>cfg.parameter
= 'avg.pow';<br>sourcePN = ft_sourceinterpolate(cfg, sourcePN, mri);<br><br>cfg
= [];<br>sourcePNIntNorm = ft_volumenormalise(cfg, sourcePNInt);<br><br>cfg
= [];<br>cfg.method = 'ortho';<br>cfg.funparameter = 'avg.pow';<br>cfg.maskparameter
= cfg.funparameter;<br>cfg.opacitymap = 'rampup'; <br>ft_sourceplot(cfg,
sourcePNIntNorm);<br><br></div><div>figure<br><img name="image.png"
style="margin-right: 0px;" alt="Inline images 2"
src="cid:part2.00060603.08040800@uni-tuebingen.de" height="286"
width="381"><br></div></div></div><div class="gmail_extra"><br><br></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>
<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:jens.klinzing@uni-tuebingen.de" style="color:#485664
!important;padding-right:6px;font-weight:500;text-decoration:none
!important;">Jens Klinzing, Uni Tübingen</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">Donnerstag,
19. Januar 2017 10:09</span></font></div> </div></div>
<div style="color:#909AA4;margin-left:24px;margin-right:24px;"
__pbrmquotes="true" class="__pbConvBody">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
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 moz-do-not-send="true"
href="http://bugzilla.fieldtriptoolbox.org/show_bug.cgi?id=1967"
class="moz-txt-link-freetext">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 moz-do-not-send="true"
href="http://bugzilla.fieldtriptoolbox.org/show_bug.cgi?id=2817"
class="moz-txt-link-freetext">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>
<br>
</div>
<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=UTF-8" 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>