-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcalc_sqi_dataset.m
51 lines (41 loc) · 1.29 KB
/
calc_sqi_dataset.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
function [ SQI ] = calc_sqi_dataset ( DATASET )
PATH = ['./records/' DATASET ];
RES_PATH = ['./results/' DATASET];
if ( ~exist(PATH,'dir') )
fprintf('NO EXISTE EL DATASET\n');
return;
end
if ( ~exist(RES_PATH,'dir') )
mkdir(RES_PATH);
end
if ( exist([PATH '/RECORDS-acceptable'],'file') )
f = fopen([PATH '/RECORDS-acceptable']);
files = textscan(f,'%s');
fclose(f);
end
parfor i=1:numel(files{:})
procFile(files{1}{i},PATH,RES_PATH,1);
end
clear files;
if ( exist([PATH '/RECORDS-unacceptable'],'file') )
f = fopen([PATH '/RECORDS-unacceptable']);
files = textscan(f,'%s');
fclose(f);
end
parfor i=1:numel(files{:})
procFile(files{1}{i},PATH,RES_PATH,0);
end
end
function procFile (file,PATH,RES_PATH,acceptable)
cacheResults=0;
fprintf('processing %s\n',file);
if (cacheResults == 1)
if (~exist([RES_PATH '/sqi_' file '.mat'],'file'))
sqi = calc_all_sqi([PATH '/' file]);
save([RES_PATH '/sqi_' file '.mat'],'file','sqi','acceptable');
end
else
sqi = calc_all_sqi([PATH '/' file]);
save([RES_PATH '/sqi_' file '.mat'],'file','sqi','acceptable');
end
end