BP(Brain Products)脑电数据处理
一、BP分析软件导出数据、标签
1.1 BP分析软件加载原始数据
a)在“File”的下拉菜单中,点击“New”选项,在弹出的对话框中设置数据路径:
Raw Files: 原始数据存放路径
History Files: 随后操作过程存储路径
Export Files: 数据输出的存储路径
设置成功后,就可以在Primary区中看到导入的数据,如下图所示。
1.2导出Markers
之后会弹出下图界面,按照图中勾选,如选择XML Marker File,则内容过多,我这里就选择了下图的勾选,内容相对较少,方便后续在MATLAB中使用程序提取。
会在1.1中设置的Export Files 文件下生成该Markers文件。
该文件可以直接记事本或者MATLAB打开,大概内容如下图所示:
1.3 将原始数据导出成edf格式输出
这里选择所有通道数据导出,即默认设置。
1.4 MATLAB处理
[header, recorddata] = readedf('0003_Raw Data-edf.edf'); %%读取数据,header中存放的是原始数据
importMarker = importdata('0003_Raw Data_Edit Markers.Markers'); %读取marker信息
triggerLatency =[];
triggerType =[];
%提取Markers信息s
for i = 4:length(importMarker)
commaPosition = strfind(importMarker{i},',');
triggerType = cat(1,triggerType,['S' importMarker{i}(commaPosition(2)-2:commaPosition(2)-1)]);
triggerLatency = cat(1,triggerLatency,str2num(importMarker{i}(commaPosition(2)+2:commaPosition(3)-1)));
end
%保存脑电数据和Markers
EEG.event.type = cell(length(triggerType),1);
EEG.data = header;
EEG.event.latency = triggerLatency;
for i = 1:length(triggerType)
EEG.event.type{i} = strrep(triggerType(i,:), ' ', '');
end
save('0003_Raw Data.mat','EEG')