[FieldTrip] Looped ft_sourcenalysis
Monika
monik2407993 at gmail.com
Fri Jul 19 13:20:45 CEST 2024
Hello All again!
I have read some articles and i have a question about using
ft_sourceanalysis.
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
ROI 1 signal value for 1st time point | signal value for 2nd time point
.....
ROI 2 signal value for 1st time point | signal value for 2nd time point
.....
ROI 3 signal value for 1st time point | signa value for 2nd time point .....
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?
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?
I want to do this for baseline period and stimulus period separately, so i
can then compare if there were any significant changes.
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.
If this is complete nonsense please let me know.
Im passing my loop code below.
Best regards and thank you for your help.
Monika
%%%code
%that is only for baseline, the same idea will go to stimulus data
source_baseline_all = cell(1, length(data_baseline.trial));
source_stimulus_all = cell(1, length(data_stimulus.trial));
%source analysis for each trial
for i = 1:length(data_baseline.trial)
%creating temporary structure containing only one trial in loop
temp_data = data_baseline;
temp_data.trial = {data_baseline.trial{i}};
temp_data.time = {data_baseline.time{i}};
temp_data.sampleinfo = data_baseline.sampleinfo(i, :);
temp_data.trialinfo = data_baseline.trialinfo(i, :);
cfg = [];
cfg.method = 'lcmv';
cfg.headmodel = headmodel;
cfg.sourcemodel = sourcemodel;
cfg.lcmv.keepfilter = 'yes';
cfg.lcmv.fixedori = 'yes';
source_baseline_all{i} = ft_sourceanalysis(cfg, temp_data);
end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20240719/bfe491cf/attachment.htm>
More information about the fieldtrip
mailing list