[FieldTrip] EEG source reconstruction using DICS method
Elena Krugliakova
krugliakova.es at gmail.com
Thu Jan 19 13:55:49 CET 2017
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
[image: 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
[image: Inline images 2]
On 19 January 2017 at 10:09, "Jens Klinzing, Uni Tübingen" <
jens.klinzing at uni-tuebingen.de> wrote:
> 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 <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
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
>
>
> _______________________________________________
> fieldtrip mailing list
> 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/20170119/a679638f/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 144484 bytes
Desc: not available
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170119/a679638f/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 165407 bytes
Desc: not available
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170119/a679638f/attachment-0005.png>
More information about the fieldtrip
mailing list