[FieldTrip] lcmv beamform with common filter

Ninja Katja Horr ninja78278 at aol.com
Fri Jan 25 09:25:34 CET 2013


 Hi Johanna, 

yes, of course, that was my mistake! 
Thank you :-)!!! Now it is working! 

'nai' as cfg.funparameter is working fine. I think I also tried 'avg.nai' in the beginning and got an error. 

All the best, 
Ninja


 



 

 

-----Original Message-----
From: fieldtrip-request <fieldtrip-request at science.ru.nl>
To: fieldtrip <fieldtrip at science.ru.nl>
Sent: Thu, Jan 24, 2013 5:32 pm
Subject: fieldtrip Digest, Vol 26, Issue 35




------------------------------

Message: 3
Date: Thu, 24 Jan 2013 17:30:35 +0100
From: Johanna Zumer <johanna.zumer at donders.ru.nl>
To: FieldTrip discussion list <fieldtrip at science.ru.nl>
Subject: Re: [FieldTrip] lcmv beamform with common filter
Message-ID:
	<CAL4kA6fQKz7nFf+HtFdsbGTQD5YABGt3Ma0wCCvhEBDcsP75kg at mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

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.html>

------------------------------

_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl
http://mailman.science.ru.nl/mailman/listinfo/fieldtrip

End of fieldtrip Digest, Vol 26, Issue 35
*****************************************

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20130125/ba222784/attachment-0002.html>


More information about the fieldtrip mailing list