-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdp_node_fsl_tbss_skeletonize.m
executable file
·49 lines (33 loc) · 1.27 KB
/
dp_node_fsl_tbss_skeletonize.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
classdef dp_node_fsl_tbss_skeletonize < dp_node
% skeletonize data
properties
search_rule_mask_fn = '/usr/local/fsl/data/standard/LowerCingulum_1mm.nii.gz';
end
methods
function output = i2o(obj, input)
output.nii_fn = dp.new_fn(input.op, input.nii_fn, '_skeleton');
output.tmp = obj.make_tmp();
end
function output = execute(obj, input, output)
% create masked fa
[I,h] = mdm_nii_read(input.nii_fn);
M = mdm_nii_read(input.fa_mask_fn);
tmp_fn = fullfile(output.tmp.bp, 'tmp.nii');
mdm_nii_write(double(I) .* double(M), tmp_fn, h);
function x = f(x)
[a,b] = msf_fileparts(x);
x = fullfile(a,b);
end
cmd = sprintf('tbss_skeleton -i %s -p %1.2f %s %s %s %s', ...
f(input.mean_masked_fa_fn), ...
input.fa_threshold, ...
f(input.dist_map_fn), ...
f(obj.search_rule_mask_fn), ...
f(tmp_fn), ...
f(output.nii_fn));
msf_mkdir(msf_fileparts(output.nii_fn));
msf_delete(output.nii_fn);
[r,s] = msf_system(cmd);
end
end
end