<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<font size="4" class="">Hi Wanze,</font>
<div class=""><font size="4" class=""><br class="">
</font></div>
<div class="">
<div>
<blockquote type="cite" class="">
<div class="">
<div dir="ltr" class="">
<div dir="auto" class=""><font size="4" class="">I have two short questions regarding your suggestions to Michael: 1) any reason for why doing svd for concatenated trials would work better than doing svd per trial? </font></div>
</div>
</div>
</blockquote>
<div><font size="4" class=""><br class="">
</font></div>
<div><font size="4" class="">Well, it’s not that ‘it works better’, but using a per trial svd will result in a different orientation estimate per trial, which then inherently assumes a source model that fixes the location of the dipole, but not its orientation.</font></div>
<font size="4" class=""><br class="">
</font>
<blockquote type="cite" class="">
<div class="">
<div dir="ltr" class="">
<div class=""><font size="4" class="">2) If we do svd with concatenated trials do we need to re-segment the data into epochs/trials? I think ft_freqanalysis and ft_connectivity would work way more efficiently if they are applied to data in epochs rather than
one long trial, although I am not 100% assured. </font></div>
</div>
</div>
</blockquote>
<div><br class="">
</div>
<div>
<div><font size="4" class="">Indeed, in most situations (particularly if the experimental protocol is epoch based) it is mandatory to maintain the epoch-structure in the spectral decomposition and connectivity estimation step. To this end the concatenation
step is an intermediate one, used only to compute the principal orientation, and this orientation can then be applied to the data structure that still contains the epochs, either using a for-loop across the individual epochs, or exploiting the external/cellfunction
code, by a direct multiplication.</font></div>
<div><font size="4" class=""><br class="">
</font></div>
<div><font size="4" class="">Best wishes,</font></div>
<div><font size="4" class="">Jan-Mathijs</font></div>
<div class=""><font size="4" class=""><br class="">
</font></div>
<font size="4" class=""></font></div>
<br class="">
<blockquote type="cite" class="">
<div class="">
<div dir="ltr" class="">
<div class=""><font size="4" class=""><br class="">
</font></div>
<div class=""><font size="4" class="">Look forward to hearing from you. </font></div>
<div class=""><font size="4" class=""><br class="">
</font></div>
<div class=""><font size="4" class="">Best,</font></div>
<div class=""><font size="4" class="">Wanze</font></div>
<div dir="auto" class=""><br class="">
</div>
<div dir="auto" class=""><br class="">
</div>
<div class=""><br class="">
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">Schoffelen, J.M. (Jan Mathijs) <<a href="mailto:jan.schoffelen@donders.ru.nl" target="_blank" class="">jan.schoffelen@donders.ru.nl</a>>于2020年5月8日 周五上午10:35写道:<br class="">
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word;line-break:after-white-space" class="">Hi Michael,
<div class=""><br class="">
</div>
<div class="">The WFU atlas is a volumetrically defined atlas, correct? So, in order for the parcellation to work, the atlas needs to be mapped onto the cortically constrained sheet of dipoles that you used for source reconstruction.</div>
<div class="">This is not entirely trivial, but doable. If you obtained your atlas already as represented on a cortically constrained set of locations, then you need to ensure that these locations topologically map to the dipole locations of your source model. </div>
<div class=""><br class="">
</div>
<div class="">Best wishes,</div>
<div class="">Jan-Mathijs</div>
</div>
<div style="word-wrap:break-word;line-break:after-white-space" class="">
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
<div class=""><br class="">
<blockquote type="cite" class="">
<div class="">On 8 May 2020, at 16:15, Michael Glassen - Biomedical Engineer <<a href="mailto:MGlassen@kesslerfoundation.org" target="_blank" class="">MGlassen@kesslerfoundation.org</a>> wrote:</div>
<br class="">
<div class="">
<div style="word-wrap:break-word;line-break:after-white-space" class="">Thank you everyone for the help!<br class="">
<br class="">
Just one final question, I got the Brodmann area atlas and the hemisphere atlas from this toolbox SPM “WFU-PickAtlas”.<br class="">
<br class="">
Does anyone know if there is a Brodmann area atlas that is known to work with fieldtrip?<br class="">
<br class="">
Best,<br class="">
Michael Glassen
<hr style="display:inline-block;width:98%" class="">
<div id="m_-9057387112358115007m_-3568020509046707828divRplyFwdMsg" dir="ltr" class="">
<font face="Calibri, sans-serif" style="font-size:11pt" class=""><b class="">From:</b> fieldtrip <<a href="mailto:fieldtrip-bounces@science.ru.nl" target="_blank" class="">fieldtrip-bounces@science.ru.nl</a>> on behalf of Schoffelen, J.M. (Jan Mathijs) <<a href="mailto:jan.schoffelen@donders.ru.nl" target="_blank" class="">jan.schoffelen@donders.ru.nl</a>><br class="">
<b class="">Sent:</b> Friday, May 8, 2020 3:17:56 AM<br class="">
<b class="">To:</b> FieldTrip discussion list<br class="">
<b class="">Subject:</b> Re: [FieldTrip] Computing source-level ROI EEG connectivity</font>
<div class=""> </div>
</div>
<div class="">Hi Michael,
<div class=""><br class="">
</div>
<div class="">Adding to Wanze’s and Xavier’s replies:</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
<div class="">
<div class="">
<blockquote type="cite" class="">
<div class="">
<div style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none" class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)" class=""> I went through and plotted a couple different time series from the mom field from different trials and the same dipole, they are not equal and the shape
looks ok to me, the magnitudes range from 10^-7 to 10^-4, is that normal? Source was calculated with everything in meters if that matters. Can you explain a little more the other method for calculating mom? The only option I have to add is keepfilter to sourceanalysis?
And then I multiply each of these filters against the trial data matrix and it will leave me with what rawtrial is giving me but more reliably? Can I then still use the parcellate option on the output here? Or is this not necessary as rawtrial seems to be
working?</span></div>
</div>
</div>
</blockquote>
<div class=""><br class="">
</div>
<div class="">If ‘rawtrial’ works, than this would be fine. I was a bit worried (and I’d need to look in the code myself in some more detail) because historically the ‘rawtrial’-functionality was implemented for the beamformer algorithms, and not for the MNE.
As such, it has never been tested thoroughly for MNE, so although it seems to produce an output for you, I am not 100% sure that it’s correct. Also, anecdotally, the ‘rawtrial’/’singletrial’ functionality for the beamformers is shaky in itself, and we still
have it on our to-do-list to make the code more internally consistent and correct. </div>
<div class=""><br class="">
</div>
<br class="">
<blockquote type="cite" class="">
<div style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none" class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<i class=""><span style="font-size:10pt" class="">-In order to get a ‘parcellated’ representation of your source level data, I recommend to use ft_sourceparcellate, which should achieve the parcellation you performed by hand (with the binary masks).<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<i class=""><span style="font-size:10pt" class=""> <span class=""> </span></span></i><i class=""><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<i class=""><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> <span class=""> </span></span></i><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,78,121)" class="">I tried using the ft_sourceparcellate
function but I was running into a memory issue when ran on the rawtrial source, and when I remove that option and run it on the default trial-averaged sources I get a different error, which is pasted below. mri2 is the broddman area atlas interpolated onto
my source model. Also, is there any way to parcellate twice with the function like I am doing by hand? The broddman area atlas I have is not divided into left and right hemispheres so I have another atlas I am using that is divided into hemispheres.</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:10pt" class=""><u class=""></u> <u class=""></u></span></div>
<div style="margin:0in 0in 0.0001pt 0.5in;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<i class=""><span style="font-size:10pt" class="">mri2 =<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<i class=""><span style="font-size:10pt" class=""><u class=""></u> <u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<i class=""><span style="font-size:10pt" class=""> struct with fields:<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<i class=""><span style="font-size:10pt" class=""><u class=""></u> <u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<i class=""><span style="font-size:10pt" class=""> pos: [8196×3 double]<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<i class=""><span style="font-size:10pt" class=""> tri: [16384×3 double]<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<i class=""><span style="font-size:10pt" class=""> unit: 'm'<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<i class=""><span style="font-size:10pt" class=""> tissue: [8196×1 double]<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<i class=""><span style="font-size:10pt" class=""> tissuelabel: {1×70 cell}<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<i class=""><span style="font-size:10pt" class=""> cfg: [1×1 struct]<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<i class=""><span style="font-size:10pt" class=""><u class=""></u> <u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<i class=""><span style="font-size:10pt" class=""> cfg =<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<i class=""><span style="font-size:10pt" class=""><u class=""></u> <u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<i class=""><span style="font-size:10pt" class=""> struct with fields:<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<i class=""><span style="font-size:10pt" class=""><u class=""></u> <u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<i class=""><span style="font-size:10pt" class=""> method: 'mean'<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<i class=""><span style="font-size:10pt" class=""> parcellation: 'tissue'<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<i class=""><span style="font-size:10pt" class=""> parameter: 'mom'<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<i class=""><span style="font-size:10pt" class=""><u class=""></u> <u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt 1in;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<i class=""><span style="font-size:10pt" class="">ft_sourceparcellate(cfg,sourceEEG,mri2)<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt 1in;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<i class=""><span style="font-size:10pt" class="">there is no "Dentate" in "tissue"<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt 1in;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<i class=""><span style="font-size:10pt" class="">there is no "Hypothalamus" in "tissue"<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt 1in;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<i class=""><span style="font-size:10pt" class="">there is no "Substania Nigra" in "tissue"<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt 1in;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<i class=""><span style="font-size:10pt" class="">there is no "Caudate Tail" in "tissue"<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt 1in;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<i class=""><span style="font-size:10pt" class="">there is no "Putamen" in "tissue"<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt 1in;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<i class=""><span style="font-size:10pt" class="">there is no "Medial Geniculum Body" in "tissue"<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt 1in;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<i class=""><span style="font-size:10pt" class="">there is no "Lateral Globus Pallidus" in "tissue"<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt 1in;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<i class=""><span style="font-size:10pt" class="">there is no "Subthalamic Nucleus" in "tissue"<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt 1in;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<i class=""><span style="font-size:10pt" class="">there is no "Medial Globus Pallidus" in "tissue"<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt 1in;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<i class=""><span style="font-size:10pt" class="">there is no "Lateral Geniculum Body" in "tissue"<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt 1in;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<i class=""><span style="font-size:10pt" class="">there is no "Anterior Commissure" in "tissue"<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt 1in;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<i class=""><span style="font-size:10pt" class="">there is no "Ventral Posterior Lateral Nucleus" in "tissue"<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt 1in;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<i class=""><span style="font-size:10pt" class="">there is no "Ventral Posterior Medial Nucleus" in "tissue"<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt 1in;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<i class=""><span style="font-size:10pt" class="">there is no "Ventral Lateral Nucleus" in "tissue"<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt 1in;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<i class=""><span style="font-size:10pt" class="">there is no "Ventral Anterior Nucleus" in "tissue"<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt 1in;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<i class=""><span style="font-size:10pt" class="">there is no "Caudate Body" in "tissue"<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt 1in;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<i class=""><span style="font-size:10pt" class="">there is no "Lateral Posterior Nucleus" in "tissue"<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt 1.5in;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<i class=""><span style="font-size:10pt" class="">there is no "Lateral Dorsal Nucleus" in "tissue"<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt 0.5in;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<i class=""><span style="font-size:10pt" class="">there is no "Midline Nucleus" in "tissue"<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt 1in;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<i class=""><span style="font-size:10pt" class="">there are in total 8196 positions, 8190 positions are inside the brain, 2611 positions have a label<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt 1in;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<i class=""><span style="font-size:10pt" class="">2609 of the positions inside the brain have a label<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt 1in;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<i class=""><span style="font-size:10pt" class="">2609 of the labeled positions are inside the brain<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt 1in;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<i class=""><span style="font-size:10pt" class="">5581 of the positions inside the brain do not have a label<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt 1in;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<i class=""><span style="font-size:10pt" class="">creating 70 parcels for parameter mom by taking the mean<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt 1in;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<i class=""><span style="font-size:10pt" class="">computing parcellation<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt 1in;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<i class=""><span style="font-size:10pt" class="">Index exceeds the number of array elements (0).<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<i class=""><span style="font-size:10pt" class=""><u class=""></u> <u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt 1in;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<i class=""><span style="font-size:10pt" class="">Error in ft_sourceparcellate>cellmean1 (line 488)<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt 1in;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<i class=""><span style="font-size:10pt" class="">y = x{1};<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<i class=""><span style="font-size:10pt" class=""><u class=""></u> <u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt 1in;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<i class=""><span style="font-size:10pt" class="">Error in ft_sourceparcellate (line 226)<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<i class=""><span style="font-size:10pt" class=""> tmp(j,:,:) = cellmean1(dat(seg==j));<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<u class=""></u> <u class=""></u></div>
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,78,121)" class=""> -If I cannot get source parcellate to work, does my method of creating a mask and pulling out the source powers seem sound? I see that I should use mom
instead of pow, so would I then just take all the voxels in an ROI and average the x direction together, the y direction together and the z together? Then find the direction with the largest power and use that as my 1by x time series power(using svd as described
in documentation)? This is what I’m assuming sourceparcellate does if I select ‘eig’ as the method.</span></div>
</div>
</blockquote>
<div class=""><br class="">
</div>
-With regard to thte parcellation: understood if memory limitations prevent you from using it. Yet, the error message you get when using the trial-averaged data suggests an issue with your atlas. Where did you get it from? It looks as if only 2611 out of the
8196 cortical locations have a label. Is that according to your expectations? </div>
<div class="">-If indeed you are to manually parcellate (with the mask), you can do one of the following:</div>
<div class=""> * average x/y/z across dipole locations, followed by an svd (I’d recommend to do this svd on the trial-concatenated data, rather than on a per-trial basis)</div>
<div class=""> * (to mimick the ‘eig’ method): concatenate the time series across dipole locations (and trials), followed by a single svd on the whole matrix.<br class="">
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<br class="">
<blockquote type="cite" class="">
<div style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none" class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<i class=""><span style="font-size:10pt" class="">ALSO IMPORTANT: if you go for a granger-like measure (granger/dtf/pdc), in the spectral analysis you should probably use a decent amount of zero padding (cfg.pad) and sufficient tapsmofrq in order to get spectral
data that stands a chance to get a stable factorization.<u class=""></u><u class=""></u></span></i></div>
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)" class=""><u class=""></u> <u class=""></u></span></div>
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)" class=""><u class=""></u> <u class=""></u></span></div>
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)" class=""> -Finally, if I choose to go for granger, what kind of cfg.pad and tapsmofrq would you recommend? I am mostly interested in the beta band(12-30Hz) and my
trial lengths are 357 samples(1.3 seconds)</span></div>
</div>
</blockquote>
<div class=""><br class="">
</div>
<div class="">Irrespective of using granger or the disrecommended dtf/pdc, all techniques that require a spectral factorization need padding and smoothing. In your case I’d recommend a padding of 4 (cfg.pad = 4), and a cfg.tapsmofrq somewhere in the range of
3 and 6 (but the latter is a bit of ‘wet finger work’, as we sould say in Dutch -> google for ’natte vingerwerk’ if you want to learn more).</div>
<div class=""><br class="">
</div>
<div class="">Best wishes,</div>
<div class="">Jan-Mathijs</div>
<div class=""><br class="">
</div>
<br class="">
<blockquote type="cite" class="">
<div style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none" class="">
<div class="">
<div style="border-style:solid none none;border-top-width:1pt;border-top-color:rgb(225,225,225);padding:3pt 0in 0in" class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><b class="">Subject:</b><span class=""> </span>Re: [FieldTrip] Computing source-level ROI EEG connectivity<u class=""></u><u class=""></u></span></div>
</div>
</div>
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<u class=""></u> <u class=""></u></div>
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:13.5pt" class="">Dear Michael, </span><u class=""></u><u class=""></u></div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<u class=""></u> <u class=""></u></div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:13.5pt" class="">It looks that you already got quite far! I agree that the DTF values do not make much sense.</span><u class=""></u><u class=""></u></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<u class=""></u> <u class=""></u></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:13.5pt" class="">a few pointers:</span><u class=""></u><u class=""></u></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<u class=""></u> <u class=""></u></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:13.5pt" class="">-I would use some regularisation for the MNE reconstruction.</span><u class=""></u><u class=""></u></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:13.5pt" class="">-I would check whether the individual trials after source reconstruction yield meaningful values in the ‘mom’-field. Particularly, are the different trials different? Do the time series look meaningful to begin with (both
in terms of signal magnitude and ’shape’)? The reason I ask, is that I am not fully sure whether the ‘rawtrial’ option is behaving according to your expectations.</span><u class=""></u><u class=""></u></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:13.5pt" class="">-Another way for getting the mom would be to use cfg.keepfilter in ft_sourceanalysis, and left-multiply each dipole location’s ’spatial filter’ (in sourceEEG.avg.filter) with a dataEEG.trial matrix.</span><u class=""></u><u class=""></u></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:13.5pt" class="">-IMPORTANT: don’t use the ‘pow’ for the subsequent spectral analysis and connectivity estimation. You should work with the mom.</span><u class=""></u><u class=""></u></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:13.5pt" class="">-In order to get a ‘parcellated’ representation of your source level data, I recommend to use ft_sourceparcellate, which should achieve the parcellation you performed by hand (with the binary masks).</span><u class=""></u><u class=""></u></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:13.5pt" class="">-The parcellation operation can be an average of the mom across the dipoles that belong to a parcel, but an alternative might be the the 1st principal component. The advantage of the latter would be that the per-parcel
signal will be reduced to a single time series (rather then 3 x/y/z orientation time courses), which is convenient (and required) for the interpretation of the subsequent computations.</span><u class=""></u><u class=""></u></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:13.5pt" class="">-You may want to think a bit about the depth weighting, since the MNE favors superficial locations in terms of amplitude, and this will also percolate to the way the parcellated time series are computed.</span><u class=""></u><u class=""></u></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:13.5pt" class="">-IMPORTANT: using ‘dtf’ without any additional specification of parameters is probably not what you want here. The reason is that under the hood a multivariate factorization of the spectral matrix is performed (at least:
an attempt is made), which will miserably fail in your case. The reason for this failure (thinking a bit more about this, I am quite surprised that it worked to begin with) is the fact that you ask for a factorization of a size NparcelxNparcel(xfrequency bins)
matrix, where the effective rank of the matrix is less than the number of channels in your EEG array. Even if Nparcel is less than the number of EEG electrodes, this factorization will be very poorly estimated and nonsensical. I’d recommend using ‘granger’
as a method, in combination with cfg.granger.sfmethod = ‘bivariate’. This results in a parcel-pairwise factorization (which is hopefully stable most of the time). I am not a fan of dtf/pdc anyway given that the measures are claimed to provide estimates unproblematic
estimates that are interpretable without any caveats.</span><u class=""></u><u class=""></u></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:13.5pt" class="">-ALSO IMPORTANT: if you go for a granger-like measure (granger/dtf/pdc), in the spectral analysis you should probably use a decent amount of zero padding (cfg.pad) and sufficient tapsmofrq in order to get spectral data
that stands a chance to get a stable factorization.</span><u class=""></u><u class=""></u></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<u class=""></u> <u class=""></u></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:13.5pt" class="">So, no definitive answers unfortunately, but perhaps some food for thought that might get you closer to a good result.</span><u class=""></u><u class=""></u></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<u class=""></u> <u class=""></u></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:13.5pt" class="">Good luck and keep up the good work,</span><u class=""></u><u class=""></u></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<u class=""></u> <u class=""></u></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:13.5pt" class="">Jan-Mathijs</span><u class=""></u><u class=""></u></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<u class=""></u> <u class=""></u></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<u class=""></u> <u class=""></u></div>
</div>
<div class="">
<p class="MsoNormal" style="margin:0in 0in 12pt;font-size:12pt;font-family:"Times New Roman",serif">
<u class=""></u> <u class=""></u></p>
<div class="">
<div class="">
<div class="">
<div class="">
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:13.5pt" class="">J.M.Schoffelen, MD PhD<br class="">
Associate PI, VIDI-fellow - PI, language in interaction<br class="">
Telephone: +31-24-3614793</span><span class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:13.5pt" class="">Physical location: room 00.028</span><span class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<p class="MsoNormal" style="margin:0in 0in 12pt;font-size:12pt;font-family:"Times New Roman",serif">
<span style="font-size:13.5pt" class="">Donders Centre for Cognitive Neuroimaging, Nijmegen, The Netherlands<br class="">
<br class="">
</span><span class=""><u class=""></u><u class=""></u></span></p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<u class=""></u><u class=""></u></div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<br class="">
<br class="">
<u class=""></u><u class=""></u></div>
<blockquote style="margin-top:5pt;margin-bottom:5pt" class="">
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
On 6 May 2020, at 22:34, Michael Glassen - Biomedical Engineer <<a href="mailto:MGlassen@kesslerfoundation.org" style="color:purple;text-decoration:underline" target="_blank" class="">MGlassen@kesslerfoundation.org</a>> wrote:<u class=""></u><u class=""></u></div>
</div>
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<u class=""></u> <u class=""></u></div>
<div class="">
<p class="MsoNormal" style="margin:0in 0in 8pt;font-size:12pt;font-family:"Times New Roman",serif;line-height:11.65pt">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class="">Hi all,<u class=""></u><u class=""></u></span></p>
<p class="MsoNormal" style="margin:0in 0in 8pt;font-size:12pt;font-family:"Times New Roman",serif;line-height:11.65pt">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> <u class=""></u><u class=""></u></span></p>
<p class="MsoNormal" style="margin:0in 0in 8pt;font-size:12pt;font-family:"Times New Roman",serif;line-height:11.65pt">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class="">I am having issues using fieldtrip for source reconstruction and connectivity analysis with preprocessed EEG data. I believe the issue is occurring when I try to project my sources to specific
ROIs before getting the connectivity. I have outlined my pipeline below:<u class=""></u><u class=""></u></span></p>
<p class="MsoNormal" style="margin:0in 0in 8pt;font-size:12pt;font-family:"Times New Roman",serif;line-height:11.65pt">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> <u class=""></u><u class=""></u></span></p>
<p class="MsoNormal" style="margin:0in 0in 8pt;font-size:12pt;font-family:"Times New Roman",serif;line-height:11.65pt">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class="">-Because I do not have subject MRIs, I am using a template headmodel and sourcemodel that come included with fieldtrip<u class=""></u><u class=""></u></span></p>
<p class="MsoNormal" style="margin:0in 0in 8pt;font-size:12pt;font-family:"Times New Roman",serif;line-height:11.65pt">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> - headmodel = standard_bem.mat<u class=""></u><u class=""></u></span></p>
<p class="MsoNormal" style="margin:0in 0in 8pt;font-size:12pt;font-family:"Times New Roman",serif;line-height:11.65pt">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> -sourcemodel = cortex_8196.surf.gii<u class=""></u><u class=""></u></span></p>
<p class="MsoNormal" style="margin:0in 0in 8pt;font-size:12pt;font-family:"Times New Roman",serif;line-height:11.65pt">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> <u class=""></u><u class=""></u></span></p>
<p class="MsoNormal" style="margin:0in 0in 8pt;font-size:12pt;font-family:"Times New Roman",serif;line-height:11.65pt">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class="">-After importing EEG data, I project the EEG electrodes to the scalp using the code below:<u class=""></u><u class=""></u></span></p>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> <span class=""> </span></span><span style="font-size:9pt;font-family:"Courier New";color:blue" class="">if</span><span class=""><span style="font-size:9pt;font-family:"Courier New"" class=""> </span></span><span style="font-size:9pt;font-family:"Courier New"" class="">strcmp(headmodel.type,<span class=""> </span><span style="color:rgb(160,32,240)" class="">'bemcp'</span>)</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:9pt;font-family:"Courier New"" class=""> scalp_index = 3;</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<span style="font-size:9pt;font-family:"Courier New";color:blue" class="">elseif</span><span class=""><span style="font-size:9pt;font-family:"Courier New"" class=""> </span></span><span style="font-size:9pt;font-family:"Courier New"" class="">strcmp(headmodel.type,<span class=""> </span><span style="color:rgb(160,32,240)" class="">'dipoli'</span>)</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:9pt;font-family:"Courier New"" class=""> scalp_index = 1;</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<span style="font-size:9pt;font-family:"Courier New";color:blue" class="">end</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<span style="font-size:9pt;font-family:"Courier New"" class="">cfg = [];</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<span style="font-size:9pt;font-family:"Courier New"" class="">cfg.method =<span class=""> </span><span style="color:rgb(160,32,240)" class="">'project'</span>;</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<span style="font-size:9pt;font-family:"Courier New"" class="">cfg.headshape = headmodel.bnd(scalp_index);</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:9pt;font-family:"Courier New";color:forestgreen" class=""> </span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<span style="font-size:9pt;font-family:"Courier New"" class="">eegData.elec = ft_electroderealign(cfg, eegData.elec);</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<span style="font-size:9pt;font-family:"Courier New"" class=""> </span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<span style="font-size:9pt;font-family:"Courier New"" class=""> </span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class="">-I then calculate covariance on a trial basis and calculate the leadfield matrix:<u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> <u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> <span class=""> </span></span><span style="font-size:9pt;font-family:"Courier New"" class="">cfg = [];</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<span style="font-size:9pt;font-family:"Courier New"" class="">cfg.covariance =<span class=""> </span><span style="color:rgb(160,32,240)" class="">'yes'</span>;</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<span style="font-size:9pt;font-family:"Courier New"" class="">cfg.covariancewindow = [-inf 0];</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<span style="font-size:9pt;font-family:"Courier New"" class="">cfg.keeptrials =<span class=""> </span><span style="color:rgb(160,32,240)" class="">'yes'</span>;</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<span style="font-size:9pt;font-family:"Courier New"" class="">tlckEeg = ft_timelockanalysis(cfg, eegData);</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<span style="font-size:9pt;font-family:"Courier New"" class="">cfg = [];</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<span style="font-size:9pt;font-family:"Courier New"" class="">cfg.elec = tlckEeg.elec; <span class=""> </span><span style="color:forestgreen" class="">% sensor information</span></span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<span style="font-size:9pt;font-family:"Courier New"" class="">cfg.channel = tlckEeg.label; <span class=""> </span><span style="color:forestgreen" class="">% the used channels</span></span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<span style="font-size:9pt;font-family:"Courier New"" class="">cfg.grid = sourcemodel; <span class=""> </span><span style="color:forestgreen" class="">% source points</span></span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<span style="font-size:9pt;font-family:"Courier New"" class="">cfg.headmodel = headmodel; <span class=""> </span><span style="color:forestgreen" class="">% volume conduction model</span></span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<span style="font-size:9pt;font-family:"Courier New"" class="">cfg.singleshell.batchsize = 5000;<span class=""> </span><span style="color:forestgreen" class="">% speeds up the computation</span></span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<span style="font-size:9pt;font-family:"Courier New"" class="">leadfield = ft_prepare_leadfield(cfg);</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> <u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> <span class=""> </span><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class="">-Now with the leadfield calculated, I calculate sources on a trial basis here:<u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> <u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<span style="font-size:9pt;font-family:"Courier New"" class="">cfg = [];</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<span style="font-size:9pt;font-family:"Courier New"" class="">cfg.method =<span class=""> </span><span style="color:rgb(160,32,240)" class="">'mne'</span>;</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<span style="font-size:9pt;font-family:"Courier New"" class="">cfg.sourcemodel = leadfield;</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<span style="font-size:9pt;font-family:"Courier New"" class="">cfg.headmodel = headmodel;</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<span style="font-size:9pt;font-family:"Courier New"" class="">cfg.mne.prewhiten =<span class=""> </span><span style="color:rgb(160,32,240)" class="">'yes'</span>;</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<span style="font-size:9pt;font-family:"Courier New"" class="">cfg.mne.lambda = 0;</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<span style="font-size:9pt;font-family:"Courier New"" class="">cfg.mne.scalesourcecov =<span class=""> </span><span style="color:rgb(160,32,240)" class="">'yes'</span>;</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<span style="font-size:9pt;font-family:"Courier New"" class="">cfg.rawtrial =<span class=""> </span><span style="color:rgb(160,32,240)" class="">'yes'</span>;</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<span style="font-size:9pt;font-family:"Courier New"" class="">sourceEEG = ft_sourceanalysis(cfg,tlckEeg);</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> sourceEEG =<span class=""> </span><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> <u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> struct with fields:<u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> <u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> time: [1×357 double]<u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> inside: [8196×1 logical]<u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> pos: [8196×3 double]<u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> tri: [16384×3 double]<u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> method: 'rawtrial'<u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> trial: [1×400 struct]<u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> df: 400<u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> cfg: [1×1 struct]<u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> <u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> <u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> sourceEEG.trial =<span class=""> </span><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> <u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> 1×400 struct array with fields:<u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> <u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> mom<u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> pow<u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> noisecov<u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> <span class=""> </span><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class="">size(sourceEEG.trial(1).pow)<u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> <u class=""></u><u class=""></u></span></div>
</div>
<div style="margin-left:0.5in" class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class="">ans =<u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> <u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> 8196 357<u class=""></u><u class=""></u></span></div>
</div>
<p class="MsoNormal" style="margin:0in 0in 8pt;font-size:12pt;font-family:"Times New Roman",serif;line-height:11.65pt">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> <u class=""></u><u class=""></u></span></p>
<p class="MsoNormal" style="margin:0in 0in 8pt;font-size:12pt;font-family:"Times New Roman",serif;line-height:11.65pt">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class="">-So at this point I have 400 trials, and for each of these trials I have a time course of source power at 8196 voxels and 357 time points for each of those voxels.<u class=""></u><u class=""></u></span></p>
<p class="MsoNormal" style="margin:0in 0in 8pt;font-size:12pt;font-family:"Times New Roman",serif;line-height:11.65pt">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class="">-I then import two atlases, one that includes broddman areas and one that includes left and right hemispheres. I interpolate these atlases onto my source model and get the following:<u class=""></u><u class=""></u></span></p>
<p class="MsoNormal" style="margin:0in 0in 8pt;font-size:12pt;font-family:"Times New Roman",serif;line-height:11.65pt">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> <span class=""> </span></span><span style="font-size:9pt;font-family:"Calibri Light",sans-serif" class="">broddman =</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></p>
<p class="MsoNormal" style="margin:0in 0in 8pt 0.5in;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in;line-height:11.65pt">
<span style="font-size:9pt;font-family:"Calibri Light",sans-serif" class="">struct with fields:</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></p>
<p class="MsoNormal" style="margin:0in 0in 8pt;font-size:12pt;font-family:"Times New Roman",serif;line-height:11.65pt">
<span style="font-size:9pt;font-family:"Calibri Light",sans-serif" class=""> </span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></p>
<p class="MsoNormal" style="margin:0in 0in 8pt;font-size:12pt;font-family:"Times New Roman",serif;line-height:11.65pt">
<span style="font-size:9pt;font-family:"Calibri Light",sans-serif" class=""> pos: [8196×3 double]</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></p>
<p class="MsoNormal" style="margin:0in 0in 8pt;font-size:12pt;font-family:"Times New Roman",serif;line-height:11.65pt">
<span style="font-size:9pt;font-family:"Calibri Light",sans-serif" class=""> tri: [16384×3 double]</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></p>
<p class="MsoNormal" style="margin:0in 0in 8pt;font-size:12pt;font-family:"Times New Roman",serif;line-height:11.65pt">
<span style="font-size:9pt;font-family:"Calibri Light",sans-serif" class=""> unit: 'm'</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></p>
<p class="MsoNormal" style="margin:0in 0in 8pt;font-size:12pt;font-family:"Times New Roman",serif;line-height:11.65pt">
<span style="font-size:9pt;font-family:"Calibri Light",sans-serif" class=""> tissue: [8196×1 double] (<b class="">each of these is a value 1-70, corresponding to which atlas entry the voxel is located in)</b></span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></p>
<p class="MsoNormal" style="margin:0in 0in 8pt;font-size:12pt;font-family:"Times New Roman",serif;line-height:11.65pt">
<span style="font-size:9pt;font-family:"Calibri Light",sans-serif" class=""> tissuelabel: {1×70 cell}<b class="">(ROI labels for the atlas, includes broddman areas not separated by hemisphere)</b></span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></p>
<p class="MsoNormal" style="margin:0in 0in 8pt;font-size:12pt;font-family:"Times New Roman",serif;line-height:11.65pt">
<span style="font-size:9pt;font-family:"Calibri Light",sans-serif" class=""> cfg: [1×1 struct]</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></p>
<p class="MsoNormal" style="margin:0in 0in 8pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in;line-height:11.65pt">
<span style="font-size:9pt;font-family:"Calibri Light",sans-serif" class="">hemis2 =</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></p>
<p class="MsoNormal" style="margin:0in 0in 8pt 0.5in;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in;line-height:11.65pt">
<span style="font-size:9pt;font-family:"Calibri Light",sans-serif" class="">struct with fields:</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></p>
<p class="MsoNormal" style="margin:0in 0in 8pt 0.5in;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in;line-height:11.65pt">
<span style="font-size:9pt;font-family:"Calibri Light",sans-serif" class="">pos: [8196×3 double]</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></p>
<p class="MsoNormal" style="margin:0in 0in 8pt;font-size:12pt;font-family:"Times New Roman",serif;line-height:11.65pt">
<span style="font-size:9pt;font-family:"Calibri Light",sans-serif" class=""> tri: [16384×3 double]</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></p>
<p class="MsoNormal" style="margin:0in 0in 8pt;font-size:12pt;font-family:"Times New Roman",serif;line-height:11.65pt">
<span style="font-size:9pt;font-family:"Calibri Light",sans-serif" class=""> unit: 'm'</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></p>
<p class="MsoNormal" style="margin:0in 0in 8pt;font-size:12pt;font-family:"Times New Roman",serif;line-height:11.65pt">
<span style="font-size:9pt;font-family:"Calibri Light",sans-serif" class=""> tissue: [8196×1 double] (<b class="">each of these is a value 1-7, corresponding to which atlas entry the voxel is located in)</b></span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></p>
<p class="MsoNormal" style="margin:0in 0in 8pt;font-size:12pt;font-family:"Times New Roman",serif;line-height:11.65pt">
<span style="font-size:9pt;font-family:"Calibri Light",sans-serif" class=""> </span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></p>
<p class="MsoNormal" style="margin:0in 0in 8pt;font-size:12pt;font-family:"Times New Roman",serif;line-height:11.65pt">
<span style="font-size:9pt;font-family:"Calibri Light",sans-serif" class=""> tissuelabel: {1×7 cell}<span class=""> </span><b class="">(ROI Labels for hemisphere atlas, contains 3 Left areas, 3 Right Areas and one inter-hemispheric)</b></span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></p>
<p class="MsoNormal" style="margin:0in 0in 8pt;font-size:12pt;font-family:"Times New Roman",serif;line-height:11.65pt">
<span style="font-size:9pt;font-family:"Calibri Light",sans-serif" class=""> cfg: [1×1 struct]</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></p>
<p class="MsoNormal" style="margin:0in 0in 8pt;font-size:12pt;font-family:"Times New Roman",serif;line-height:11.65pt">
<span style="font-size:9pt;font-family:"Calibri Light",sans-serif" class=""> </span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></p>
<p class="MsoNormal" style="margin:0in 0in 8pt;font-size:12pt;font-family:"Times New Roman",serif;line-height:11.65pt">
<span style="font-size:9pt;font-family:"Calibri Light",sans-serif" class=""> </span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></p>
<p class="MsoNormal" style="margin:0in 0in 8pt;font-size:12pt;font-family:"Times New Roman",serif;line-height:11.65pt">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class="">Now I create a binary mask for each left and right broddman area. For each ROI in the broddman area atlas(1-70), I find all voxels that are located within. This gives me a list of voxels for
each broddman area. I then take each of these lists and find which are in the left hemisphere and which are in the right to get left and right broddman areas.<u class=""></u><u class=""></u></span></p>
<p class="MsoNormal" style="margin:0in 0in 8pt;font-size:12pt;font-family:"Times New Roman",serif;line-height:11.65pt">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class="">After these steps I am left with 140 binary masks, (size 1x8196), which equal 1 if the voxel is contained in the specific ROI and 0 if it is not. Using these masks, I extract the time course
power for each ROI by taking the mean power of every voxel in the roi at each time point:<u class=""></u><u class=""></u></span></p>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:9pt;font-family:Calibri,sans-serif" class=""> <span class=""> </span></span><span style="font-size:9pt;font-family:"Courier New"" class="">roiData(i,i3,i2) = mean(sourceEEG.trial(i2).pow(Masks{i},i3));</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:9pt;font-family:"Courier New"" class=""> </span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<span style="font-size:9pt;font-family:"Courier New"" class="">where i = roi number,</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:9pt;font-family:"Courier New"" class=""> </span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:9pt;font-family:"Courier New"" class=""> i2 = trial number,</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:9pt;font-family:"Courier New"" class=""> <span class=""> </span></span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:9pt;font-family:"Courier New"" class=""> i3 = time point</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:9pt;font-family:"Courier New"" class=""> </span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class="">In order to get this data into fieldtrip format, I put ROI data into an EEGLAB structure along with 6 emg channels that were recorded at the same time and use eeglab2fieldtrip function to
have a fieldtrip structure containing the broddman area sources as channels. (contained in<span class=""> </span><i class="">header</i>)<u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> <u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class="">After this I perform the final step of computing dtf connectivity between each of the source rois and the emg channels with the code below:<u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> <span class=""> </span><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<span style="font-size:9pt;font-family:"Courier New"" class="">cfg = [];</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<span style="font-size:9pt;font-family:"Courier New"" class="">cfg.method =<span class=""> </span><span style="color:rgb(160,32,240)" class="">'mtmfft'</span>;</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<span style="font-size:9pt;font-family:"Courier New"" class="">cfg.taper =<span class=""> </span><span style="color:rgb(160,32,240)" class="">'dpss'</span>;</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<span style="font-size:9pt;font-family:"Courier New"" class="">cfg.output =<span class=""> </span><span style="color:rgb(160,32,240)" class="">'fourier'</span>;</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<span style="font-size:9pt;font-family:"Courier New"" class="">cfg.tapsmofrq = 2;</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<span style="font-size:9pt;font-family:"Courier New"" class="">freq = ft_freqanalysis(cfg, header);</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<span style="font-size:9pt;font-family:"Courier New"" class="">cfg = [];</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<span style="font-size:9pt;font-family:"Courier New"" class="">cfg.method =<span class=""> </span><span style="color:rgb(160,32,240)" class="">'dtf'</span>;</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<span style="font-size:9pt;font-family:"Courier New"" class="">dtf = ft_connectivityanalysis(cfg, freq);</span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<span style="font-size:9pt;font-family:"Courier New"" class=""> </span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif;text-indent:0.5in" class="">
<span style="font-size:9pt;font-family:"Courier New"" class=""> </span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class="">The values I get in DTF are extremely low, 10^-20. I am not sure why but I believe it has to do with the way I am projecting source activations onto specific ROIs. Any help or advice on how
to change my pipeline is appreciated.<u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> <u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:9pt;font-family:Calibri,sans-serif" class=""> </span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class="">Best,<u class=""></u><u class=""></u></span></div>
</div>
<div class="">
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class="">Michael Glassen<u class=""></u><u class=""></u></span></div>
</div>
<p class="MsoNormal" style="margin:0in 0in 8pt;font-size:12pt;font-family:"Times New Roman",serif;line-height:11.65pt">
<span style="font-size:9pt;font-family:Calibri,sans-serif" class=""> </span><span style="font-size:11pt;font-family:Calibri,sans-serif" class=""><u class=""></u><u class=""></u></span></p>
<p class="MsoNormal" style="margin:0in 0in 8pt;font-size:12pt;font-family:"Times New Roman",serif;line-height:11.65pt">
<span style="font-size:11pt;font-family:Calibri,sans-serif" class=""> <u class=""></u><u class=""></u></span></p>
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<span style="font-size:10.5pt;font-family:Helvetica,sans-serif" class=""><br class="">
_______________________________________________<br class="">
fieldtrip mailing list<br class="">
</span><a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" style="color:purple;text-decoration:underline" target="_blank" class=""><span style="font-size:10.5pt;font-family:Helvetica,sans-serif;color:rgb(149,79,114)" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</span></a><span style="font-size:10.5pt;font-family:Helvetica,sans-serif" class=""><br class="">
</span><a href="https://doi.org/10.1371/journal.pcbi.1002202" style="color:purple;text-decoration:underline" target="_blank" class=""><span style="font-size:10.5pt;font-family:Helvetica,sans-serif;color:rgb(149,79,114)" class="">https://doi.org/10.1371/journal.pcbi.1002202</span></a><u class=""></u><u class=""></u></div>
</div>
</blockquote>
</div>
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<u class=""></u> <u class=""></u></div>
</div>
<div style="margin:0in 0in 0.0001pt;font-size:12pt;font-family:"Times New Roman",serif" class="">
<u class=""></u> <u class=""></u></div>
</div>
</div>
<br style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none" class="">
<span style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;float:none;display:inline!important" class=""> <span class=""> </span></span><span style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;float:none;display:inline!important" class="">_______________________________________________</span><br style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none" class="">
<span style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;float:none;display:inline!important" class="">fieldtrip
mailing list</span><br style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none" class="">
<span style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;float:none;display:inline!important" class=""><a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></span><br style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none" class="">
<span style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;float:none;display:inline!important" class=""><a href="https://doi.org/10.1371/journal.pcbi.1002202" target="_blank" class="">https://doi.org/10.1371/journal.pcbi.1002202</a></span></blockquote>
</div>
<br class="">
</div>
</div>
</div>
<br class="">
</div>
_______________________________________________<br class="">
fieldtrip mailing list<br class="">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br class="">
<a href="https://doi.org/10.1371/journal.pcbi.1002202" target="_blank" class="">https://doi.org/10.1371/journal.pcbi.1002202</a><br class="">
</div>
</blockquote>
</div>
<br class="">
</div>
</div>
_______________________________________________<br class="">
fieldtrip mailing list<br class="">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br class="">
<a href="https://doi.org/10.1371/journal.pcbi.1002202" rel="noreferrer" target="_blank" class="">https://doi.org/10.1371/journal.pcbi.1002202</a><br class="">
</blockquote>
</div>
</div>
</div>
_______________________________________________<br class="">
fieldtrip mailing list<br class="">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br class="">
https://doi.org/10.1371/journal.pcbi.1002202<br class="">
</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>