基于汉宁窗、多窗口和小波的时频分析
有态度 有深度 有温度
你的科研小伙伴
如何使用汉宁窗、多窗口和小波对单个对象的脑电信号进行时频分析?(本文以MEG数据为例)相信你看完这篇文章,会有所收获。
(4)可视化结果。通过单通道(ft_singleplotTFR)或多通道(ft_multiplotTFR)创建时间-频率图,或者以指定的时间-频率间隔创建地形图(ft_topoplotTFR)来实现。
时频分析的步骤示意图
cfg = [];
cfg.trials = data_all.trialinfo == 3;
dataFIC = ft_redefinetrial(cfg, data_all);
load dataFIC
下面的代码是以500ms的时间窗为例。
cfg = [];
cfg.output = 'pow';
cfg.channel = 'MEG';
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.5:0.05:1.5; % time window "slides" from -0.5 to 1.5 sec in steps of 0.05 sec (50 ms)
TFRhann = ft_freqanalysis(cfg, dataFIC);
TFRhann =
label: {149x1 cell} % Channel names
dimord: 'chan_freq_time' % Dimensions contained in powspctrm, channels X frequencies X time
freq: [2 4 6 8 10 12 14 16 18 20 22 24 26 28 30] % Array of frequencies of interest (the elements of freq may be different from your cfg.foi input depending on your trial length)
time: [1x41 double] % Array of time points considered
powspctrm: [149x15x41 double] % 3-D matrix containing the power values
elec: [1x1 struct] % Electrode positions etc
grad: [1x1 struct] % Gradiometer positions etc
cfg: [1x1 struct] % Settings used in computing this frequency decomposition
cfg = [];
cfg.baseline = [-0.5 -0.1];
cfg.baselinetype = 'absolute';
cfg.zlim = [-2.5e-27 2.5e-27];
cfg.showlabels = 'yes';
cfg.layout = 'CTF151_helmet.mat';
figure
ft_multiplotTFR(cfg, TFRhann);
cfg = [];
cfg.baseline = [-0.5 -0.1];
cfg.baselinetype = 'absolute';
cfg.maskstyle = 'saturation';
cfg.zlim = [-2.5e-27 2.5e-27];
cfg.channel = 'MRC15';
cfg.layout = 'CTF151_helmet.mat';
figure
ft_singleplotTFR(cfg, TFRhann);
使用ft_singleplotTFR获得的单个传感器的时频图
cfg = [];
cfg.baseline = [-0.5 -0.1];
cfg.baselinetype = 'absolute';
cfg.xlim = [0.9 1.3];
cfg.zlim = [-1e-27 1e-27];
cfg.ylim = [15 20];
cfg.marker = 'on';
cfg.layout = 'CTF151_helmet.mat';
cfg.colorbar = 'yes';
figure
ft_topoplotTFR(cfg, TFRhann);
使用ft_topoplotTFR获得时频表征(15-20Hz,刺激后0.9-1.3s)的地形图
cfg = [];
cfg.output = 'pow';
cfg.channel = 'MRC15';
cfg.method = 'mtmconvol';
cfg.taper = 'hanning';
cfg.foi = 2:1:30;
cfg.t_ftimwin = 7./cfg.foi; % 7 cycles per time window
cfg.toi = -0.5:0.05:1.5;
TFRhann7 = ft_freqanalysis(cfg, dataFIC);
使用ft_singleplotTFR绘制结果:
cfg = [];
cfg.baseline = [-0.5 -0.1];
cfg.baselinetype = 'absolute';
cfg.maskstyle = 'saturation';
cfg.zlim = [-2e-27 2e-27];
cfg.channel = 'MRC15';
cfg.interactive = 'no';
cfg.layout = 'CTF151_helmet.mat';
figure
ft_singleplotTFR(cfg, TFRhann7);
使用ft_singleplotTFR获得的MRC15的时频图
设置完这些参数后,呈现的图如下:
a)使用多窗口法的TFRs设置的特征图;b)由以上设置参数产生的时间-频率图示例。
cfg = [];
cfg.output = 'pow';
cfg.channel = 'MEG';
cfg.method = 'mtmconvol';
cfg.foi = 1:2:30;
cfg.t_ftimwin = 5./cfg.foi;
cfg.tapsmofrq = 0.4 *cfg.foi;
cfg.toi = -0.5:0.05:1.5;
TFRmult = ft_freqanalysis(cfg, dataFIC);
绘制结果
cfg = [];
cfg.baseline = [-0.5 -0.1];
cfg.baselinetype = 'absolute';
cfg.zlim = [-2e-27 2e-27];
cfg.showlabels = 'yes';
cfg.layout = 'CTF151_helmet.mat';
cfg.colorbar = 'yes';
figure
ft_multiplotTFR(cfg, TFRmult)
使用多窗口法计算功率的时频图。
cfg = [];
cfg.channel = 'MEG';
cfg.method = 'wavelet';
cfg.width = 7;
cfg.output = 'pow';
cfg.foi = 1:2:30;
cfg.toi = -0.5:0.05:1.5;
TFRwave = ft_freqanalysis(cfg, dataFIC);
绘制结果
cfg = [];
cfg.baseline = [-0.5 -0.1];
cfg.baselinetype = 'absolute';
cfg.zlim = [-2e-25 2e-25];
cfg.showlabels = 'yes';
cfg.layout = 'CTF151_helmet.mat';
cfg.colorbar = 'yes';
figure
ft_multiplotTFR(cfg, TFRwave)
1.胡理.脑电信号处理与特征提取[M].科学出版社.2020.
2.Percival, D. B. , & Walden, A. T. . (1993). Spectral analysis for physical applications (multitaper and conventional univariate techniques) || references. , 10.1017/CBO9780511622762, 546-561.
3.Tallon-Baudry, C. , & Bertrand, O. . (1999). Oscillatory gamma activity in humans and its role in object representation. Trends in Cognitive Sciences.
4.Mitra, P. P. , & Pesaran, B. . (1998). Analysis of dynamic brain imaging data. Biophysical Journal, 76(2), 691-708.
5.https://www.fieldtriptoolbox.org/tutorial/timefrequencyanalysis/