[FieldTrip] lcmv beamform with common filter

Johanna Zumer johanna.zumer at donders.ru.nl
Thu Jan 24 17:30:35 CET 2013


Hi Ninja,

Not counting the issues with ft_sourceplot, my first observation is that I
think you are confusing what is common for the common filter that you are
creating.   source_post.avg.filter  is common over both conditions for the
post-stimulus window only, meaning that it can be applied to

source_post_cond1 = ft_sourceanalysis (cfg,timelock_post_cond1)
or
source_post_cond2 = ft_sourceanalysis (cfg,timelock_post_cond2)

But not to
source_pre_cond1 = ft_sourceanalysis (cfg,timelock_pre_cond1);.   You need
a filter computed from source_pre for this.

Alternativey, have 1 overall filter common to both condtions and both time
windows. (i.e. Use the time window [-.2 .2] and all conditions to create
this filter).

Specific to your sourceplot question, I'm less familiar with this, and
hopefully someone else can answer, but is it a problem that you call
cfg.funparameter
= 'nai';?  or does it need to be 'avg.nai'?

Cheers,
Johanna




2013/1/24 Ninja Katja Horr <ninja78278 at aol.com>

>        Dear Fieldtrip-Users,
>
> I am trying to do lcmv beamform sourceanalysis with a common filter for
> all conditions (same session, different trials defined with ft_preprocessing
> belong to different conditions,sequence of conditions randomly intermixed
> for each block).
> However if I use the common filter calculated from one block (consisting of
> 57 trials) ft_sourceplot doesn't show any activity anymore (if I run each
> condition separately without common filters it is working).
>
> Here is how I proceed:
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
> % MAKE TIMELOCKANALYSIS FOR COMPLETE BLOCK
>
> cfg = [];
> cfg.channel='MEG';
> cfg.keeptrials='yes';
> cfg.blc='yes';
> cfg.blcwindow = [-0.2 0]
> data = ft_timelockanalysis(cfg,data);
>
> cfg = [];
> cfg.channel = 'MEG'
> cfg.covariance ='yes';
> cfg.covariancewindow = [0 0.2];
> cfg.removemean = 'no';
> cfg.keeptrials = 'yes';
> timelock_post = ft_timelockanalysis(cfg,data);
> cfg.covariancewindow = [-0.2 0];
> timelock_pre = ft_timelockanalysis(cfg,data);
>
> %MAKE SOURCEANALYSIS FOR COMPLETE BLOCK AND KEEP FILTER
>
> cfg = [];
> cfg.method = 'lcmv';
> cfg.grid = grid.grid;
> cfg.vol = vol.vol;
> cfg.grad = grad.grad;
> cfg.keeptrials='yes';
> cfg.lcmv.lamda = '5%';
> cfg.lcmv.keepfilter = 'yes';
> source_post = ft_sourceanalysis(cfg,timelock_post);
> source_pre = ft_sourceanalysis(cfg,timelock_pre);
>
> source_post.avg.nai = source_post.avg.pow./source_pre.avg.pow;
>
> %MAKE TIMELOCKANALYSIS OF SPECIFIC CONDITIONS
>
> cfg = [];
> cfg.trials=cond1; %this picks out the trials belonging to condition1
> cfg.channel ='MEG';
> cfg.keeptrials='yes';
> cfg.blc = 'yes';
> cfg.blcwindow = [-02 0];
> data=ft_timelockanalysis(cfg,data);
>
> cfg =[];
> cfg.channel='MEG';
> cfg.covariance='yes';
> cfg.covariancewindow=[0 0.2];
> cfg.removemean ='no';
> cfg.keeptrials='yes';
> timelock_post_cond1 = ft_timelockanalysis(cfg,data);
> timelock_pre_cond1 = ft_timelockanalysis(cfg,data);
>
> %MAKE SOUCEANALYSIS OF SPECIFIC CONDITION USING THE COMMON FILTER OF THE
> BLOCK
>
> cfg = [];
> cfg.method = 'lcmv';
> cfg.grid = grid.grid;
> cfg.grid.filter=source_post.avg.filter;
> cfg.lcmv.keepfilter='no';
> cfg.keeptrials = 'yes';
> cfg.vol = vol.vol;
> cfg.grad=grad.grad;
> cfg.lcmv.lambda='5%';
>
> source_post_cond1 = ft_sourceanalysis (cfg,timelock_post_cond1);
> source_pre_cond1 = ft_sourceanalysis (cfg,timelock_pre_cond1);
>
> source_post_cond1.avg.nai =
> source_post_cond1.avg.pow./source_pre_cond1.avg.pow;
>
> %PLOT
>
> source_post_cond1.pos = template.pos;
> source_post_cond1.dim = template.dim;
> source_post_cond1.xgrid = template.xgrid;
> source_post_cond1.ygrid = template.ygrid;
> source_post_cond1.zgrid = template.zgrid;
>
> cfg = [];
> cfg.parameter =' avg.nai';
> interp_cond1 = ft_sourceinterpolate (cfg,source_post_cond1,mri);
>
> cfg = [];
> cfg.funparameter = 'nai';
> cfg.method = 'ortho';
> cfg.location = 'max';
> cfg.funcolorlim = [1.5 2.0];
>
> ft_sourceplot (cfg,interp_cond1);
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
> I also tried it using rawtrials, but with the same outcome (no activation
> visible in sourceplot).
> As I said, doing the same thing for cond1 without using the common filter
> works perfectly fine.
>
> Does anybody have an idea what might be my mistake?.
>
> Thank you a lot for your help!
>
> Ninja
>
>
>
>
>
>
>
>
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20130124/98b1e6bc/attachment-0001.html>


More information about the fieldtrip mailing list