[FieldTrip] EEG source reconstruction using DICS method
Pelt, S. van (Stan)
stan.vanpelt at donders.ru.nl
Thu Feb 2 08:55:05 CET 2017
Dear Elena,
A late follow-up to Jens’ reply regarding the greenish colors outside the brain. I think it simply has to do with you colormap settings. Zero-values will be green according to the colormap of your first plot, but black according to the colormap of your second plot. See also http://www.fieldtriptoolbox.org/development/tutorial/plotting (search for ‘colormap’).
Best,
Stan
From: fieldtrip-bounces at science.ru.nl [mailto:fieldtrip-bounces at science.ru.nl] On Behalf Of "Jens Klinzing, Uni Tübingen"
Sent: woensdag 25 januari 2017 10:29
To: FieldTrip discussion list <fieldtrip at science.ru.nl>
Subject: Re: [FieldTrip] EEG source reconstruction using DICS method
Dear Elena,
I'm glad the first problem is solved.
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.
Best,
Jens
Elena Krugliakova<mailto:krugliakova.es at gmail.com>
Donnerstag, 19. Januar 2017 13:55
Dear Jens,
Thank you for your answer!
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.
2. About homogeneous "noise outside the mri scan".
Noise appears after I calculate difference between two sources, following tutorial http://www.fieldtriptoolbox.org/tutorial/beamformer. However, sourceplot for not-contrasted conditions looks good. Maybe you could give me an advice, how to get rid of this background noise.
Kind Regards,
Elena
With difference calculation:
cfg = [];
cfg.elec = elec;
cfg.headmodel = vol;
cfg.grid = leadfield;
cfg.keepleadfield = 'yes'
cfg.projectnoise = 'yes';
cfg.frequency = [10 15];
cfg.method = 'dics';
cfg.dics.projectnoise = 'yes';
cfg.dics.lambda = '5%';
cfg.dics.keepfilter = 'yes';
cfg.dics.realfilter = 'yes';
sourcePNandBS = ft_sourceanalysis(cfg, freq_PNandBS);
cfg.grid.filter = sourcePNandBS.avg.filter;
sourcePN = ft_sourceanalysis(cfg, freq_PN_Post);
sourceBS = ft_sourceanalysis(cfg, freq_BS_Post);
sourceDiff.avg.pow = (sourcePN.avg.pow - sourceBS.avg.pow) ./ sourceBS.avg.pow;
cfg = [];
cfg.parameter = 'avg.pow';
sourceDiffInt = ft_sourceinterpolate(cfg, sourceDiff, mri);
cfg = [];
sourceDiffIntNorm = ft_volumenormalise(cfg, sourceDiffInt);
cfg = [];
cfg.method = 'ortho';
cfg.funparameter = 'avg.pow';
cfg.maskparameter = cfg.funparameter;
cfg.opacitymap = 'rampup';
ft_sourceplot(cfg, sourceDiffIntNorm);
figure
[Inline images 1]
Without difference calculation:
cfg = [];
cfg.elec = elec;
..........
sourcePNandBS = ft_sourceanalysis(cfg, freq_PNandBS);
cfg.grid.filter = sourcePNandBS.avg.filter;
sourcePN = ft_sourceanalysis(cfg, freq_PN_Post);
sourcePN.avg.pow = sourcePN.avg.pow ./ sourcePN.avg.noise;
cfg = [];
cfg.parameter = 'avg.pow';
sourcePN = ft_sourceinterpolate(cfg, sourcePN, mri);
cfg = [];
sourcePNIntNorm = ft_volumenormalise(cfg, sourcePNInt);
cfg = [];
cfg.method = 'ortho';
cfg.funparameter = 'avg.pow';
cfg.maskparameter = cfg.funparameter;
cfg.opacitymap = 'rampup';
ft_sourceplot(cfg, sourcePNIntNorm);
figure
[Inline images 2]
_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
Jens Klinzing, Uni Tübingen<mailto:jens.klinzing at uni-tuebingen.de>
Donnerstag, 19. Januar 2017 10:09
Dear Elena,
Question 1:
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 http://bugzilla.fieldtriptoolbox.org/show_bug.cgi?id=1967 .
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.
Alternatively you could use a BEM headmodel (dipoli if possible since bemcp seems to have issues http://bugzilla.fieldtriptoolbox.org/show_bug.cgi?id=2817).
Question 2:
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?
Best,
Jens
Elena Krugliakova<mailto:krugliakova.es at gmail.com>
Montag, 9. Januar 2017 12:48
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);
_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170202/009df75f/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 72582 bytes
Desc: image002.png
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170202/009df75f/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image004.png
Type: image/png
Size: 85220 bytes
Desc: image004.png
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170202/009df75f/attachment-0003.png>
More information about the fieldtrip
mailing list