forked from sccn/EEG-BIDS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpop_deriv_bidsload.m
36 lines (28 loc) · 1.3 KB
/
pop_deriv_bidsload.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
function EEG = pop_deriv_bidsload()
if nargin < 1
[fa, fb] = uigetfile('*.edf','Select an EDF file');
fileLocation = [fb fa];
else
return; % For now as this is only going to be used from the menu
end
disp('Loading derivative...');
filePrefix = fileLocation(1:end-8);
%LOAD BIDS FILES
sphereLoc = [filePrefix '_icasphere.tsv'];
weightsLoc = [filePrefix '_icaweights.tsv'];
annoFile = [filePrefix '_annotations.tsv'];
% Select paired raw file
[fa, fb] = uigetfile('*.edf','Select paired raw EDF file');
rawFileLocation = [fb fa];
rawFilePrefix = rawFileLocation(1:end-8);
elecFile = [rawFilePrefix '_electrodes.tsv'];
eventsFile = [rawFilePrefix '_events.tsv'];
EEG = pop_bidsload(fileLocation,'elecLoc',elecFile,'eventLoc',eventsFile,'icaSphere',sphereLoc,'icaWeights',weightsLoc,'annoLoc',annoFile);
% Update color and flag information with fix script:
% Removed for now as this is specific to lossless
% fixMarks;
% Load extra ICLabel inforation from via non-bids method
tmp = load([filePrefix '_iclabel.mat']);
EEG.etc.ic_classification = tmp.tmp; % Octave makes this a bit strange...
EEG.etc.ic_classification.ICLabel.classifications = real(EEG.etc.ic_classification.ICLabel.classifications);
end