[FieldTrip] EEG source reconstruction using DICS method
"Jens Klinzing, Uni Tübingen"
jens.klinzing at uni-tuebingen.de
Thu Jan 19 10:09:15 CET 2017
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
> 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/2af1866c/attachment-0002.html>
More information about the fieldtrip
mailing list