-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdp_node_primary_list_lund.m
56 lines (37 loc) · 1.26 KB
/
dp_node_primary_list_lund.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
classdef dp_node_primary_list_lund < dp_node_primary
% This class provides outputs that list subjects, which
% are structured on the Lund pipeline format:
%
% Subject_ID/Exam_date_1/
properties
bp;
project_prefix
end
methods
function obj = dp_node_primary_list_lund(bp, project_prefix)
obj.bp = bp;
obj.project_prefix = project_prefix;
if (project_prefix(end) == '_')
warning('Prefix should not end with underscore');
end
end
function outputs = get_iterable(obj)
tmp = fullfile(obj.bp, sprintf('%s_*', obj.project_prefix));
obj.log(0, '%tSearching for subjects: %s', tmp);
d = dir(tmp);
if (numel(d) == 0)
obj.log(0, '%t Found nothing');
end
outputs = {};
% find folders
for c = 1:numel(d)
d2 = dir(fullfile(obj.bp, d(c).name, '20*'));
for c2 = 1:numel(d2)
output.bp = obj.bp;
output.id = fullfile(d(c).name, d2(c2).name);
outputs{end+1} = output; %#ok<AGROW>
end
end
end
end
end