<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Helvetica;
panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
{font-family:Times;
panose-1:2 2 6 3 5 4 5 2 3 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.apple-converted-space
{mso-style-name:apple-converted-space;}
span.s1
{mso-style-name:s1;}
span.s2
{mso-style-name:s2;}
span.EmailStyle22
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:1234967867;
mso-list-template-ids:413683260;}
@list l0:level1
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:36.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l0:level2
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:72.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l0:level3
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:108.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l0:level4
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:144.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l0:level5
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:180.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l0:level6
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:216.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l0:level7
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:252.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l0:level8
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:288.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l0:level9
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:324.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-GB" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Hi Jan-Mathijs<o:p></o:p></p>
<p class="MsoNormal">Many thanks for your reply below, I followed your advice and while it did take a little bit of work it was nice to see it working. <o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Many thanks and regards<o:p></o:p></p>
<p class="MsoNormal">Johan<o:p></o:p></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> fieldtrip <fieldtrip-bounces@science.ru.nl>
<b>On Behalf Of </b>Schoffelen, J.M. (Jan Mathijs) via fieldtrip<br>
<b>Sent:</b> 22 March 2024 08:15<br>
<b>To:</b> FieldTrip discussion list <fieldtrip@science.ru.nl><br>
<b>Cc:</b> Schoffelen, J.M. (Jan Mathijs) <janmathijs.schoffelen@donders.ru.nl><br>
<b>Subject:</b> Re: [FieldTrip] Single trial time series of spectral data in source space<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Hi Johan, <o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">If you want to do a ’superlet’ analysis on time series data that are defined in source space, you need to ensure first and foremost that you input data in to ft_freqanalysis is recognized by FieldTrip as if it is a channel level data structure.
Source level data is not supported by ft_freqanalysis. Moreover, it typically does not make sense to compute a TFR-like decomposition on 10,000’s of source points, if the original data consisted only of 300’ish channel points. Therefore, the recommended way
forward would be to compute the source-level time series on a parcellated (e.g. cortical sheet).<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">The way forward would be:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">1 compute a spatial filter on a well-defined sourcemodel, using the inverse operator of choice. (and cfg.keepfilter = ‘yes’)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">2 create a parcellation (e.g. atlas-based) of the sourcemodel of your liking.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">3 use ft_virtualchannel with the original input data, together with the output of step 1 and 2 to create virtual channel time series, where each channel represents a source parcel<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">4 do the superlet (or whatever other downstream) analysis.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Good luck and happy computing, <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Jan-Mathijs<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal"><br>
<br>
<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">On 15 Mar 2024, at 16:59, Johan Liljefors via fieldtrip <<a href="mailto:fieldtrip@science.ru.nl">fieldtrip@science.ru.nl</a>> wrote:<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal"><span lang="SV">Dear Fieldtrip users</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">I am working on calculating trial level time series of spectral power in source space, for a MEG dataset I have collected. I have pre-processed and cleaned my data, which for a single subject is stored in the variable<span class="apple-converted-space"> </span><i>data_meg</i>.
I have the following variables:<o:p></o:p></p>
</div>
<ul style="margin-top:0cm" type="disc">
<li class="MsoListParagraph" style="margin-top:0cm;margin-bottom:0cm;margin-bottom:.0001pt;mso-list:l0 level1 lfo1">
data_meg: The cleaned and preprocessed dataset for a single subject<o:p></o:p></li><li class="MsoListParagraph" style="margin-top:0cm;margin-bottom:0cm;margin-bottom:.0001pt;mso-list:l0 level1 lfo1">
Headmodel_mne_meg and sourcemodelT: aligned headmodels, and sourcemodel (which has been calculated using Freesurfer)<o:p></o:p></li></ul>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">If anyone has experience they can share it would be very appreciated. I have made an attempt below, the code runs but I cant tell if the results makes sense or not.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Thank you for your time,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Regards<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Johan<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">My code is as follows:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><i>% Load the data</i><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas">[data_meg, headmodel_mne_meg, sourcemodelT] = load_data(wsl_path,par_i,false);</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><i> </i><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><i>% Compute the forward solution</i><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas">leadfield_mne = compute_leadfield(data_ meg, sourcemodelT, headmodel_mne_meg);</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><i>% Calculate evoked data and apply noise covariance matrix from empty room recording</i><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas">cfg = [];</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas">cfg.covariance =<span class="apple-converted-space"> </span><span style="color:#AA04F9">'yes'</span>;</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas">cfg.covariancewindow = [-1 7.5];</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas">cfg.keeptrials =<span class="apple-converted-space"> </span><span style="color:#AA04F9">'no'</span>;</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas">data_ind_avg = ft_timelockanalysis(cfg, data_ meg);</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas">data_ind_avg.cov = cov_noise{par_i}; % cov_noise{par_i} is the subject covariance matrix from the empty room recording</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><i><span style="font-size:10.0pt;font-family:Consolas">% Calculate the spatial filter using the evoked dataset and the noise covariance</span></i><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas">source_avg = source_recon(leadfield_mne, headmodel_mne_meg, [],data_ind_avg);</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas">filter = source_avg.avg.filter;</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas">% Do trial level source reconstruction using the filter</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas">source_trial = source_recon_trials(leadfield_mne, headmodel_mne_meg, filter, data_meg);</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><i>% Calculate trial level spectral power using superlets and save the power spectrum</i><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><i>% This is done by “faking” a fieldtrip structure by putting each single trial into the .avg field and then running ft_freqanalysis</i><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas">foi = 8:26;</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas">toi = -1:0.01:7.5;</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas">powspctrm = zeros(length(data_meg.trialinfo),<span style="color:#0E00FF">...</span></span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> size(sourcemodelT.pos,1),<span style="color:#0E00FF">...</span></span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> length(foi),<span style="color:#0E00FF">...</span></span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> length(toi)); </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><i> </i><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas;color:#0E00FF">parfor<span class="apple-converted-space"> </span></span><span style="font-size:10.0pt;font-family:Consolas">iTrial = 1:length(data_meg.trialinfo)</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> source_single_trial = rmfield(source_trial,<span style="color:#AA04F9">"trial"</span>); % These two lines “fake” a single trial which is then processed by ft_freqanalysis</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> source_single_trial.avg = source_trial.trial(iTrial);</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> cfg = [];</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> cfg.method =<span class="apple-converted-space"> </span><span style="color:#AA04F9">'superlet'</span>;</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> cfg.output =<span class="apple-converted-space"> </span><span style="color:#AA04F9">'pow'</span>;</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> cfg.pad =<span class="apple-converted-space"> </span><span style="color:#AA04F9">'nextpow2'</span>;</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> cfg.foi = foi;</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> cfg.toi = toi;</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> <span class="apple-converted-space"> </span><span style="color:#028009">% cfg.order goes from 1 to 30 (<a href="https://www.biorxiv.org/content/10.1101/583732v4.full.pdf"><span style="color:#954F72">https://www.biorxiv.org/content/10.1101/583732v4.full.pdf</span></a>)</span></span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> cfg.order = floor(linspace(1,30,numel(cfg.foi)));</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> cfg.width = 5;</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> cfg.gwidth = 3;</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> TFR_induced = ft_freqanalysis(cfg,source_single_trial);</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> powspctrm(iTrial,:,:,:) = TFR_induced.powspctrm;</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas;color:#0E00FF">end</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas;color:#028009">% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas;color:#028009">% LOCAL FUNCTIONS %</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas;color:#028009">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas;color:#0E00FF">function<span class="apple-converted-space"> </span></span><span style="font-size:10.0pt;font-family:Consolas">leadfield_mne = compute_leadfield(data_meg, sourcemodelT, headmodel_mne_meg)</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> cfg = [];</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> cfg.grad = data_meg.grad; <span class="apple-converted-space"> </span><span style="color:#028009">% sensor positions</span></span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> cfg.channel =<span class="apple-converted-space"> </span><span style="color:#AA04F9">'meggrad'</span>; <span style="color:#028009">% the used channels</span></span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> cfg.senstype =<span class="apple-converted-space"> </span><span style="color:#AA04F9">'meg'</span>;</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> cfg.sourcemodel = sourcemodelT;</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> cfg.headmodel = headmodel_mne_meg; <span class="apple-converted-space"> </span><span style="color:#028009">% volume conduction model</span></span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> leadfield_mne = ft_prepare_leadfield(cfg,data_meg);</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas;color:#0E00FF">end</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas;color:#0E00FF">function<span class="apple-converted-space"> </span></span><span style="font-size:10.0pt;font-family:Consolas">source = source_recon(leadfield_mne, headmodel_mne_meg, filter,
data)</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> cfg = [];</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> cfg.method =<span class="apple-converted-space"> </span><span style="color:#AA04F9">'mne'</span>;</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> cfg.channel =<span class="apple-converted-space"> </span><span style="color:#AA04F9">'meggrad'</span>;</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> cfg.senstype =<span class="apple-converted-space"> </span><span style="color:#AA04F9">'meg'</span>;</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> cfg.latency = [-1 7.5];</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> cfg.sourcemodel = leadfield_mne; <span class="apple-converted-space"> </span><span style="color:#028009"> </span></span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> cfg.headmodel = headmodel_mne_meg;</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> cfg.mne.prewhiten =<span class="apple-converted-space"> </span><span style="color:#AA04F9">'yes'</span>;</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> cfg.mne.lambda = 3;</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> cfg.mne.scalesourcecov =<span class="apple-converted-space"> </span><span style="color:#AA04F9">'yes'</span>;</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> <span class="apple-converted-space"> </span><span style="color:#0E00FF">if<span class="apple-converted-space"> </span></span>isempty(filter)</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> cfg.mne.keepfilter =<span class="apple-converted-space"> </span><span style="color:#AA04F9">'yes'</span>;</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> <span class="apple-converted-space"> </span><span style="color:#0E00FF">else</span></span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> cfg.sourcemodel.filter = filter;</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> <span class="apple-converted-space"> </span><span style="color:#0E00FF">end</span> <span class="apple-converted-space"> </span></span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> source = ft_sourceanalysis(cfg,data);</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas;color:#0E00FF">end</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas;color:#0E00FF">function<span class="apple-converted-space"> </span></span><span style="font-size:10.0pt;font-family:Consolas">source_trial = source_recon_trials(leadfield_mne, headmodel_mne_meg,
filter, data_meg)</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> cfg = [];</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> cfg.method =<span class="apple-converted-space"> </span><span style="color:#AA04F9">'mne'</span>;</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> cfg.channel =<span class="apple-converted-space"> </span><span style="color:#AA04F9">'meggrad'</span>;</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> cfg.senstype =<span class="apple-converted-space"> </span><span style="color:#AA04F9">'meg'</span>;</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> cfg.latency = [-1 7.5];</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> cfg.sourcemodel = leadfield_mne; <span class="apple-converted-space"> </span><span style="color:#028009"> </span></span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> cfg.headmodel = headmodel_mne_meg;</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> cfg.mne.prewhiten =<span class="apple-converted-space"> </span><span style="color:#AA04F9">'yes'</span>;</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> cfg.mne.lambda = 3;</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> cfg.mne.scalesourcecov =<span class="apple-converted-space"> </span><span style="color:#AA04F9">'yes'</span>;</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> <span class="apple-converted-space"> </span><span style="color:#0E00FF">if<span class="apple-converted-space"> </span></span>isempty(filter)</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> cfg.mne.keepfilter =<span class="apple-converted-space"> </span><span style="color:#AA04F9">'yes'</span>;</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> <span class="apple-converted-space"> </span><span style="color:#0E00FF">else</span></span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> cfg.sourcemodel.filter = filter;</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> <span class="apple-converted-space"> </span><span style="color:#0E00FF">end</span></span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> cfg.keeptrials =<span class="apple-converted-space"> </span><span style="color:#AA04F9">'yes'</span>;</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> cfg.rawtrial =<span class="apple-converted-space"> </span><span style="color:#AA04F9">'yes'</span>;</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> source_trial = ft_sourceanalysis(cfg,data_meg);</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas;color:#0E00FF">end</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Times",serif"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Times",serif"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span class="s1"><i><span style="font-size:9.0pt;font-family:"Times",serif">När du skickar e-post till Karolinska Institutet (KI) innebär detta att KI kommer att behandla dina personuppgifter.</span></i></span><span class="apple-converted-space"><i><span style="font-size:9.0pt;font-family:"Times",serif"> </span></i></span><span class="s1"><span style="font-size:9.0pt;font-family:"Times",serif"><a href="https://ki.se/om-ki/integritetsskyddspolicy"><span class="s2"><span style="color:#0000EE">Här
finns information om hur KI behandlar personuppgifter</span></span></a>.</span></span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:"Times",serif"> </span></span><span style="font-size:9.0pt;font-family:"Times",serif"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Times",serif"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span class="s1"><i><span style="font-size:9.0pt;font-family:"Times",serif">Sending email to Karolinska Institutet (KI) will result in KI processing your personal data.</span></i></span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:"Times",serif"> </span></span><span class="s1"><span style="font-size:9.0pt;font-family:"Times",serif"><a href="https://staff.ki.se/data-protection-policy"><span class="s2"><span style="color:#0000EE">You
can read more about KI’s processing of personal data here</span></span></a>.</span></span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:"Times",serif"> </span></span><span style="font-size:9.0pt;font-family:"Times",serif"><o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Helvetica",sans-serif">_______________________________________________<br>
fieldtrip mailing list<br>
</span><a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip"><span style="font-size:10.5pt;font-family:"Helvetica",sans-serif;color:#954F72">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</span></a><span style="font-size:10.5pt;font-family:"Helvetica",sans-serif"><br>
</span><a href="https://doi.org/10.1371/journal.pcbi.1002202"><span style="font-size:10.5pt;font-family:"Helvetica",sans-serif;color:#954F72">https://doi.org/10.1371/journal.pcbi.1002202</span></a><o:p></o:p></p>
</div>
</blockquote>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="1561.6">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 14.0px; font: 12.0px Times; color: #000000; -webkit-text-stroke: #000000; min-height: 14.0px}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 14.0px; font: 12.0px Times; color: #000000; -webkit-text-stroke: #000000}
span.s1 {font-kerning: none}
span.s2 {text-decoration: underline ; font-kerning: none; color: #0000ee; -webkit-text-stroke: 0px #0000ee}
</style>
<p class="p1"><span class="s1"></span><br>
</p>
<p class="p1"><span class="s1"></span><br>
</p>
<p class="p2"><span class="s1"><i>När du skickar e-post till Karolinska Institutet (KI) innebär detta att KI kommer att behandla dina personuppgifter.
</i><a href="https://ki.se/om-ki/integritetsskyddspolicy"><span class="s2">Här finns information om hur KI behandlar personuppgifter</span></a>.<span class="Apple-converted-space"> </span></span></p>
<p class="p1"><span class="s1"></span><br>
</p>
<p class="p2"><span class="s1"><i>Sending email to Karolinska Institutet (KI) will result in KI processing your personal data.</i>
<a href="https://staff.ki.se/data-protection-policy"><span class="s2">You can read more about KI’s processing of personal data here</span></a>.<span class="Apple-converted-space"> </span></span></p>
</body>
</html>