-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDQ_RemoveSamplesByConfidence.m
44 lines (36 loc) · 1.56 KB
/
DQ_RemoveSamplesByConfidence.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
function [p_timestamp, p_pupdil] = DQ_RemoveSamplesByConfidence(timestamp, pupdil, conf, outlineConf, confidenceThreshold, outlineConfidenceThreshold)
mask = false(size(timestamp, 1), 1);
regarded_c = true;
regarded_oc = true;
uniq_c = unique(conf);
if length(uniq_c) == 1 && (isnan(uniq_c(1)) || uniq_c(1) == -1)
regarded_c = false;
log_w('Confidence values are invalid, thus we are not currently rejecting samples by confidence.')
end
uniq_oc = unique(outlineConf);
if length(uniq_oc) == 1 && (isnan(uniq_oc(1)) || uniq_oc(1) == -1)
regarded_oc = false;
log_w('Outline confidence values are invalid, thus we are not currently rejecting samples by outline confidence.')
end
% % % log_i('Using the AND logic: if a sample fulfils ALL criteria, it will pass.')
% % % for(j = 1:size(timestamp,1))
% % % if regarded_c && conf(j) < confidenceThreshold
% % % continue;
% % % end
% % % if regarded_oc && outlineConf(j) < outlineConfidenceThreshold
% % % continue;
% % % end
% % % mask(j) = true;
% % % end
log_i('Using the OR logic: if a sample fulfils ANY criteria, it will pass.')
for(j = 1:size(timestamp,1))
if regarded_c && conf(j) >= confidenceThreshold
mask(j) = true;
end
if regarded_oc && outlineConf(j) >= outlineConfidenceThreshold
mask(j) = true;
end
end
p_timestamp = timestamp(mask);
p_pupdil = pupdil(mask);
end