[FieldTrip] Headmodel orientation eloreta
Ugo Bruzadin Nunes
ugobnunes at hotmail.com
Sat Apr 1 23:33:41 CEST 2023
Dear fieldtrip community,
I’m using some of eeglab’s dipfit settings to source-localize frequency activity, but this is mainly a fieldtrip issue. I hope anyone can help me and I appreciate any advice. I have two issues and one question.
1. When I plot the source localization, the orientation is 90 degrees wrong. When using dipfit in eeglab, the activity is correctly localized; but after doing all the dipfit processes – altered to plot frequency instead of component – frontal activity is being plot in the right ear. I thought something was wrong, so I artificially increased the activity at channel 12 (the anterior-most channel in my channel model), and the activity is coming from the ear in the eloreta instead. I can’t figure out where the rotation is incorrect and how I should approach the solution, since in EEGLAB the channels are correctly plotted.
2. For some reason, fieldtrip won’t accept the atlas. The error says my axis are 10mm in diameter, and the atlas is 150mm in each direction. I’m reading the ROI_MNI_V4 atlas in. Do I have to interpolate it?
3. I am not sure the following code is localizing and plotting the correct frequencies. I don’t think it’s working, but I haven’t tested individual frequencies yet since I haven’t fixed the headmodel orientation issue.
Below is my code! Any feedback is welcome. Thank you so much in advance,
Ugo
Ugo Bruzadin Nunes, Ph.D. Candidate (he/him)
Visiting Assistant Professor, Psychology
Webster University
Script/Code:
EEG = pop_dipfit_settings( EEG, 'hdmfile',...
'C:\\GitHub\\eeglab\\plugins\\dipfit3.7\\standard_BEM\\standard_vol.mat','coordformat','MNI','mrifile',...
'C:\\GitHub\\eeglab\\plugins\\dipfit3.7\\standard_BEM\\standard_mri.mat','chanfile',...
['C:\\GitHub\\eeglab\\plugins\\dipfit3.7\\standard_BEM\\elec\\standard_1005.elc ' ],...
'coord_transform',...
[0.05476 -17.3653 -8.1318 0.075502 0.0031836 -1.5696 11.7138 12.7933 12.213] ,'chansel',[1:EEG.nbchan] );
atlas = ft_read_atlas('ROI_MNI_V4.nii');
%% compute spectral params (only need to be done once to get the right structures)
EEGdata = eeglab2fieldtrip(EEG, 'preprocessing', 'none');
cfg = [];
cfg.method = 'mtmfft';
cfg.output = 'powandcsd';
cfg.tapsmofrq = 10;
cfg.foilim = range;
cfg.pad = 'nextpow2';
cfg.gpu = 'yes';
fftdata = ft_freqanalysis(cfg, EEGdata);
if ~isfield(EEG,'lor')
EEG.lor = struct();
end
EEG.fftdata = fftdata;
%% read headmodel
p = fileparts(which('eeglab'));
if ~isfield(EEG.lor,'HM')
headmodel = load('-mat', EEG.dipfit.hdmfile);
headmodel = headmodel.vol;
EEG.lor.HM = headmodel;
else
headmodel = EEG.lor.HM;
end
cfg = [];
cfg.elec = fftdata.elec;
cfg.headmodel = headmodel;
cfg.reducerank = 2;
cfg.grid.resolution = 10; % use a 3-D grid with a 1 cm resolution
cfg.grid.unit = 'mm';
cfg.channel = { 'all' };
cfg.parallel = 'yes';
cfg.solver = 'cg';
[grid] = ft_prepare_leadfield(cfg);
EEG.lor.grid = grid;
mri = load('-mat', EEG.dipfit.mrifile);
mri = ft_volumereslice([], mri.mri);
EEG.lor.mri = mri;
%% loops per frequency then plots
counter = 0;
numfreq = size(frequencies,2);
EEGlor = EEG;
vol = load('-mat', EEG.dipfit.hdmfile);
for i = 1:numfreq
atlas = ft_read_atlas('ROI_MNI_V4.nii');
freq = frequencies(i);
cfg = struct(g.ft_sourceanalysis_params{:});
cfg.frequency = freq;
cfg.grid = grid;
cfg.headmodel = headmodel;
cfg.method = 'eloreta';
cfg.atlas = atlas;
cfg.roi = atlas.tissuelabel;
cfg.eloreta.projectnoise = 'yes';
cfg.eloreta.lambda = 5;
cfg.gpu = 'yes';
sourcemodel = ft_sourceanalysis(cfg, fftdata);
EEGlor.lor.cfg(numfreq) = cfg;
EEGlor.lor.freq(numfreq) = fftdata;
EEGlor.lor.source(numfreq) = sourcemodel;
%% load MRI and INTERPOLATE
cfg = [];
cfg.downsample = 2;
cfg.parameter = 'avg.pow';
sourcemodel.oridimord = 'pos';
sourcemodel.momdimord = 'pos';
sourcemodel_int = ft_sourceinterpolate(cfg2, sourcemodel , mri);
EEGlor.lor.source_int(numfreq) = sourcemodel_int;
%% plot
cfg = [];
cfg.method = 'ortho';
cfg.funparameter = 'pow';
ft_sourceplot(cfg2,sourcemodel_int);
textsc(sprintf('eLoreta source localization of %d frequency power',freq), 'title');
%
end
Ugo
Ugo Bruzadin Nunes, Ph.D. Candidate (he/him)
Visiting Professor, Psychology
Webster University
Office Location: ISB room 316
Office Number: (314) 968-7677
Ugo at webster.edu<mailto:UgoBruzadinNunes at webster.edu>
Ugo
Ugo Bruzadin Nunes, Ph.D. Candidate (he/him)
Visiting Professor, Psychology
Webster University
Office Location: ISB room 316
Office Number: (314) 968-7677
Ugo at webster.edu<mailto:UgoBruzadinNunes at webster.edu>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20230401/c13eb78d/attachment.htm>
More information about the fieldtrip
mailing list