-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaltairPreprocOld.m
64 lines (51 loc) · 2.43 KB
/
altairPreprocOld.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
function EEG = altairPreproc(EEG)
% Extract the EEG, based on Gorka's code
%
% Parameters:
% filename EEGLAB EEG structure
% Output:
% EEG EEGLAB EEG structure with the output
%
% Written by: John LaRocco, Feb 2016
%
% Assumes: SOAR preprocessing base on Gorka for rough EEG.
% load('C:\Users\John\Documents\MATLAB\soarData\OSU-00001-04B\Actiview\OSU-00001-04B-01-ERN.bdf.mat')
channelLocationFile = 'C:\Users\John\Documents\MATLAB\eeglab2021.1\plugins\dipfit\standard_BESA\standard-10-5-cap385.elp';
EEG = pop_resample(EEG, 256, 0.8, 0.4); % BioSemi
EEG = pop_chanedit(EEG, 'lookup', channelLocationFile);
EEG = pop_basicfilter(EEG, 1:EEG.nbchan, 'Boundary', 'boundary','Cutoff', [ 0.1 30],'Design', 'butter','Filter', 'bandpass','Order', 2,'RemoveDC', 'on' );
EEG = pop_chanedit(EEG, 'lookup',channelLocationFile);
% 11c. Automatically detect and remove bad SCALP chans using clean_rawdata default parameters
EEG = pop_clean_rawdata(EEG,...
'FlatlineCriterion', 5,... % Maximum tolerated flatline duration in seconds (Default: 5)
'ChannelCriterion', 0.85,... % Minimum channel correlation with neighboring channels (default: 0.85)
'LineNoiseCriterion', 4,... % Maximum line noise relative to signal in standard deviations (default: 4)
'Highpass','off','BurstCriterion','off','WindowCriterion','off','BurstRejection','off','Distance','Euclidian');
trimChans = {};
for channel = 1:EEG.nbchan
trimChans{end+1} = EEG.chanlocs(channel).labels;
end
trimChans{end+1} = 'VEOG';
trimChans{end+1} = 'HEOG';
originalEEG = EEG;
allChans = {};
for channel = 1:EEG.nbchan
allChans{end+1} = EEG.chanlocs(channel).labels;
end
badChansList = {};
for channel = 1:length(allChans)
badChan = strcmp(trimChans, allChans(channel));
if sum(badChan) == 0
badChansList{end+1} = allChans{channel};
end
end
for channel = 1:length(badChansList)
EEG = pop_select(EEG, 'nochannel',{badChansList{channel}});
end
EEG = pop_interp(EEG, originalEEG.chanlocs, 'spherical');
EEG = pop_chanedit(EEG, 'lookup',channelLocationFile);
%EEG = pop_gratton(EEG, 35, 'chans', 1:EEG.nbchan);
%EEG = pop_gratton(EEG, 36, 'chans', 1:EEG.nbchan);
EEG = pop_select(EEG, 'nochannel',{'VEOG','HEOG'});
EEG = pop_chanedit(EEG, 'lookup',channelLocationFile);
end