-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdp_node_dcm2nii_on_folder.m
executable file
·67 lines (47 loc) · 1.79 KB
/
dp_node_dcm2nii_on_folder.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
65
66
67
classdef dp_node_dcm2nii_on_folder < dp_node_items
% this runs dcm2nii_and_xps on folders with dicoms
%
% expects the following of the outputs of the previous node
% ip - input path to dcms
% op - output path to dcs
properties
do_print_skip = 0;
end
methods
function obj = dp_node_dcm2nii_on_folder()
obj = obj@dp_node_items(dp_node_dcm2nii_and_xps());
end
% function yes_no = do_skip(obj, fn)
% yes_no = 0;
% end
function input = po2i(obj, po)
% expect:
% po.ip (input folder with zips)
% po.op (output folder with zips)
if (~exist(po.ip, 'dir'))
error('could not find input path (ip)');
end
di = dir(fullfile(po.ip));
input.items = {};
for c = 1:numel(di)
if (~di(c).isdir), continue; end
if (di(c).name(1) == '.'), continue; end
% if (obj.do_skip(di(c).name))
% if (obj.do_print_skip)
% obj.log('Skipping: %s:%s\n', po.id, di(c).name);
% end
% continue;
% end
tmp_input.dcm_folder = fullfile(po.ip, di(c).name);
tmp_input.bp = po.bp;
tmp_input.op = po.op;
x = tmp_input.dcm_folder;
if (x(end) == filesep), x = x(1:(end-1)); end
tmp_input.dcm_name = x((1+find(x == filesep, 1, 'last')):end);
tmp_input.id = po.id;
% we haven't really decided on naming here...
input.items{end+1} = tmp_input;
end
end
end
end