Dear Hanneke and FieldTripers,<br><br>Thank you Hanneke.<br><br>I extracted the single trial source signal using a time domain beamformer Please find below the script:<br><br>clear all<br>ds = sprintf('/rajamoni/MEG_ds/AEDTPJOU_nback_20050422_01-f.ds')<br>
cfg = [];<br>cfg.dataset = ds;<br>cfg.trialdef.eventtype  = '?';<br>definetrial(cfg);<br><br>cfg.trialdef.eventtype = 'r0';<br>cfg.trialdef.prestim  = 0.25;<br>cfg.trialdef.poststim = 0.25;<br>cfg = definetrial(cfg);<br>
data = preprocessing(cfg);<br>%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br><br>cfg.channel         = {'MEG','-MRF43', '-MRO13'};<br>cfg.latency            = [-0.25 0.25];<br>cfg.covariance         = 'yes';<br>
cfg.covariancewindow   = [-0.0 0.25];<br>cfg.keeptrials         = 'yes';<br>cfg.blcwindow          = [-0.25 0.25];<br>cfg.bpfreq             = [1 60];<br>[timelock] = timelockanalysis(cfg,data);<br><br>%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
ctf_ss = read_ctf_hdm('/rajamoni/AEDTPJOU_nback_20050422_01-f.ds/default.hdm');<br><br>cfg = [];<br>cfg.method   = 'lcmv'; %'rv'; %'mvl', % 'pcc'; 'loreta';  %'mne';<br>
cfg.grid.pos = [7.3 -3.9 3.9; 7.7 1.8,4.0]; %arbitrary source location<br>cfg.singletrial = 'yes';<br>cfg.rawtrial    = 'no';<br>cfg.keepfilter  = 'yes';<br>cfg.keepmom     = 'yes';<br>%cfg.hdmfile = strcat(ds, '/default.hdm');<br>
cfg.channel         = {'MEG','-MRF43', '-MRO13'};<br>cfg.vol = ctf_ss;<br>[source] = sourceanalysis(cfg, timelock);<br><br>% extraction of single trial source signals<br><br>% <br>%for trial all trials<br>
for i=1:66<br>trial{i}=source.trial(i).mom{1};   % 1 for the 1st source location and |||ly you could do for other source coord<br>trial{i}=sqrt((sum(trial{i}.*trial{i})));<br>end;<br><br>%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
<br>It seems to be working. I will report the other methods using freqanalysis after play with the FieldTrip for a while!!<br><br>Any comments?<br><br>-Vasan<br><br><br><div class="gmail_quote">On Tue, Dec 1, 2009 at 4:28 AM,  <span dir="ltr"><<a href="mailto:Hanneke.vanDijk@med.uni-duesseldorf.de">Hanneke.vanDijk@med.uni-duesseldorf.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">






<div>


<p><font size="2">Dear Vasan,<br>
<br>
I also feel single-trial source-analysis does work, I have done it and published it J Neurosci (using pcc for just power data).<br>
<br>
The problem as you sent it in the mail below is that the cfg.grid.pos that you entered is not inside your headmodel:<div class="im"><br>
0 dipoles inside, 1 dipoles outside brain<br>
<br></div>
There wil not be any data in there. You could try to plot the functional data interpolated on the mri with cfg.interactive = 'yes'; and then click on the location you want to do the single-trial analysis on. The coordinates will be printed in the workspace. These can be entered in cfg.grid.pos.<br>

<br>
If you have any more questions could you then send the cfg you used as well? This might give some hints as to what went wrong.<br>
<br>
It's just not the case that you can use some-one elses code and run your data through it. The choises you make for the data analysis depend a lot on the kind of data and what you want to do.<br>
But this mailing list is there to help you allong the way!<br>
<br>
Hope it helps,<br>
<br>
Best, Hanneke<br>
<br>
<br>
<br>
-----Oorspronkelijk bericht-----<br>
Van: Sreenivasan Rajamoni Nadar [<a href="mailto:sreenivasan.r.nadar@gmail.com" target="_blank">mailto:sreenivasan.r.nadar@gmail.com</a>]<br>
Verzonden: ma 30.11.2009 16:21<br>
Aan: van Dijk, Hanneke<br>
Onderwerp: Re: [FIELDTRIP] single trial source signal<div><div></div><div class="h5"><br>
<br>
Dear Hanneke,<br>
<br>
I did the freq analysis and source analysis as suggested by you. I get the<br>
following error:<br>
<br>
the input is freq data with 273 channels, 30 frequencybins and no timebins<br>
using headmodel specified in the configuration<br>
using gradiometers specified in the configuration<br>
creating dipole grid based on user specified dipole positions<br>
0 dipoles inside, 1 dipoles outside brain<br>
??? Error using ==> nearest>mbscalar at 47<br>
Argument to mbscalar must be scalar<br>
<br>
Error in ==> nearest at 15<br>
mbscalar(val);<br>
<br>
Error in ==> prepare_freq_matrices at 72<br>
fbin = nearest(freq.freq, cfg.frequency);<br>
<br>
Error in ==> sourceanalysis at 359<br>
    [Cf, Cr, Pr, Ntrials, tmpcfg] = prepare_freq_matrices(tmpcfg, data);<br>
