<p class="MsoNormal" style="line-height:200%"><span lang="EN-US" style="font-size:12.0pt;line-height:200%;font-family:"Times New Roman","serif"">Hello;</span></p><p class="MsoNormal" style="line-height:200%">
<span lang="EN-US" style="font-size:12.0pt;line-height:200%;font-family:"Times New Roman","serif"">I have few problems while calculating combine “MEG & EEG” source
reconstruction and I need your help to troubleshoot the problems.</span></p>
<p class="MsoNormal" style="line-height:200%"><span lang="EN-US" style="font-size:12.0pt;line-height:200%;font-family:"Times New Roman","serif"">I have a data from a Parkinson’s disease patient who underwent DBS and
we recorded 306 MEG channels and 64 EEG channels simultaneously, first I have
calculated the leadfield individually for both EEG and MEG. </span></p>
<p class="MsoNormal" style="line-height:200%"><span lang="EN-US" style="font-size:12.0pt;line-height:200%;font-family:"Times New Roman","serif"">I have defined all the calculations step by step so that I can describe
my problems very precisely. </span></p>
<p class="MsoNormal" style="line-height:200%"><b><u><span lang="EN-US" style="font-size:12.0pt;line-height:200%;font-family:"Times New Roman","serif"">CALCULATE THE
LEADFIELD FOR MEG CHANNELS:-</span></u></b></p>
<p class="MsoNormal" style="line-height:200%"><span lang="EN-US" style="font-size:12.0pt;line-height:200%;font-family:"Times New Roman","serif"">// I have defined the Pre-Stimulus data i.e. Stim-off data in the
original code.</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><u><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman","serif"">Reading raw data set for MEG channels</span></u></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><u><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman","serif""> </span></u></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg = []; </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.dataset = ‘</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:#a020f0">ap_rest_stimon_bi_2_5ma.fif'</span><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">; </span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.trialdef.eventtype = </span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:#a020f0">'?'</span><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">;</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.trialdef.triallength = 1;</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.trialdef.poststim = 88;</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'"> </span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg = ft_definetrial(cfg);</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'"> </span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.trl = cfg.trl(1:88,:); //
Read 88 trials </span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'"> </span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.channel = {</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:#a020f0">'MEG'</span><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">}; </span><b><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman","serif"">// In order to read raw data only for MEG channels</span></b><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'"> </span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:forestgreen"> </span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">dataFIC12 = ft_preprocessing(cfg);</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'"> </span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""> </span></p>
<p class="MsoNormal" style="line-height:200%"><span lang="EN-US" style="font-size:12.0pt;line-height:200%;font-family:"Times New Roman","serif"">After that I have defined the <u>time of window of interest</u> for the
MEG raw data set</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.toilim = [0 0.5]; </span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">dataPost = ft_redefinetrial(cfg, dataFIC12);</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""> </span></p>
<p class="MsoNormal" style="line-height:200%"><span lang="EN-US" style="font-size:12.0pt;line-height:200%;font-family:"Times New Roman","serif"">and calculate the <u>Power Spectral density matrix</u> for the MEG
channels data set</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg = [];</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.method = </span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:#a020f0">'mtmfft'</span><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">;</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.output = </span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:#a020f0">'powandcsd'</span><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">;</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.tapsmofrq = 2;</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.foilim = [129 129]; </span><span lang="EN-US" style="font-size:12pt;font-family:'Times New Roman',serif">// Frequency of interest is 129 Hz the stimulation frequency </span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.pad = 1;</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">freqPost = ft_freqanalysis(cfg, dataPost);</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""> </span></p>
<p class="MsoNormal" style="line-height:200%"><span lang="EN-US" style="font-size:12.0pt;line-height:200%;font-family:"Times New Roman","serif"">Now next step for me is to choose the method for the Head Model. I have
noticed that Singlesphere is the common method which can be used for both EEG
and MEG. So I have selected the singlesphere method for the calculation of
volume conduction model.</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">mri = ft_read_mri(‘</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:#a020f0">ms1879865-0004-00001-000192-01.img'</span><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">); // READ MRI</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg = [];</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.write = </span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:#a020f0">'no'</span><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">;</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.coordsys = </span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:#a020f0">'ctf'</span><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">;</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">segmentedmri1 = ft_volumesegment(cfg, mri); // Calculate the segmented
mri</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg = [];</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.method = </span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:#a020f0">'singlesphere'</span><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">; // </span><b><span lang="EN-US" style="font-size:10pt;font-family:'Times New Roman',serif">METHOD</span></b><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'"> </span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">vol1 = ft_prepare_headmodel(cfg, segmentedmri1);</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:12pt;font-family:'Times New Roman',serif">Now next step is to calculate the LEADFIELD </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:12pt;font-family:'Times New Roman',serif"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg = [];</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.grad =
freqPost.grad;</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.vol = vol1;</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.reducerank = 2; // MEG</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.channel = {</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:#a020f0">'MEG'</span><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">}; </span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.grid.resolution = 1; // I choose a resolution 1</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:forestgreen"> </span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">[grid1] = ft_prepare_leadfield(cfg);</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New"">disp(grid1)</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> xgrid:
[-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7]</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> ygrid:
[-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8]</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> zgrid:
[-4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11]</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> dim:
[15 16 16]</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> pos:
[3840x3 double]</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> unit:
'cm'</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> inside:
[1x2037 double]</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> outside:
[1x1803 double]</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> cfg:
[1x1 struct]</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> leadfield:
{1x3840 cell}</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> </span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> </span></b></p>
<p class="MsoListParagraph" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:12.0pt;font-family:Wingdings">Ø<span style="font-size:7pt;font-family:'Times New Roman'"> </span></span><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman","serif"">It has to be noticed that Inside Dipole is 2037.</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> </span></b></p>
<p class="MsoNormal" style="line-height:200%"><b><u><span lang="EN-US" style="font-size:12.0pt;line-height:200%;font-family:"Times New Roman","serif"">CALCULATE THE
LEADFIELD FOR EEG CHANNELS:-</span></u></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><u><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman","serif"">Reading raw data set for EEG channels</span></u></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><u><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman","serif""> </span></u></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg = []; </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.dataset = ‘</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:#a020f0">ap_rest_stimon_bi_2_5ma.fif'</span><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">; </span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.trialdef.eventtype = </span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:#a020f0">'?'</span><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">;</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.trialdef.triallength = 1;</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.trialdef.poststim = 88;</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'"> </span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg = ft_definetrial(cfg);</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'"> </span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.trl = cfg.trl(1:88,:); //
Read 88 trials </span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'"> </span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.channel = {</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:#a020f0">'EEG'</span><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">}; </span><b><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman","serif"">// In order to read raw data only for EEG channels</span></b><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'"> </span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:forestgreen"> </span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">dataFIC12 = ft_preprocessing(cfg);</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'"> </span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""> </span></p>
<p class="MsoNormal" style="line-height:200%"><span lang="EN-US" style="font-size:12.0pt;line-height:200%;font-family:"Times New Roman","serif"">After that I have defined the <u>time of window of interest</u> for the
EEG raw data set</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.toilim = [0 0.5]; </span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">dataPost = ft_redefinetrial(cfg, dataFIC12);</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""> </span></p>
<p class="MsoNormal" style="line-height:200%"><span lang="EN-US" style="font-size:12.0pt;line-height:200%;font-family:"Times New Roman","serif"">and calculate the <u>Power Spectral density matrix</u> for the EEG
channels data set</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg = [];</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.method = </span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:#a020f0">'mtmfft'</span><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">;</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.output = </span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:#a020f0">'powandcsd'</span><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">;</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.tapsmofrq = 2;</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.foilim = [129 129]; </span><span lang="EN-US" style="font-size:12pt;font-family:'Times New Roman',serif">// Frequency of interest is 129 Hz</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.pad = 1;</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">freqPost = ft_freqanalysis(cfg, dataPost);</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><u><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman","serif"">HEAD MODEL FOR EEG</span></u></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman","serif""> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">mri = ft_read_mri(‘</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:#a020f0">ms1879865-0004-00001-000192-01.img'</span><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">);</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg = [];</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.write = </span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:#a020f0">'no'</span><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">;</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.coordsys = </span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:#a020f0">'ctf'</span><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">;</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">segmentedmri2 = ft_volumesegment(cfg, mri);</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'"> </span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'"> </span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg = [];</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.method = </span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:#a020f0">'singlesphere'</span><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">; // METHOD</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">vol2 = ft_prepare_headmodel(cfg, segmentedmri2);</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><u><span lang="EN-US" style="font-size:12pt;font-family:'Times New Roman',serif">LEADFIELD:</span></u><u><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman","serif""></span></u></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg = [];</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.elec = freqPost.elec; </span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.vol = vol2;</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.reducerank = 3; </span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:forestgreen">% 3 for EEG</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.channel = {</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:#a020f0">'EEG'</span><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">};</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.grid.resolution = 9.54; </span><span lang="EN-US" style="font-size:12pt;font-family:'Times New Roman',serif">// Increase the resolution so that the
inside dipoles for </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:12pt;font-family:'Times New Roman',serif">
EEG should be close to the inside dipoles of MEG
</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman","serif""> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">[grid2] = ft_prepare_leadfield(cfg);</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New"">disp(grid2)</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> xgrid:
[1x16 double]</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> ygrid:
[1x16 double]</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> zgrid:
[1x13 double]</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> dim:
[16 16 13]</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> pos:
[3328x3 double]</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> unit:
'mm'</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> inside:
[1x2038 double]</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> outside:
[1x1290 double]</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> cfg:
[1x1 struct]</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> leadfield:
{1x3328 cell}</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""> </span></p>
<p class="MsoListParagraph" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:12.0pt;font-family:Wingdings">Ø<span style="font-size:7pt;font-family:'Times New Roman'"> </span></span><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman","serif"">It has to be noticed that Inside Dipole is 2038.</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""> </span></p>
<p class="MsoNormal" style="line-height:200%"><b><u><span lang="EN-US" style="font-size:12.0pt;line-height:200%;font-family:"Times New Roman","serif"">Concatenate of
MEG and EEG LEADFIELD:-</span></u></b></p>
<p class="MsoNormal" style="line-height:200%"><span lang="EN-US" style="font-size:12.0pt;line-height:200%;font-family:"Times New Roman","serif"">Now I have the individual LEADFIELD of both MEG and EEG grid1 and grid2
respectively.</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New"">disp(grid1)</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> xgrid:
[-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7]</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> ygrid:
[-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8]</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> zgrid:
[-4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11]</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> dim:
[15 16 16]</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> pos:
[3840x3 double]</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> unit:
'cm'</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> inside:
[1x2037 double]</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> outside:
[1x1803 double]</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> cfg:
[1x1 struct]</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> leadfield:
{1x3840 cell}</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> </span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New"">disp(grid2)</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> xgrid:
[1x16 double]</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> ygrid:
[1x16 double]</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> zgrid:
[1x13 double]</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> dim:
[16 16 13]</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> pos:
[3328x3 double]</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> unit:
'mm'</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> inside:
[1x2038 double]</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> outside: [1x1290
double]</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> cfg:
[1x1 struct]</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> leadfield:
{1x3328 cell}</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> </span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New"">Few things to be noticed here </span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> </span></b></p>
<p class="MsoListParagraphCxSpFirst" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10.0pt;font-family:Wingdings">Ø<span style="font-size:7pt;font-family:'Times New Roman'"> </span></span><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New"">unit is different for both
MEG ‘cm’ and EEG ‘mm’</span></b></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10.0pt;font-family:Wingdings">Ø<span style="font-size:7pt;font-family:'Times New Roman'"> </span></span><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New"">I have used the same method
for calculating the Volume for both MEG & EEG => “Singlesphere” </span></b></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:12.0pt;font-family:Wingdings">Ø<span style="font-size:7pt;font-family:'Times New Roman'"> </span></span><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New"">Concatenating the “pos”
vector of EEG and MEG and the other vectors</span></b><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman","serif""></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""> </span></b></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New"">Grid.pos
= cat(1,grid1.pos,grid2.pos);</span></b></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New"">Grid.xgrid
= [grid1.xgrid grid2.xgrid];</span></b></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New"">Grid.ygrid
= [grid1.ygrid grid2.ygrid];</span></b></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New"">Grid.zgrid
= [grid1.zgrid grid2.zgrid];</span></b></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New"">Grid.inside
= [grid1.inside grid2.inside];</span></b></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New"">Grid.outside
= [grid1.outside grid2.outside];</span></b></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New"">Grid.leadfield
= [grid1.leadfield grid2.leadfield];</span></b></p>
<p class="MsoListParagraphCxSpLast" style="margin-bottom:0.0001pt"><b><span style="font-size:10.0pt;font-family:"Courier New"">Grid.dim = [grid1.dim grid2.dim];</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span style="font-size:10.0pt;font-family:"Courier New""> </span></b></p>
<p class="MsoListParagraph" style="margin-bottom:0.0001pt"><span style="font-size:12.0pt;font-family:"Times New Roman","serif""> </span></p>
<p class="MsoNormal" style="line-height:200%"><b><u><span lang="EN-US" style="font-size:12.0pt;line-height:200%;font-family:"Times New Roman","serif"">Combined Source Reconstruction:-</span></u></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg = []; </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.dataset = ‘</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:#a020f0">ap_rest_stimon_bi_2_5ma.fif'</span><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">; </span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.trialdef.eventtype = </span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:#a020f0">'?'</span><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">;</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.trialdef.triallength = 1;</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.trialdef.poststim = 88;</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'"> </span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg = ft_definetrial(cfg);</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'"> </span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.trl = cfg.trl(1:88,:); //
Read 88 trials </span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'"> </span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">cfg.channel = {</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:#a020f0">'MEG',’EEG’</span><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">}; </span><b><span lang="EN-US" style="font-family:"Times New Roman","serif"">// In order to read raw data for MEG & EEG
channels</span></b><span lang="EN-US" style="font-family:'Courier New'"> </span><span lang="EN-US" style="font-family:"Courier New";color:forestgreen"> </span><span lang="EN-US" style="font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'">dataFIC12 = ft_preprocessing(cfg);</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10pt;font-family:'Courier New'"> </span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="line-height:200%"><span lang="EN-US" style="font-size:12.0pt;line-height:200%;font-family:"Times New Roman","serif"">After that as previously defined, I have calculated the Spectral
density. </span></p>
<p class="MsoNormal" style="line-height:200%"><span lang="EN-US" style="font-size:12.0pt;line-height:200%;font-family:"Times New Roman","serif"">Now I have to calculate the inverse solution for both EEG & MEG data
trials.</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><u><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman","serif"">Source Analysis: without contrasting condition:-</span></u></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><u><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman","serif""> </span></u></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:forestgreen"> </span><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">cfg = []; </span><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">cfg.method = </span><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New";color:#a020f0">'dics'</span><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">;</span><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">cfg.frequency = 129; </span><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">cfg.grid = Grid; // Concatenated grid</span><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">cfg.vol = vol1; // As vol1 = vol2 : both singlesphere</span><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New""> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">cfg.powmethod = </span><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New";color:#a020f0">'trace'</span><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">;</span><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">cfg.dics.projectnoise = </span><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New";color:#a020f0">'yes'</span><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">;</span><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">cfg.dics.lambda = 0.0001;</span><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">sourcePost_nocon = ft_sourceanalysis(cfg, freqPost); </span><span lang="EN-US" style="font-size:8pt;font-family:'Courier New'">// </span><b><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">freqpost contains both MEG </span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
and EEG row data</span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span lang="EN-US" style="font-size:9pt;font-family:'Courier New'">
</span></b><b><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New""></span></b></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span lang="EN-US" style="font-size:12.0pt;font-family:"Courier New""> </span></p>
<p class="MsoNormal" style="line-height:200%"><span lang="EN-US" style="font-size:12.0pt;line-height:200%;font-family:"Times New Roman","serif"">I have received the following error:</span></p>
<p class="MsoNoSpacing"><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman","serif"">scanning grid 2037/4075</span></p>
<p class="MsoNoSpacing"><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman","serif";color:red">??? Error using
==> svd</span></p>
<p class="MsoNoSpacing"><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman","serif";color:red">Input to SVD must
not contain NaN or Inf.</span></p>
<p class="MsoNoSpacing"><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman","serif";color:red"> </span></p>
<p class="MsoNoSpacing"><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman","serif";color:red">Error in ==>
beamformer_dics>pinv at 568</span></p>
<p class="MsoNoSpacing"><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman","serif";color:red"> [U,S,V] = svd(A,0);</span></p>
<p class="MsoNoSpacing"><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman","serif";color:red"> </span></p>
<p class="MsoNoSpacing"><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman","serif";color:red">Error in ==>
beamformer_dics at 314</span></p>
<p class="MsoNoSpacing"><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman","serif";color:red"> filt = pinv(lf' * invCf * lf) * lf' *
invCf; % Gross eqn. 3,</span></p>
<p class="MsoNoSpacing"><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman","serif";color:red"> use PINV/SVD to cover rank deficient
leadfield</span></p>
<p class="MsoNoSpacing"><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman","serif";color:red"> </span></p>
<p class="MsoNoSpacing"><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman","serif";color:red">Error in ==>
ft_sourceanalysis at 595</span></p>
<p class="MsoNoSpacing"><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman","serif";color:red"> dip(i) = beamformer_dics(grid, sens, vol,
[], squeeze(Cf(i,:,:)),</span></p>
<p class="MsoNoSpacing"><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman","serif";color:red"> optarg{:});</span></p>
<p class="MsoNoSpacing"><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman","serif";color:red"> </span></p>
<p class="MsoNoSpacing"><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman","serif";color:red">Error in ==>
code at 227</span></p>
<p class="MsoNoSpacing"><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman","serif";color:red">sourcePost_nocon =
ft_sourceanalysis(cfg, freqPost);</span></p>
<p class="MsoNormal" style="line-height:200%"><span lang="EN-US" style="font-size:12.0pt;line-height:200%;font-family:"Times New Roman","serif""> </span></p>
<p class="MsoListParagraphCxSpFirst" style="line-height:200%"><span lang="EN-US" style="font-size:12.0pt;line-height:200%;font-family:Wingdings">Ø<span style="font-size:7pt;line-height:normal;font-family:'Times New Roman'"> </span></span><span lang="EN-US" style="font-size:12.0pt;line-height:200%;font-family:"Times New Roman","serif"">If you notice that till 2037 grid it represents the
MEG grid and after that EEG grid is concatenated. i.e 2037 +2038 = 4075 (which
also represent inside dipole).</span></p>
<p class="MsoListParagraphCxSpMiddle" style="line-height:200%"><span lang="EN-US" style="font-size:12.0pt;line-height:200%;font-family:Wingdings">Ø<span style="font-size:7pt;line-height:normal;font-family:'Times New Roman'"> </span></span><span lang="EN-US" style="font-size:12.0pt;line-height:200%;font-family:"Times New Roman","serif"">Secondly I try to use other method for the head
modeling i.e openmeeg, dipoli and bemcp method which leads me to different
errors which I was unable to trouble shoot.</span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-left:72.0pt;line-height:200%"><span lang="EN-US" style="font-size:12.0pt;line-height:200%;font-family:Symbol">·<span style="font-size:7pt;line-height:normal;font-family:'Times New Roman'">
</span></span><span lang="EN-US" style="font-size:12.0pt;line-height:200%;font-family:"Times New Roman","serif"">Openmeeg
= </span><span lang="EN-US" style="font-size:9.0pt;line-height:200%;font-family:"Lucida Console";color:red;background:white">OpenMEEG
binaries are not correctly installed</span><span lang="EN-US" style="font-size:12.0pt;line-height:200%;font-family:"Times New Roman","serif""></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-left:72.0pt;line-height:200%"><span lang="EN-US" style="font-size:12.0pt;line-height:200%;font-family:Symbol">·<span style="font-size:7pt;line-height:normal;font-family:'Times New Roman'">
</span></span><span lang="EN-US" style="font-size:12.0pt;line-height:200%;font-family:"Times New Roman","serif";background:white">Dipoli =</span><span lang="EN-US" style="font-size:9.0pt;line-height:200%;font-family:"Lucida Console";background:white"> <span style="color:red">vol.mat file was missing after calculating the
headmodel</span></span><span lang="EN-US" style="font-size:12.0pt;line-height:200%;font-family:"Times New Roman","serif""></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-left:72.0pt;line-height:200%"><span lang="EN-US" style="font-size:12.0pt;line-height:200%;font-family:Symbol">·<span style="font-size:7pt;line-height:normal;font-family:'Times New Roman'">
</span></span><span lang="EN-US" style="font-size:12.0pt;line-height:200%;font-family:"Times New Roman","serif";background:white">Bemcp =</span><span lang="EN-US" style="font-size:9.0pt;line-height:200%;font-family:"Lucida Console";background:white"> <span style="color:red">vol.mat file contains NaN fiels which leads to
wrong</span></span><span lang="EN-US" style="font-size:12.0pt;line-height:200%;font-family:"Times New Roman","serif""></span></p>
<p class="MsoListParagraphCxSpLast" style="margin-left:72.0pt;line-height:200%"><span lang="EN-US" style="font-size:9.0pt;line-height:200%;font-family:"Lucida Console";color:red;background:white"> leadfield computation.</span><span lang="EN-US" style="font-size:12.0pt;line-height:200%;font-family:"Times New Roman","serif""></span></p>
<p class="MsoNormal" style="line-height:200%"><b><u><span lang="EN-US" style="font-size:12.0pt;line-height:200%;font-family:"Times New Roman","serif"">I apologize for
the long email. I wanted to show the steps which I used so that it is easier to
debug the problem.</span></u></b></p>
<p class="MsoNormal" style="line-height:200%"><b><u><span lang="EN-US" style="font-size:12.0pt;line-height:200%;font-family:"Times New Roman","serif""> </span></u></b></p>
<p class="MsoNormal" style="line-height:200%"><span lang="EN-US" style="font-size:12.0pt;line-height:200%;font-family:"Times New Roman","serif"">Thank you;</span></p><p class="MsoNormal" style="line-height:200%">
<span lang="EN-US" style="font-size:12.0pt;line-height:200%;font-family:"Times New Roman","serif"">Mushfa Yousuf<br><br>
<br>
</span></p><br><div class="gmail_quote">On Fri, Feb 8, 2013 at 2:36 PM, Robert Oostenveld <span dir="ltr"><<a href="mailto:r.oostenveld@donders.ru.nl" target="_blank">r.oostenveld@donders.ru.nl</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Dear Mushfa<div><br></div><div>In principle it can be made to work, but you'll have to do a little bit of work outside fieldtrip. You would start with</div>
<div><div>1) ft_prepare_headmodel and ft_prepare_leadfield for the MEG part</div></div><div><div>2) ft_prepare_headmodel and ft_prepare_leadfield for the EEG part</div></div><div>Subsequently you would (manually) concatenate the leadfields of the MEG and EEG. Here you have to make sure that the channel order is consistent with that in your combined data.</div>
<div>The resulting structure with combined leadfields can be passed into ft_sourceanalysis as cfg.grid.</div><div><br></div><div>However, I foresee a problem with the scaling. At this moment FieldTrip is not (yet) very precise in maintaining the correct units throughout. Consequently you might get different units for the EEG and MEG contribution to each dipole, causing weird cancelation effects. You'll just have to check carefully that the leadfield units and the data units consistently scaled between megmag, megplanar and eeg. </div>
<div><br></div><div>This brings me to another known problem for the combined vectorview magnetometer and planar gradiometer channels: at this moment the forward computation computes both in T (or fT), whereas the data is represented as T for the magnetometers and T/m for the gradiometers. So the gradiometer leadfields are off by a factor "1/baseline", which is approximately 1/70 if I recall correctly. Many neuromag users use only the planar channels, and therefore don't notice. We are working on fixing the neuromag channel/gradiometer units. That is not as simple as it appears, because conversions of the geometrical dimensions from m to cm or mm also affect the gradiometer baseline. So converting the data from m to mm should result in the planar channel data getting 1000 times smaller, whereas the magnetometer channels shoudl stay the same. See <a href="http://bugzilla.fcdonders.nl/show_bug.cgi?id=963" target="_blank">http://bugzilla.fcdonders.nl/show_bug.cgi?id=963</a> and <a href="http://bugzilla.fcdonders.nl/show_bug.cgi?id=963" target="_blank">http://bugzilla.fcdonders.nl/show_bug.cgi?id=963</a> if you want to follow this.</div>
<div><br></div><div>best regards</div><div>Robert</div><div><br></div><div><br></div><div><div><br><div><div><div class="h5"><div>On 28 Jan 2013, at 20:20, Mushfa Yousuf wrote:</div><br></div></div><blockquote type="cite">
<div><div class="h5"><pre style="line-height:21px;color:rgb(68,68,68);font-size:15px;white-space:normal">Hello Fieldtrippers,<br><br>I am currently doing source analysis using beamformer method in fieldtrip.<br>
The data i work on is a simultaneous measurement of MEG (306) with EEG<br>(128) on PD patients.<br><br>I was successful in calculating the sources for both the modalities alone.<br><br>I tried according the tutorial "Combined EEG and MEG source reconstruction" and was successful till the estimation<br>
of the lead field. But, then when i want to use the created vol for the<br>source analysis i have two structures one for EEG and the second one for<br>MEG. Now, i can only define only one to estimate the sources. How to use<br>
this for both the modalities? Any help would be appreciated.<br><br>With regards<font color="#888888"><br>Mushfa</font></pre></div></div>
_______________________________________________<br>fieldtrip mailing list<br><a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br><a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></blockquote>
</div><br></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" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br></blockquote></div><br>