<div dir="ltr">Hi everyone. Thanks so much for your responses so far. They are very clarifying.<div><div><br></div><div>Anyway, after browsing the mailinglist archive I found two related Q&A:<br></div><div><br></div><div>This clears up the lack of differences, because the covariance is calculated during ft_timelockanalysis, and changing the latency/timewindow later has no effect: <br><a href="http://mailman.science.ru.nl/pipermail/fieldtrip/2009-February/001965.html">http://mailman.science.ru.nl/pipermail/fieldtrip/2009-February/001965.html</a></div><div><br></div><div>When it comes to the common filter etc. this conversation was somewhat helpful, at least how to compute it: </div><div><a href="http://mailman.science.ru.nl/pipermail/fieldtrip/2013-January/006120.html">http://mailman.science.ru.nl/pipermail/fieldtrip/2013-January/006120.html</a><br></div><div><br></div><div>Although these problems are solved now and I have "results", they are still confusing. They do not look totally out-there, but they are certainly not unequivocal. After trying out different options I see that the covariance timewindow of the common filter makes a big difference. It seems I get the best (or at least better) results when this is restricted to the post-stimulus window in the time-period of component I am interested in. See attachment - blue brains.</div><div><br></div><div>However, before I go any further I am somewhat on my toes because projecting the power of the active or baseline period seems strangely shifted to the anterior. See attachment - red brains.</div><div><br></div><div>Your comments have been very helpful thinking about the common filter. I actually now wonder whether it is a good idea at all in my case. One other thing could try is to somehow calculate a common filter by concatenating the baseline period and the active component period before doing calculating the covariance.</div><div>Or, alternatively, I could calculate the common filter over the whole post-stimulus interval (of say 300ms instead of 30ms of my component of interest), similarly as Johanna has done here: <a href="http://www.ncbi.nlm.nih.gov/pmc/articles/PMC2899153/#R28">http://www.ncbi.nlm.nih.gov/pmc/articles/PMC2899153/#R28</a></div><div><br></div><div>Best and thanks,<br></div><div>Stephen</div><div><br></div><div>p.s. I attached my script. </div><div><br></div><div><br></div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 17 July 2015 at 09:46, Jörn M. Horschig <span dir="ltr"><<a href="mailto:jorn@artinis.com" target="_blank">jorn@artinis.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="#0563C1" vlink="#954F72"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">whoopsy, saw your code just now - so I take that back ;) <u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p><div><p class="MsoNormal"><b><span style="font-size:9.0pt;font-family:"Verdana",sans-serif;color:#626264">--<u></u><u></u></span></b></p><p class="MsoNormal"><b><span style="font-size:9.0pt;font-family:"Verdana",sans-serif;color:#255a9e"><u></u> <u></u></span></b></p><p class="MsoNormal"><b><span style="font-size:9.0pt;font-family:"Verdana",sans-serif;color:#255a9e">Jörn M. Horschig, PhD</span></b><span style="font-size:9.0pt;font-family:"Verdana",sans-serif;color:#626264">, Software Engineer</span><b><span style="font-size:9.0pt;font-family:"Verdana",sans-serif;color:black"><u></u><u></u></span></b></p><p class="MsoNormal"><span lang="NL" style="font-size:9.0pt;font-family:"Verdana",sans-serif;color:#626264"><a href="http://www.artinis.com/" target="_blank"><span lang="EN-US" style="color:#626264">Artinis Medical Systems</span></a></span><span style="font-size:9.0pt;font-family:"Verdana",sans-serif;color:#626264"> | <a href="tel:%2B31%20481%20350%20980" value="+31481350980" target="_blank">+31 481 350 980</a> </span><b><span style="font-size:9.0pt;font-family:"Verdana",sans-serif;color:#255a9e"><u></u><u></u></span></b></p></div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p><div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt"><div><div style="border:none;border-top:solid #e1e1e1 1.0pt;padding:3.0pt 0in 0in 0in"><p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> <a href="mailto:fieldtrip-bounces@science.ru.nl" target="_blank">fieldtrip-bounces@science.ru.nl</a> [mailto:<a href="mailto:fieldtrip-bounces@science.ru.nl" target="_blank">fieldtrip-bounces@science.ru.nl</a>] <b>On Behalf Of </b>Stephen Whitmarsh<br><b>Sent:</b> Friday, July 17, 2015 12:04 AM<br><b>To:</b> fieldtrip, donders<br><b>Subject:</b> [FieldTrip] Advice on using LCMV beamformer<u></u><u></u></span></p></div></div><p class="MsoNormal"><u></u> <u></u></p><div><div><div><div><div><div><div><p class="MsoNormal" style="margin-bottom:12.0pt">Hi everyone,<u></u><u></u></p></div><p class="MsoNormal" style="margin-bottom:12.0pt">I hope there is someone out there who has some time to help me with using LCMV beamformer. I have no experience with it yet, although a little with DICS, and understand they are at least conceptually very similar. However, I am running into some questions. Before I go on, my data on sensor level looks good and it works out with dipolefitting as well (attached).<u></u><u></u></p></div><p class="MsoNormal">I would like to beamform an early (unilaterally stimulated) sensory evoked field. There is no conditional difference, I would just like to extract the timecourse of some maximum voxels. In other words:<u></u><u></u></p></div><p class="MsoNormal">1) get a contralateral cluster or a number of voxels with maximum amplitude.<u></u><u></u></p></div><p class="MsoNormal" style="margin-bottom:12.0pt">2) extract the timecourses of those clusters, then average them.<u></u><u></u></p></div><p class="MsoNormal">For step 1, it seem to have several options, either:<u></u><u></u></p></div><p class="MsoNormal">1a) calculate the filter on the whole timecourse (a common filter as would be used in DICS)<u></u><u></u></p><div><div><p class="MsoNormal">1b) use that common filter to calculate the amplitude of the early component<u></u><u></u></p></div><div><p class="MsoNormal">1c) do the same for the baseline period<u></u><u></u></p></div><div><p class="MsoNormal" style="margin-bottom:12.0pt">1d) subtract the baseline activation from the active period (or take a ratio)<u></u><u></u></p></div><div><p class="MsoNormal">Alternatively, I could:<u></u><u></u></p></div><div><p class="MsoNormal">2a) beamform the active period<u></u><u></u></p></div><div><p class="MsoNormal">2b) beamform the baseline period<u></u><u></u></p></div><div><p class="MsoNormal" style="margin-bottom:12.0pt">2c) subtract the baseline activation from the active period (or take a ratio)<u></u><u></u></p></div><div><p class="MsoNormal">Or it seems, I might even:<u></u><u></u></p></div><div><p class="MsoNormal">3a) beamform the active period<u></u><u></u></p></div><div><p class="MsoNormal" style="margin-bottom:12.0pt">3b) divide the active period by the projected noise<u></u><u></u></p></div><div><p class="MsoNormal">Do I get this correctly? Does anyone have an argument for one of these option?<br><br>Anyway, first practical problem is that when I plot either the whole, the baseline or the activation period I get the same results (attached). A difference therefore doesn't work, obviously. So this raises the question how the selection of latency works in ft_sourceanalysis? I trust cfg.latency works, but it doesn't seem to make a difference for me. At the same time, using selectdata to select a time period doesn't make a difference either. I'm obviously doing something wrong, but what?<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><p class="MsoNormal" style="margin-bottom:12.0pt">Anyway, when I get this figured out, I still need to extract the timecourses. How would I proceed doing this? I imagine the fastest way would not be to loop ft_sourceanalysis for each timepoint (using a common filter I would think). Should I 'manually' multiply the data with the filter?<u></u><u></u></p></div><div><p class="MsoNormal" style="margin-bottom:12.0pt">It would be great to have some feedback on the general idea, and perhaps someone can identify what I am doing wrong (script below). I would be happy to finish the LCMV beamformer tutorial on the FT website once I get it figured out, as I can imagine more people would have these questions.<u></u><u></u></p></div><div><p class="MsoNormal">All the best and thanks,<u></u><u></u></p></div><div><p class="MsoNormal">Stephen<br><span style="font-size:7.5pt;font-family:"Courier New""><br><br>% timelock average + covariance<br><br>cfg = [];<br>cfg.covariance = 'yes';<br>cfg.covariancewindow = 'all';<br>cfg.trials = find(clean_data.trialinfo(:,2) == 1);<br>ERF_single{isubject} = ft_timelockanalysis(cfg,clean_data);<br>cfg.trials = find(clean_data.trialinfo(:,2) == 2);<br>ERF_double{isubject} = ft_timelockanalysis(cfg,clean_data);<br><br>% combine gradiometers (single stim)<br>cfg = [];<br>ERF_single_cmb{isubject} = ft_combineplanar(cfg,ERF_single{isubject});<br>ERF_double_cmb{isubject} = ft_combineplanar(cfg,ERF_double{isubject});<br><br>% load headmodel MEG<br>temp = load(['/home/stephen/analysis/metacognition/sourcemodel/pp_' num2str(isubject) '_headmodel_singleshell.mat']);<br>headmodel_meg{isubject} = temp.headmodel_meg;<br><br>% headmodel_meg = ft_convert_units(headmodel_meg, 'cm');<br>gridtemp = load(['/home/stephen/analysis/metacognition/sourcemodel/pp_' num2str(isubject) '_grid.mat']);<br><br>hdr = ft_read_header(flist{1});<br>cfg = [];<br>cfg.grad = hdr.grad;<br>cfg.vol = headmodel_meg{isubject};<br>cfg.grid = gridtemp.grid;<br>cfg.channel = {'MEGGRAD'};<br>cfg.normalize = 'yes';<br>leadfield = ft_prepare_leadfield(cfg);<br><br>% get the filter<br>cfg = [];<br>cfg.method = 'lcmv';<br>cfg.grid = leadfield;<br>cfg.vol = headmodel_meg{isubject};<br>cfg.keepfilter = 'yes';<br>cfg.senstype = 'meg';<br>cfg.channel = 'meggrad';<br>cfg.lcmv.fixedori = 'yes'; % use only right gradiometers<br>cfg.reducerank = 2;<br>source_lcmv_single{isubject} = ft_sourceanalysis(cfg, ERF_single{isubject});<br>source_lcmv_double{isubject} = ft_sourceanalysis(cfg, ERF_double{isubject});<br><br>% project post stim latency with previous common filter<br><br>cfg = [];<br>cfg.latency = latency;<br>ERF_single_latency{isubject} = ft_selectdata(cfg,ERF_single{isubject});<br><br>cfg = [];<br>cfg.method = 'lcmv';<br>cfg.grid = leadfield;<br>cfg.vol = headmodel_meg{isubject};<br>cfg.grid.filter = source_lcmv_single{isubject}.avg.filter;<br>cfg.channel = 'meggrad';<br>cfg.senstype = 'meg';<br>% cfg.latency = latency;<br>cfg.lcmv.fixedori = 'yes'; <br>cfg.reducerank = 2;<br>source_lcmv_single_latency{isubject} = ft_sourceanalysis(cfg, ERF_single_latency{isubject});<br><br>% baseline<br><br>cfg = [];<br>cfg.latency = [-0.2 0];<br>ERF_single_baseline{isubject} = ft_selectdata(cfg,ERF_single{isubject});<br><br>cfg = [];<br>cfg.method = 'lcmv';<br>cfg.grid = leadfield;<br>cfg.vol = headmodel_meg{isubject};<br>cfg.grid.filter = source_lcmv_single{isubject}.avg.filter;<br>cfg.channel = 'meggrad';<br>cfg.senstype = 'meg';<br>% cfg.latency = latency;<br>cfg.lcmv.fixedori = 'yes'; <br>cfg.reducerank = 2;<br>source_lcmv_single_baseline{isubject} = ft_sourceanalysis(cfg, ERF_single_baseline{isubject});<br><br>% get difference between baseline and component<br>source_lcmv_single_diff{isubject} = source_lcmv_single_latency{isubject};<br>source_lcmv_single_diff{isubject}.avg.pow = source_lcmv_single_latency{isubject}.avg.pow - source_lcmv_single_baseline{isubject}.avg.pow;<br><br>template_mri = ft_read_mri(['/opt/fieldtrip/external/spm8/templates/T1.nii']);<br><br>cfg = [];<br>cfg.voxelcoord = 'no';<br>cfg.parameter = 'avg.pow';<br>cfg.interpmethod = 'nearest';<br>source_lcmv_single_int{isubject} = ft_sourceinterpolate(cfg, source_lcmv_single{isubject}, template_mri);<br>source_lcmv_single_latency_int{isubject} = ft_sourceinterpolate(cfg, source_lcmv_single_latency{isubject}, template_mri);<br>source_lcmv_single_diff_int{isubject} = ft_sourceinterpolate(cfg, source_lcmv_single_diff{isubject}, template_mri);<br><br>cfg = [];<br>cfg.method = 'slice';<br>cfg.funparameter = 'avg.pow';<br>cfg.maskparameter = cfg.funparameter;<br>cfg.funcolorlim = [3e-22 5e-22];<br>% ft_sourceplot(cfg,source_lcmv_single_latency_int{isubject});<br>% ft_sourceplot(cfg,source_lcmv_single_int{isubject});<br>ft_sourceplot(cfg,source_lcmv_single_latency_int{isubject});<br><br>cfg = [];<br>cfg.method = 'slice';<br>cfg.funparameter = 'pow';<br>cfg.funcolorlim = [-1e-23 1e-23];<br>ft_sourceplot(cfg,source_lcmv_single_diff_int{isubject});</span><span style="font-size:7.5pt"><br> </span><u></u><u></u></p></div><div><p class="MsoNormal" style="margin-bottom:12.0pt"><u></u> <u></u></p></div><div><div><p class="MsoNormal"><u></u> <u></u></p></div></div></div></div></div></div><br>_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br></blockquote></div><br></div>