[FieldTrip] Questions about matriz lead field

Tzvetan Popov tzvetan.popov at uni-konstanz.de
Wed Sep 24 10:58:45 CEST 2014


Allright then,

> Sorry for my continuous questions, but i am new in this world, the final objective of this is try of generate my own sources to generate my own simulate eeg data, and next aplicate the source analysis to found the same position of the dipole
here is what I would do using the standard head model and standard electrodes provided with fieldtrip. Just exchange the head model with your desired head model and make sure that the units match and the alignment of elec’s and vol is correct. 
good luck
tzvetan



load ('/Users/zez/Documents/matlabtools/fieldtrip-20140518/template/headmodel/standard_bem');
load ('/Users/zez/Documents/matlabtools/fieldtrip-20140518/template/headmodel/standard_mri');
elec = ft_read_sens('/Users/zez/Documents/matlabtools/fieldtrip-20140518/template/electrode/standard_1020.elc');
%%
ft_plot_mesh(vol.bnd(1), 'facecolor',[0.2 0.2 0.2], 'facealpha', 0.3, 'edgecolor', [1 1 1], 'edgealpha', 0.05);
hold on;
ft_plot_mesh(vol.bnd(2),'edgecolor','none','facealpha',0.4);
hold on;
ft_plot_mesh(vol.bnd(3),'edgecolor','none','facecolor',[0.4 0.6 0.4]);
hold on;
ft_plot_sens(elec,'style', 'sk');
%%
cfg=[];
cfg.method = 'ortho';
figure;
ft_sourceplot(cfg,mri);
%%
cfg=[];
cfg.dip.pos = [55 -7 5];%dipole located in the right heschl gyrus
cfg.dip.mom = [0 0 -1];
cfg.dip.frequency = 10;
cfg.dip.phase     = 2;
cfg.dip.amplitude = 1;
cfg.ntrials       = 20;
cfg.triallength   = 2;
cfg.fsample = 100;
cfg.vol     = vol;
cfg.elec    = elec;
cfg.relnoise = 0.1;
data  = ft_dipolesimulation(cfg);
data.elec = elec;
%%
cfg              = [];
cfg.output       = 'pow';
cfg.channel      = 'EEG';
cfg.method       = 'mtmconvol';
cfg.taper        = 'hanning';
cfg.foi          = 2:2:30;                         % analysis 2 to 30 Hz in steps of 2 Hz 
cfg.t_ftimwin    = ones(length(cfg.foi),1).*0.5;   % length of time window = 0.5 sec
cfg.toi          = 0:0.05:2;                  % time window "slides" from 0 to 2 sec in steps of 0.05 sec (50 ms)
TFRhann = ft_freqanalysis(cfg, data);
TLK = ft_timelockanalysis([],data);
%% plot the simulated signal in time and time-freq space
cfg = [];   
cfg.channel = {'FC2', 'FC4', 'FC6', 'FT8', 'C2', 'C4', 'C6', 'T8', 'T4'};
cfg.renderer = 'zbuffer';
cfg.xlim = [0.5 1.5];
figure 
subplot(2,2,1);ft_singleplotTFR(cfg, TFRhann);
subplot(2,2,2);ft_singleplotER(cfg,TLK);
cfg.channel = {'EEG'};
subplot(2,2,3);ft_topoplotTFR(cfg, TFRhann);
subplot(2,2,4);ft_topoplotER(cfg,TLK);
%%
cfg = [];
cfg.latency = [0.5 1.5];  % specify latency window 
cfg.numdipoles = 1;
cfg.vol = vol;
cfg.grid.resolution = 10;
cfg.grid.unit = 'mm';
dip = ft_dipolefitting(cfg, TLK);
%% plot the location of the dipole
cfg = [];
cfg.location = dip.dip.pos;  
figure; ft_sourceplot(cfg, mri)

> 
> 
> best 
> 
> -- 
> Gamaliel Huerta
> Ingeniería Civil Biomédica
> Universidad de Valparaíso
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20140924/a6758cb1/attachment.html>


More information about the fieldtrip mailing list