<html><head></head><body><div style="color:#000; background-color:#fff; font-family:Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:13px"><div id="yui_3_16_0_ym19_1_1504771846881_6242">Hello everyone,</div><div style="" id="yui_3_16_0_ym19_1_1504771846881_11413"><br style="" id="yui_3_16_0_ym19_1_1504771846881_11414"></div><div style="" id="yui_3_16_0_ym19_1_1504771846881_11415">I would like to use fieldtrip for extracting source activity from specific ROIs (using the eLoreta approach).</div><div style="" id="yui_3_16_0_ym19_1_1504771846881_11416"><br style="" id="yui_3_16_0_ym19_1_1504771846881_11417"></div><div style="" id="yui_3_16_0_ym19_1_1504771846881_11418">Here is my script, there are few things I am not sure in the pipeline (marked with numbers on the right)</div><div style="" id="yui_3_16_0_ym19_1_1504771846881_11419"><br style="font-size: 12.8px;" id="yui_3_16_0_ym19_1_1504771846881_11420"><div style="font-size: 12.8px;" id="yui_3_16_0_ym19_1_1504771846881_11421"><div style="" id="yui_3_16_0_ym19_1_1504771846881_11422"><div style="" id="yui_3_16_0_ym19_1_1504771846881_11423"><div style="" id="yui_3_16_0_ym19_1_1504771846881_11424">% eLORETA </div><div style="" id="yui_3_16_0_ym19_1_1504771846881_11425">cfg = []; </div><div style="" id="yui_3_16_0_ym19_1_1504771846881_11426">cfg.method = 'eloreta';</div><div style="" id="yui_3_16_0_ym19_1_1504771846881_11427">cfg.grid = leadfield;</div><div style="" id="yui_3_16_0_ym19_1_1504771846881_11428">cfg.headmodel = headmodel;</div><div style="" id="yui_3_16_0_ym19_1_1504771846881_11429">cfg.eloreta.keepfilter = 'yes';</div><div style="" id="yui_3_16_0_ym19_1_1504771846881_11430">cfg.eloreta.normalize = 'yes';</div><div style="" id="yui_3_16_0_ym19_1_1504771846881_11431">cfg.eloreta.lambda = 0.05; *(1)</div><div style="" id="yui_3_16_0_ym19_1_1504771846881_11432">cfg.eloreta.projectnoise = 'yes';</div><div style="" id="yui_3_16_0_ym19_1_1504771846881_11433">eLO_source = ft_sourceanalysis(cfg,data);</div><div style="" id="yui_3_16_0_ym19_1_1504771846881_11434"><br style="" id="yui_3_16_0_ym19_1_1504771846881_11435"></div><div style="" id="yui_3_16_0_ym19_1_1504771846881_11436">% in the above line, "data" is the results of ft_timelockanalysis</div><div style="" id="yui_3_16_0_ym19_1_1504771846881_11437">% with cfg.covariance = 'yes'; *(2)</div><div style="" id="yui_3_16_0_ym19_1_1504771846881_11438"><br style="" id="yui_3_16_0_ym19_1_1504771846881_11439"></div><div style="" id="yui_3_16_0_ym19_1_1504771846881_11440">% then I put the source positions from the MNI template</div><div style="" id="yui_3_16_0_ym19_1_1504771846881_11441">% used for the sourcemodel (<span role="link" id="yui_3_16_0_ym19_1_1504771846881_11442"><span role="link" id="yui_3_16_0_ym19_1_1504771846881_11443"><a href="http://www.fieldtriptoolbox.org/tutorial/sourcemodel#subject-" target="_blank" style="font-size: 12.8px;" id="yui_3_16_0_ym19_1_1504771846881_11444">http://www.fieldtriptoolbox.org/tutorial/sourcemodel#subject-</a></span></span><span style="font-size: 12.8px;" id="yui_3_16_0_ym19_1_1504771846881_11445">specific_grids_that_are_equiva</span><span style="font-size: 12.8px;" id="yui_3_16_0_ym19_1_1504771846881_11446">lent_across_subjects_in_normal</span><span style="font-size: 12.8px;" id="yui_3_16_0_ym19_1_1504771846881_11447">ized_space)</span></div><div style="" id="yui_3_16_0_ym19_1_1504771846881_11448">eLO_source.pos = template_grid.pos;</div><div style="" id="yui_3_16_0_ym19_1_1504771846881_11449">iPOS = eLO_source.pos;</div><div style="" id="yui_3_16_0_ym19_1_1504771846881_11450">iPOS(eLO_source.inside==0,:) = NaN; % only points inside gray matter</div><div style="" id="yui_3_16_0_ym19_1_1504771846881_11451"><br style="" id="yui_3_16_0_ym19_1_1504771846881_11452"></div><div style="" id="yui_3_16_0_ym19_1_1504771846881_11453">% Then I select ROIs (here only one for simplicity) to extract <span style="" id="yui_3_16_0_ym19_1_1504771846881_11454">single</span>-<span style="" id="yui_3_16_0_ym19_1_1504771846881_11455">trial</span> source activity:</div><div style="" id="yui_3_16_0_ym19_1_1504771846881_11456">[v,I] <span style="white-space: pre-wrap;" id="yui_3_16_0_ym19_1_1504771846881_11457"> </span> = min(pdist2(iPOS, ROIs_mni , 'euclidean'));</div><div style="" id="yui_3_16_0_ym19_1_1504771846881_11458"><br style="" id="yui_3_16_0_ym19_1_1504771846881_11459"></div><div style="" id="yui_3_16_0_ym19_1_1504771846881_11460">% And I multiply the spatial filter for the EEG data in each <span style="" id="yui_3_16_0_ym19_1_1504771846881_11461">trial</span></div><div style="" id="yui_3_16_0_ym19_1_1504771846881_11462">W = eLO_source.avg.filter{I}; % filter at my ROI of interest</div><div style="" id="yui_3_16_0_ym19_1_1504771846881_11463">for tr = 1:size(data.<span style="" id="yui_3_16_0_ym19_1_1504771846881_11464">trial</span>,1)</div><div style="" id="yui_3_16_0_ym19_1_1504771846881_11465"> % loop over <span style="" id="yui_3_16_0_ym19_1_1504771846881_11466">trials</span> </div><div style="" id="yui_3_16_0_ym19_1_1504771846881_11467"> <span style="" id="yui_3_16_0_ym19_1_1504771846881_11468">trials</span>{tr} = W * squeeze(data.<span style="" id="yui_3_16_0_ym19_1_1504771846881_11469">trial</span>(tr,:,:)); *(3)</div><div style="" id="yui_3_16_0_ym19_1_1504771846881_11470">end</div></div><div style="" id="yui_3_16_0_ym19_1_1504771846881_11471"><br style="" id="yui_3_16_0_ym19_1_1504771846881_11472"></div></div></div><div style="font-size: 12.8px;" id="yui_3_16_0_ym19_1_1504771846881_11473">Is this approach correct?</div><div style="font-size: 12.8px;" id="yui_3_16_0_ym19_1_1504771846881_11474">My main questions are:</div><div style="font-size: 12.8px;" id="yui_3_16_0_ym19_1_1504771846881_11475"><br style="" id="yui_3_16_0_ym19_1_1504771846881_11476"></div><div style="font-size: 12.8px;" id="yui_3_16_0_ym19_1_1504771846881_11477">*(1)
Is there a way to select the best lambda parameter (e.g., selecting the
one that best approximates the activity at the EEG channels level)?</div><div style="font-size: 12.8px;" id="yui_3_16_0_ym19_1_1504771846881_11478"><br style="" id="yui_3_16_0_ym19_1_1504771846881_11479"></div><div style="font-size: 12.8px;" id="yui_3_16_0_ym19_1_1504771846881_11480">*(2)
I am confused about the role of the covariance, since it doesn't seem
to be used when source activity is estimated using the <span role="link" id="yui_3_16_0_ym19_1_1504771846881_11481">set </span>of spatial filters at the <span style="" id="yui_3_16_0_ym19_1_1504771846881_11482">single</span> <span style="" id="yui_3_16_0_ym19_1_1504771846881_11483">trial</span></div><div style="font-size: 12.8px;" id="yui_3_16_0_ym19_1_1504771846881_11484"><br style="" id="yui_3_16_0_ym19_1_1504771846881_11485"></div><div style="font-size: 12.8px;" id="yui_3_16_0_ym19_1_1504771846881_11486">*(3) Is the "<span style="" id="yui_3_16_0_ym19_1_1504771846881_11487">trials</span>{tr} = W * squeeze(data.<span style="" id="yui_3_16_0_ym19_1_1504771846881_11488">trial</span>(tr,:,:)); " approach correct to get time-series of source activity in a ROI?</div><div style="font-size: 12.8px;" id="yui_3_16_0_ym19_1_1504771846881_11489"><br style="" id="yui_3_16_0_ym19_1_1504771846881_11490"></div></div><br style="" id="yui_3_16_0_ym19_1_1504771846881_11491" clear="all"><div style="" id="yui_3_16_0_ym19_1_1504771846881_11492"><div dir="ltr" id="yui_3_16_0_ym19_1_1504771846881_11501">Best,</div><div dir="ltr" id="yui_3_16_0_ym19_1_1504771846881_11502">Alice<br></div></div></div></body></html>