<div dir="ltr">Hi community,<div><br></div><div>I have an issue with Fieltrip SAM beamformer 'gareth' method. </div><div><br></div><div>As a sanity check I look that the BF weight distributions are biased towards the center. I check this distribution with the leadfields and with the BF weights from LCMV and SAMs methods. Gareth method does not have this distribution, the weight sizes are scattered across the brain and the norm of the weights can have up to 11 orders of magnitude of difference. </div><div><br></div><div>First I make sure that the 1/Leadfield are also biased towards the center:</div><div> - for every LF I take the norm of every column and 1/mean of the norms is the value.</div><div>- the code is:</div><div>
<p class="gmail-p1">LF_norm = [];</p>
<p class="gmail-p1"><span class="gmail-s1">for</span><span class="gmail-Apple-converted-space"> </span>s= 1:size(LF, 1)</p>
<p class="gmail-p1"><span class="gmail-Apple-converted-space"> </span>n1 = norm(squeeze(LF(s, 1, :)));</p>
<p class="gmail-p1"><span class="gmail-Apple-converted-space"> </span>n2 = norm(squeeze(LF(s, 2, :)));</p>
<p class="gmail-p1"><span class="gmail-Apple-converted-space"> </span>n3 = norm(squeeze(LF(s, 3, :)));</p>
<p class="gmail-p2"><span class="gmail-Apple-converted-space"> </span><span class="gmail-Apple-converted-space"> </span>LF_norm(s) =1/mean([n1, n2, n3]);</p>
<p class="gmail-p3">end</p><p class="gmail-p3">When interpolated to the mri and plotted looks fine.</p><p class="gmail-p3"><br></p><p class="gmail-p3">Then I run SAM robert method:</p><p class="gmail-p1">cfg = [];</p><p class="gmail-p1">cfg.method<span class="gmail-Apple-converted-space"> </span>= <span class="gmail-s1">'sam'</span>;</p><p class="gmail-p1">cfg.grid<span class="gmail-Apple-converted-space"> </span>= lf;</p><p class="gmail-p1">cfg.vol <span class="gmail-Apple-converted-space"> </span>= headmodel;</p><p class="gmail-p1">cfg.grad<span class="gmail-Apple-converted-space"> </span>= data.grad;</p><p class="gmail-p1">cfg.fixedori<span class="gmail-Apple-converted-space"> </span>= <span class="gmail-s1">'robert'</span>;</p><p class="gmail-p1">cfg.keepfilter<span class="gmail-Apple-converted-space"> </span>= <span class="gmail-s1">'yes'</span>;</p><p class="gmail-p1">cfg.keepori <span class="gmail-Apple-converted-space"> </span>= <span class="gmail-s1">'yes'</span>;</p><p class="gmail-p1">cfg.projectnoise<span class="gmail-Apple-converted-space"> </span>= <span class="gmail-s1">'yes'</span>;</p><p class="gmail-p1">cfg.senstype<span class="gmail-Apple-converted-space"> </span>= <span class="gmail-s1">'MEG'</span>;</p><p class="gmail-p1">SAM1_filter <span class="gmail-Apple-converted-space"> </span>= ft_sourceanalysis(cfg, timelock);</p><p class="gmail-p1"><br></p><p class="gmail-p3">
</p><p class="gmail-p2">and take the norm for every BF weight:</p><p class="gmail-p2">
</p><p class="gmail-p1">SAM1_filter_norm= cellfun(@(X) norm(X),SAM1_filter.avg.filter(SAM1_filter.inside));</p><p class="gmail-p3">and then I interpolate it to the mri for visualization. The results look fine, weights biased towards the center and the min and max norm weight are two orders of magnitude difference. The mean of the absolute of the weights norm is in the order of 10e9 and the smallest and highest weight norm are to the order of e8 and e10</p><p class="gmail-p3"><br></p><p class="gmail-p3">If I do the same as the last step but changing to:</p><p class="gmail-p3">
</p><p class="gmail-p1">cfg.fixedori<span class="gmail-Apple-converted-space"> </span>= <span class="gmail-s1">'gareth'</span>;</p><p class="gmail-p1">Then the weights are not biased towards the center. The mean of the absolute of the weights norm is in the order of 10e16 and the smallest and highest weight norm are to the order e8 and e19, respectively.</p><p class="gmail-p1">Thus, gareth method does not have a center biased weight distribution and the max and miminum norm weights have 11 orders of magnitude of difference, meaning that these orders are reflected in the amplitude of the reconstructed time series. </p><p class="gmail-p1"><br></p><p class="gmail-p1">To make it handy the difference between gareth and robert methods are:</p><p class="gmail-p1">L is the leadfield for a given source.</p><p class="gmail-p1">'Gareth'</p><p class="gmail-p1"><span class="gmail-Apple-converted-space"> </span>Y1 = L' * inv_cov * L;</p><p class="gmail-p1"><span class="gmail-Apple-converted-space"> </span>Y2 = L' * (inv_cov * inv_cov) * L;</p><p class="gmail-p1"><span class="gmail-Apple-converted-space"> </span>[U,S] = eig(Y2,Y1);</p><p class="gmail-p1">'Robert'</p><p class="gmail-p1">
</p><p class="gmail-p1"><span class="gmail-Apple-converted-space"> </span>[U,S] = svd(real(pinv(L' * inv_cov * L)));<br></p><p class="gmail-p1"><br></p><p class="gmail-p1">Then both methods compute 2 of the orientations and choose the salient one:</p><p class="gmail-p1">ori1 = U(:,1); ori1 = ori1/norm(ori1);</p><p class="gmail-p1">ori2 = U(:,2); ori2 = ori2/norm(ori2);</p><p class="gmail-p1">L1 = L * ori1;</p><p class="gmail-p1">
</p><p class="gmail-p1">L2 = L * ori2;</p><p class="gmail-p1"><span class="gmail-Apple-converted-space"> </span><span class="gmail-s1">if</span> (norm(L1)/norm(L2)) < 1e-6</p><p class="gmail-p1"><span class="gmail-Apple-converted-space"> </span>opt_vox_or = ori2;</p><p class="gmail-p1"><span class="gmail-Apple-converted-space"> </span><span class="gmail-s1">else</span></p><p class="gmail-p1"><span class="gmail-Apple-converted-space"> </span>opt_vox_or = ori1;</p><p class="gmail-p1">
</p><p class="gmail-p1"><span class="gmail-s1">end</span></p><p class="gmail-p1"><br></p><p class="gmail-p1"> The difference comes from the way orientations are computed, after the weights calculation is the same for both. </p><p class="gmail-p1">I tried with different units, i.e. meters, cm, mm but this abnormalities is still present.<br></p><p class="gmail-p1"><br></p><p class="gmail-p1">Does anybody know what can be the cause? <br></p><p class="gmail-p1"><br></p><p class="gmail-p1">Thanks</p><p class="gmail-p1">Adonay</p></div><div><br></div></div>