<font color='black' size='2' face='arial'><font color="black" face="arial" size="2">

<div> Hi Johanna, <br>
<br>
<font size="2">yes, of course, that was my mistake! <br>
<font size="2">T<font size="2">hank you :-)!!! Now it is working! <br>
<br>
<font size="2">'nai' as cfg.funparameter is working fine. I think I also tried 'avg.nai' in the begin<font size="2">ning<font size="2"> and got</font> an error. <br>
<br>
<font size="2">All the best, <br>
<font size="2">Ninja</font><br>
</font><br>
</font></font></font></font></font>
</div>



<div> <br>

</div>



<div style="clear:both"><br>

</div>



<div> <br>

</div>



<div> <br>

</div>



<div style="font-family:arial,helvetica;font-size:10pt;color:black">-----Original Message-----<br>

From: fieldtrip-request <fieldtrip-request@science.ru.nl><br>

To: fieldtrip <fieldtrip@science.ru.nl><br>

Sent: Thu, Jan 24, 2013 5:32 pm<br>

Subject: fieldtrip Digest, Vol 26, Issue 35<br>









<div id="AOLMsgPart_0_29320680-66b1-403f-a524-7204045d4818" style="margin: 0px;font-family: Tahoma, Verdana, Arial, Sans-Serif;font-size: 12px;color: #000;background-color: #fff;">

<pre style="font-size: 9pt;"><tt>


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

Message: 3
Date: Thu, 24 Jan 2013 17:30:35 +0100
From: Johanna Zumer <<a href="mailto:johanna.zumer@donders.ru.nl">johanna.zumer@donders.ru.nl</a>>
To: FieldTrip discussion list <<a href="mailto:fieldtrip@science.ru.nl">fieldtrip@science.ru.nl</a>>
Subject: Re: [FieldTrip] lcmv beamform with common filter
Message-ID:
        <<a href="mailto:CAL4kA6fQKz7nFf+HtFdsbGTQD5YABGt3Ma0wCCvhEBDcsP75kg@mail.gmail.com">CAL4kA6fQKz7nFf+HtFdsbGTQD5YABGt3Ma0wCCvhEBDcsP75kg@mail.gmail.com</a>>
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 <<a href="mailto:ninja78278@aol.com">ninja78278@aol.com</a>>

>        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
> <a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a>
> <a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <<a href="http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20130124/98b1e6bc/attachment.html" target="_blank">http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20130124/98b1e6bc/attachment.html</a>>

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

_______________________________________________
fieldtrip mailing list
<a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a>

End of fieldtrip Digest, Vol 26, Issue 35
*****************************************
</tt></pre>
</div>

 <!-- end of AOLMsgPart_0_29320680-66b1-403f-a524-7204045d4818 -->



</div>

</font></font>