<div dir="ltr">Hello there FieldTrip Community,<div><br></div><div><br></div><div>  I'm Alex Williams, a neuroengineering graduate student at Florida Institute of Technology. I'm relatively new to source reconstruction methods and was wondering if there may be any pointers or advice that may help guide me through the tutorials and documentation. I've been trying to resolve an issue with the beamformer for some time. Currently, I'm using an LCMV beamformer to source fit participant MEG data and compare those results to source results that were obtained in SPM12.  Though I'm trying to create a pipeline for analyzing this data set, the results I've obtained seem to have discrepancies in source variance and virtual channel signal alongside having warped sourceplots when plotting source variance.  The meeg data, D, I'm using has been converted from SPM to fieldtrip using the function. spm2fieldtrip(). The converted data itself has been defined, and has undergone pre-processing and time-locking in SPM. </div><div><br></div><div>Steps I used: </div><div><br></div><div>1. The converted meeg data, D, I'm using has been converted from SPM to fieldtrip using the function. spm2fieldtrip(). The converted data itself has been defined, and has undergone pre-processing and epoching in SPM. Since I wasn't able to find the covariance matrix within the D structure I was using, I applied a time-lock analysis to the D structure I had and used only the covariance matrix from those results as the cfg.cov parameter within the D matrix pre-time lock.</div><div><br></div><div>2. ft_read_mri() used a .nifti MRI file and an empty configuration. Fiducials were taken and used in the configuration to realign the MRI using ft_volumerealign() with cfg.coordsys='neuromag'. After, segmentation was done using ft_volumesegment(), again with an empty configuration.</div><div><br></div><div>3. Headmodel computed using following parameters:</div><div><div style="padding:30px"><div style="font-size:13px;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">cfg = [];</div><div style="font-size:13px;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">cfg.method = <span style="color:rgb(167,9,245)">'singleshell'</span>;</div><div style="font-size:13px;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">cfg.siunits = <span style="color:rgb(167,9,245)">'yes'</span>;</div><div style="font-size:13px;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">cfg.feedback = <span style="color:rgb(167,9,245)">'yes'</span>;</div><div style="font-size:13px;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">headmodel = ft_prepare_headmodel(cfg, seg);</div><div style="font-size:13px;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">headmodel = ft_convert_units(headmodel, <span style="color:rgb(167,9,245)">'mm'</span>);</div></div></div><div><br></div><div>3. Gradiometer array was defined with ft_read_sens using the path of the meeg file. These were the parameters of the source model. </div><div><br></div><div><div style="padding:30px"><div style="font-size:13px;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">cfg = [];</div><div style="font-size:13px;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">cfg.grad = grad;</div><div style="font-size:13px;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">cfg.headmodel = headmodel;</div><div style="font-size:13px;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">cfg.resolution = 1;</div><div style="font-size:13px;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">cfg.inwardshift = 0;</div><div style="font-size:13px;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">sourcemodel = ft_prepare_sourcemodel(cfg);</div><div style="font-size:13px;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><br></div></div></div><div><div>Plotting leads to a segmented mri figure (segmented mri) and headmodel-sensor model (headmodel, sourcemodel mesh and sensor array).</div><div><br></div></div><div><br></div><div><br><div>4. After the forward model was run with prepare_leadmatrix () with following parameters:<br></div><div><div style="padding:30px"><div style="font-size:13px;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">cfg = [];</div><div style="font-size:13px;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">cfg.grad = grad;</div><div style="font-size:13px;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">cfg.headmodel = headmodel;</div><div style="font-size:13px;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">cfg.sourcemodel = sourcemodel;</div><div style="font-size:13px;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">cfg.channel = {<span style="color:rgb(167,9,245)">'MEG'</span>};</div><div style="font-size:13px;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">cfg.singleshell.batchsize = 2000;</div><div style="font-size:13px;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">lf = ft_prepare_leadfield(cfg,D);</div></div></div><div>5. And then the source model was run using an LCMV beamformer:</div><div><div style="padding:30px"><div style="font-size:13px;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><div style="padding:30px"><div><span style="color:rgb(14,0,255)">if </span>isfield(D,<span style="color:rgb(167,9,245)">'cov'</span>)</div><div>[~, sr, ~]=svd(D.cov);</div><div>clif=-diff(log10(diag(sr)));</div><div>kappa=find(clif==max(clif));</div><div><span style="color:rgb(14,0,255)">end</span></div></div></div><div style="font-size:13px;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">cfg = [];</div><div style="font-size:13px;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">cfg.method = <span style="color:rgb(167,9,245)">'lcmv'</span>;</div><div style="font-size:13px;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">cfg.headmodel = headmodel; <span style="color:rgb(0,128,19)">% volume conduction model (headmodel)</span></div><div style="font-size:13px;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">cfg.sourcemodel = lf; <span style="color:rgb(0,128,19)">% leadfield</span></div><div style="font-size:13px;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">cfg.lcmv.keepfilter = <span style="color:rgb(167,9,245)">'yes'</span>;</div><div style="font-size:13px;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">cfg.grad=D.grad;</div><div style="font-size:13px;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">cfg.keepleadfield = <span style="color:rgb(167,9,245)">'yes'</span>;</div><div style="font-size:13px;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">cfg.lcmv.fixedori = <span style="color:rgb(167,9,245)">'yes'</span>; <span style="color:rgb(0,128,19)">% project on axis of most variance using SVD</span></div><div style="font-size:13px;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">cfg.lcmv.kappa.      =kappa;</div></div></div><div>Which returns a source structure that seems to produce warped source variance plots and blown-up source variance values after using source interpolation using:                 <span style="font-family:Menlo,Monaco,Consolas,"Courier New",monospace;font-size:13px">ft_sourceinterpolate(cfg, source, segmentedmri):</span></div><div><span style="font-family:Menlo,Monaco,Consolas,"Courier New",monospace;font-size:13px"><br></span></div><div><img src="cid:ii_lw4csqcw3" alt="Screenshot 2024-05-12 at 10.37.15 PM.png" width="296" height="222" class="gmail-CToWUd gmail-a6T" tabindex="0" style="cursor: pointer; outline: 0px; margin-right: 0px;"><br></div><div><br></div><br><div>I'm currently trying different parameters within the beamformer including using different weight normalization parameters to compensate for possible depth bias alongside using different lambda values. However, based on the final source plots, I wasn't too sure if there may have also been an issue with the coregistration of the mri or perhaps with the final source model. <font color="#888888"><font color="#888888"><br></font></font></div><font color="#888888"><font color="#888888"><div><br></div><div>-Alex Williams</div></font></font></div></div>