[Eeglablist] Fieldtrip Source-localization issues
Makoto Miyakoshi
mmiyakoshi at ucsd.edu
Tue Apr 4 08:25:33 PDT 2023
Dear Ugo,
In this Wiki article, you see my past simulation reports using Fieldtrip.
https://sccn.ucsd.edu/wiki/Makoto's_preprocessing_pipeline#Does_a_broad_dipole_layer_produce_a_depth_bias_when_fitted_with_a_single_dipole.3F_.28For_190.2C000_page_views.2C_02.2F22.2F2022_added.2C_07.2F18.2F2022_updated.29
In separate email, I will send you all Matlab code to replicate it. I
cannot provide the completely detailed support on this, but I hope you can
find the tricks I used to make it work.
Makoto
On Sat, Apr 1, 2023 at 5:42 PM Bruzadin Nunes, Ugo via eeglablist <
eeglablist at sccn.ucsd.edu> wrote:
> Dear EEGLAB community,
>
> I know this is a fieldtrip problem, but I’m using the dipfit settings to
> source-localize frequency activity. I hope anyone can help me! I have two
> issues and one question.
>
> 1. When I plot the source localization, the orientation is 90 degrees
> wrong. When using dipfit, the activity is correctly localized, but after
> doing all the dipfit processes – altered to plot frequency – 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.
> 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.
> 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 the
> 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
>
>
>
>
> _______________________________________________
> Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
> To unsubscribe, send an empty email to
> eeglablist-unsubscribe at sccn.ucsd.edu
> For digest mode, send an email with the subject "set digest mime" to
> eeglablist-request at sccn.ucsd.edu
>
More information about the eeglablist
mailing list