Hi,<div><br></div><div>I'm working on beamformer with MEG data, and having trouble making ft_sourceanalysis and/or ft_sourceinterpolate work. It appears that anatomical MRI and source data do not align, although anatomical MRI ("mri_aligned") and the result of ft_prepare_singleshell ("vol_cm") are both aligned with MEG helmet.</div>
<div><br></div><div>Is there any way I could verify that the output of ft_sourceanalysis is not distorted (i.e. same space as input)? I'm using fieldtrip-20110525 version.</div><div><br></div><div>Thanks in advance! Akiko  </div>
<meta charset="utf-8"><meta charset="utf-8"><div><br></div><div>Below is my code:</div><div>1. compute the common filter </div><div><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="1038.35">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier; min-height: 14.0px}
span.s1 {color: #b146f3}
</style>


<p class="p1">cfg = [];</p>
<p class="p1">cfg.grad            = data_common.grad; % data_common = baseline + left + right</p>
<p class="p1">cfg.grid.xgrid      = -15:0.5:15;</p>
<p class="p1">cfg.grid.ygrid      = -15:0.5:15;</p>
<p class="p1">cfg.grid.zgrid      = -15:0.5:15;</p>
<p class="p1">cfg.inwardshift     = -2;</p>
<p class="p1">cfg.vol             = vol_cm; % this is from segmented <span class="Apple-style-span" style="font-family: arial; font-size: small; ">"mri_aligned"</span></p><meta charset="utf-8">
<p class="p1">cfg.channel         = {<span class="s1">'all'</span>}; </p>
<p class="p1">cfg.reducerank      = 2;</p>
<p class="p1">cfg.frequency       = 10;</p>
<p class="p1">cfg.method          = <span class="s1">'dics'</span>;</p>
<p class="p1">cfg.projectnoise    = <span class="s1">'yes'</span>;</p>
<p class="p1">cfg.keepfilter      = <span class="s1">'yes'</span>;</p>
<p class="p1">cfg.feedback        = <span class="s1">'no'</span>;</p>
<p class="p1">cfg.realfilter      = <span class="s1">'yes'</span>;</p>
<p class="p1">cfg.lambda          = <span class="s1">'0.005%'</span>;</p>
<p class="p1">source_common       = ft_sourceanalysis(cfg, freq_common)</p>
<p class="p2"><br></p><meta charset="utf-8"><p class="p2"><span class="Apple-style-span" style="font-family: arial; font-size: small; ">2. compute the spatial filter for one of the conditions (using grid & filter from the step 1)</span> </p>

<p class="p1">cfg = [];</p>
<p class="p1">cfg.grad            = data_common.grad;</p>
<p class="p1">cfg.grid.pos        = source_common.pos; % using grid & filter from the common filter</p>
<p class="p1">cfg.grid.filter     = source_common.avg.filter;</p>
<p class="p1">cfg.vol             = vol_cm;</p>
<p class="p1">cfg.channel         = {<span class="s1">'all'</span>};</p>
<p class="p1">cfg.reducerank      = 2;</p>
<p class="p1">cfg.frequency       = 10;</p>
<p class="p1">cfg.method          = <span class="s1">'dics'</span>;</p>
<p class="p1">cfg.projectnoise    = <span class="s1">'yes'</span>;</p>
<p class="p1">cfg.keepfilter      = <span class="s1">'no'</span>;</p>
<p class="p1">cfg.feedback        = <span class="s1">'no'</span>;</p>
<p class="p1">cfg.realfilter      = <span class="s1">'yes'</span>;</p>
<p class="p1">cfg.lambda          = <span class="s1">'0.005%'</span>;</p>
<p class="p1">source_left         = ft_sourceanalysis(cfg, freq_stiml);</p>
<p class="p1">source_left.unit    = <span class="s1">'cm'</span>;</p>
<p class="p1">source_left.dim     = source_common.dim;</p><p class="p1"><br><span class="Apple-style-span" style="font-family: arial; font-size: small; ">3. calculate difference</span></p><p class="p1"><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="1038.35">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier}
</style>


</p><p class="p1">source_left_bl          = source_left;</p>
<p class="p1">source_left_bl.avg.pow  = source_left_bl.avg.pow ./ source_common.avg.pow;</p><p class="p1"><br></p><p class="p1"><meta charset="utf-8"><span class="Apple-style-span" style="font-family: arial; font-size: small; ">4. interpolate source to anatomical MRI space</span></p>
<p class="p1"><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="1038.35">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier}
span.s1 {color: #b146f3}
</style>


</p><p class="p1">cfg                 = [];</p>
<p class="p1">cfg.method          = <span class="s1">'linear'</span>;</p>
<meta charset="utf-8"><p class="p1">source_left_bl_int = ft_sourceinterpolate(cfg,<meta charset="utf-8"> source_left_bl,mri_aligned);</p><p></p><p></p></div><div><br></div><div>    </div>