<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
<div dir="ltr">
<div>
<div>
<div>
<div>
<div>
<div>Hi everyone,<br>
<br>
</div>
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).<br>
<br>
</div>
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:<br>
</div>
1) get a contralateral cluster or a number of voxels with maximum amplitude.<br>
</div>
2) extract the timecourses of those clusters, then average them.<br>
<br>
</div>
For step 1, it seem to have several options, either:<br>
</div>
1a) calculate the filter on the whole timecourse (a common filter as would be used in DICS)<br>
<div>
<div>1b) use that common filter to calculate the amplitude of the early component<br>
</div>
<div>1c) do the same for the baseline period<br>
</div>
<div>1d) subtract the baseline activation from the active period (or take a ratio)<br>
<br>
</div>
<div>Alternatively, I could:<br>
</div>
<div>2a) beamform the active period<br>
</div>
<div>2b) beamform the baseline period<br>
</div>
<div>2c) subtract the baseline activation from the active period (or take a ratio)<br>
<br>
</div>
<div>Or it seems, I might even:<br>
</div>
<div>3a) beamform the active period<br>
</div>
<div>3b) divide the active period by the projected noise<br>
<br>
</div>
<div>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?<br>
</div>
<div><br>
</div>
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?<br>
<br>
</div>
<div>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.<br>
<br>
</div>
<div>All the best and thanks,<br>
</div>
<div>Stephen<br>
<font size="1"><span style="font-family:monospace,monospace"><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><br>
 <br>
</font></div>
<div><font size="1"><br>
<br>
</font></div>
<div>
<div><br>
</div>
</div>
</div>
</body>
</html>