-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdp_node_dmri_preprocess_set_defaults.m
57 lines (39 loc) · 1.56 KB
/
dp_node_dmri_preprocess_set_defaults.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
classdef dp_node_dmri_preprocess_set_defaults < dp_node_workflow
% Builds an input structure suitable for dmri operations
% with outputs as follows
%
% dmri_fn
% bval_fn
% bvec_fn
% json_fn
% xps_fn
methods
function obj = dp_node_dmri_preprocess_set_defaults(input_field_name, xps)
% only use the xps argument if you want to force ans xps upon
% the data, otherwise, it uses the data from bval bvec
%
% this now assumes LTE (b_delta = 1)
if (nargin < 2), xps = []; end
nodes = {dp_node_io_rename({{'dmri_fn', input_field_name}})};
if (isempty(xps))
% adds dmri_fn, bval_fn, bvec_fn
nodes{end+1} = dp_node_dmri_io_bval_bvec('dmri_fn');
% make the xps_fn
b_delta = 1; % assume linear tensor encoding
nodes{end+1} = dp_node_dmri_xps_from_bval_bvec(b_delta);
else
% force an xps onto the data
nodes{end+1} = dp_node_dmri_xps_force(xps);
% make bval bvec from this xps
nodes{end+1} = dp_node_dmri_io_xps_to_bval_bvec();
end
% add the json_fn
function json_fn = dmri2json_fn(dmri_fn)
[p,n] = msf_fileparts(dmri_fn);
json_fn = fullfile(p, cat(2, n, '.json'));
end
nodes{end+1} = dp_node_io('json_fn', @(x) dmri2json_fn(x.dmri_fn));
obj = obj@dp_node_workflow(nodes);
end
end
end