<br>
~~~~~~~~~~~~~~~~~~~~~~~<br>
<br>
Do you know the way to fix it?<br>
<br>
Thanks, Vasan<br>
<br>
<br>
<br>
<br>
On Sun, Nov 29, 2009 at 3:38 AM, Hanneke Van Dijk <<br>
<a href="mailto:Hanneke.vanDijk@med.uni-duesseldorf.de" target="_blank">Hanneke.vanDijk@med.uni-duesseldorf.de</a>> wrote:<br>
<br>
> Dear Vasan,<br>
><br>
> Since I don't know exactly how far you are in doing the analysis, I just<br>
> send you the basic script that shows the most important parameters. Don't<br>
> forget to do freqanalysis with cfg.output = 'fourier' and cfg.method =<br>
> 'mtmfft' for the specific frequency (cfg.foilim) you want to focus on.<br>
><br>
> cfg                 = [];<br>
> cfg.grid.pos        = location of source coordinate;% [x y z] to fill in<br>
> cfg.frequency       = frequency of interest;<br>
> cfg.vol             = headmodel; %to make yourself see<br>
> <a href="http://fieldtrip.fcdonders.nl/example/make_leadfields_using_different_headmodels" target="_blank">http://fieldtrip.fcdonders.nl/example/make_leadfields_using_different_headmodels</a><br>
> cfg.projectnoise    = 'yes';%to compute the neural activity index using<br>
> sourcedescriptives<br>
> cfg.lambda          = '10%';%the amount of noice to estimate estimated<br>
> cfg.method          = 'pcc';<br>
> cfg.keeptrials      = 'yes';<br>
> Virtual_channeldata = sourceanalysis(cfg,freq);<br>
><br>
> You can do sourcedescriptives after that.<br>
><br>
> 'help freqanalysis', 'help sourceanalysis' and 'help sourcedescriptives'<br>
> should also help you further. Or you could have a look at the fieldtrip<br>
> website. There are a lot of options to taylor the analysis to your data.<br>
><br>
> Hope this helps!<br>
><br>
> Best,<br>
><br>
> Hanneke van Dijk<br>
><br>
> ------------------------------------------------------------<br>
> Institute for Clinical Neuroscience and Medical Psychology<br>
> Heinrich Heine Universitaet, Duesseldorf, Germany<br>
> ------------------------------------------------------------<br>
><br>
> -----Oorspronkelijk bericht-----<br>
> Van: FieldTrip discussion list namens Rajamoni Nadar, Sreenivasan<br>
> (NIH/NIMH) [E]<br>
> Verzonden: do 26.11.2009 14:53<br>
> Aan: <a href="mailto:FIELDTRIP@NIC.SURFNET.NL" target="_blank">FIELDTRIP@NIC.SURFNET.NL</a><br>
> Onderwerp: [FIELDTRIP] single trial source signal<br>
><br>
> FieldTrip Users,<br>
><br>
> Is it possible to get single trial source signal using FieldTrip? I would<br>
> appreciate if anybody could provide code for the same.<br>
><br>
> Thank you,<br>
> Vasan<br>
> ----------------------------------<br>
> The aim of this list is to facilitate the discussion between users of the<br>
> FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG<br>
> and EEG analysis. See also<br>
> <a href="http://listserv.surfnet.nl/archives/fieldtrip.html" target="_blank">http://listserv.surfnet.nl/archives/fieldtrip.html</a> and<br>
> <a href="http://www.ru.nl/neuroimaging/fieldtrip" target="_blank">http://www.ru.nl/neuroimaging/fieldtrip</a>.<br>
><br>
><br>
> ----------------------------------<br>
> The aim of this list is to facilitate the discussion between users of the<br>
> FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG<br>
> and EEG analysis. See also<br>
> <a href="http://listserv.surfnet.nl/archives/fieldtrip.html" target="_blank">http://listserv.surfnet.nl/archives/fieldtrip.html</a> and<br>
> <a href="http://www.ru.nl/neuroimaging/fieldtrip" target="_blank">http://www.ru.nl/neuroimaging/fieldtrip</a>.<br>
><br>
<br>
<br>
</div></div></font>
</p>

</div>
</blockquote></div><br>
<p>----------------------------------</p>
<p>The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis.</p>
<p>  http://listserv.surfnet.nl/archives/fieldtrip.html</p>
<p>  http://www.ru.nl/fcdonders/fieldtrip/</p>