<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">
Hi Monika,
<div><br>
</div>
<div>I think that a lot of implicit pointers are given in this thread: <a href="https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.science.ru.nl%2Fpipermail%2Ffieldtrip%2F2023-August%2F042194.html&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C4c6c8db44c4342a3397708dcaa3b2717%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638572418240044056%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=63jWwrSsr3Q5GCNdTvC%2BXKQTLd1ZSysjhrTBx4KAF%2Fw%3D&reserved=0" originalsrc="https://mailman.science.ru.nl/pipermail/fieldtrip/2023-August/042194.html" shash="bm6inecIEtcKbTG5Q0HTLogsW7awUAgl1yv84lDVfTcbmFeFet1DToTzXchaTfTGnc0PDyGhZQsM7+vMpqtAYPRa6nDMb5qOVhwwP2V56QR1ZL0B+20R1R+uzGn4NfjiZ8VWAbwhzqSUzw+9ukk98VFG7xe/TmfAUX2lilHfZFA=">https://mailman.science.ru.nl/pipermail/fieldtrip/2023-August/042194.html</a> (please
explore the different messages in the thread)</div>
<div><br>
</div>
<div>In general it is not recommended to compute beamformer (lcmv) spatial filters using single data in a loop.</div>
<div><br>
</div>
<div>Also, if you only have 19 channels I would seriously consider not do do source analysis, and stick to the channel level to try and answer your scientific question.</div>
<div><br>
</div>
<div>Best wishes,</div>
<div>Jan-Mathijs<br id="lineBreakAtBeginningOfMessage">
<div><br>
<blockquote type="cite">
<div>On 19 Jul 2024, at 13:20, Monika via fieldtrip <fieldtrip@science.ru.nl> wrote:</div>
<br class="Apple-interchange-newline">
<div>
<div dir="ltr">Hello All again!
<div><br>
</div>
<div>I have read some articles and i have a question about using ft_sourceanalysis. </div>
<div><br>
</div>
<div>I don't want to perform source analysis on averaged data from all epochs, because i want to create a matrix where i will have reconstructed source data for each ROI from atlas. I need my data to be epoched, and not power, since i want to do multiple operations
on this matrix. So the matrix will look like</div>
<div>ROI 1 signal value for 1st time point | signal value for 2nd time point .....</div>
<div>ROI 2 signal value for 1st time point | signal value for 2nd time point .....</div>
<div>ROI 3 signal value for 1st time point | signa value for 2nd time point .....</div>
<div><br>
</div>
<div>In this situation should i do the source analysis in loop separately for all trials? I did not see this approach in any tutorial (if there is one like that i didnt found it). Is it a good idea?</div>
<div> I understand that ft_sourceanalysis perform source analysis on averaged data from default, but if i pass separate epochs in loop and then concatenate the source data can i then perform interpolation and parcellation to atlas each epoch separately? <br>
</div>
<div>I want to do this for baseline period and stimulus period separately, so i can then compare if there were any significant changes. </div>
<div><br>
</div>
<div>I also wonder if there maybe is some quicker approach, since on my computer ft_sourceanalysis is taking long time even for one epoch (i have 19 electrodes and computing each one is taking long), so if i have 1000 epochs it will take hours to complete.</div>
<div><br>
</div>
<div>If this is complete nonsense please let me know.</div>
<div>Im passing my loop code below.</div>
<div><br>
</div>
<div>Best regards and thank you for your help.</div>
<div>Monika</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>%%%code</div>
<div>
<div class="gmail-rtcContent" style="padding:30px">
<div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">
<span style="white-space:pre"><span style="color:rgb(0,128,19)">%that is only for baseline, the same idea will go to stimulus data</span></span></div>
<div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">
<span style="white-space:pre">source_baseline_all = cell(1, length(data_baseline.trial));</span></div>
<div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">
<span style="white-space:pre">source_stimulus_all = cell(1, length(data_stimulus.trial));</span></div>
<div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">
</div>
<div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">
<span style="white-space:pre"><span style="color:rgb(0,128,19)">%source analysis for each trial</span></span></div>
<div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">
<span style="white-space:pre"><span style="color:rgb(14,0,255)">for </span>i = 1:length(data_baseline.trial)</span></div>
<div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">
<span style="white-space:pre"><span style="color:rgb(0,128,19)">%creating temporary structure containing only one trial in loop</span></span></div>
<div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">
<span style="white-space:pre">temp_data = data_baseline;</span></div>
<div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">
<span style="white-space:pre">temp_data.trial = {data_baseline.trial{i}};</span></div>
<div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">
<span style="white-space:pre">temp_data.time = {data_baseline.time{i}};</span></div>
<div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">
<span style="white-space:pre">temp_data.sampleinfo = data_baseline.sampleinfo(i, :);</span></div>
<div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">
<span style="white-space:pre">temp_data.trialinfo = data_baseline.trialinfo(i, :);</span></div>
<div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">
<span style="white-space:pre"></span></div>
<div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">
<span style="white-space:pre">cfg = [];</span></div>
<div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">
<span style="white-space:pre">cfg.method = <span style="color:rgb(167,9,245)">'lcmv'</span>;</span></div>
<div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">
<span style="white-space:pre">cfg.headmodel = headmodel;</span></div>
<div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">
<span style="white-space:pre">cfg.sourcemodel = sourcemodel;</span></div>
<div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">
<span style="white-space:pre">cfg.lcmv.keepfilter = <span style="color:rgb(167,9,245)">
'yes'</span>;</span></div>
<div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">
<span style="white-space:pre">cfg.lcmv.fixedori = <span style="color:rgb(167,9,245)">
'yes'</span>;</span></div>
<div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">
<span style="white-space:pre">source_baseline_all{i} = ft_sourceanalysis(cfg, temp_data);</span></div>
<div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">
<span style="white-space:pre"><span style="color:rgb(14,0,255)">end</span></span></div>
</div>
</div>
<div><br>
</div>
</div>
_______________________________________________<br>
fieldtrip mailing list<br>
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip<br>
https://doi.org/10.1371/journal.pcbi.1002202<br>
</div>
</blockquote>
</div>
<br>
</div>
</body>
</html>