-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdp_node_fsl_bet.m
executable file
·37 lines (26 loc) · 1.03 KB
/
dp_node_fsl_bet.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
classdef dp_node_fsl_bet < dp_node
% brain extraction tool from FSL
properties
opt_str = []; % example -f 0.7 -g 0.4 (see bet documentation)
end
methods
function obj = dp_node_fsl_bet(opt_str)
if (nargin == 0), opt_str = ''; end
obj.opt_str = opt_str;
obj.output_test = {'nii_fn', 'mask_fn'};
end
function output = i2o(obj, input)
output.mask_fn = dp.new_fn(input.op, input.nii_fn, '_mask');
output.nii_fn = dp.new_fn(input.op, input.nii_fn, '_bet');
end
function output = execute(obj, input, output)
% Build the flirt command
bet_cmd = sprintf('bet %s %s %s', input.nii_fn, output.nii_fn, obj.opt_str);
msf_mkdir(fileparts(output.nii_fn));
msf_system(bet_cmd); % Execute the command
% also output the mask
[I,h] = mdm_nii_read(output.nii_fn);
mdm_nii_write(double(I > 0), output.mask_fn, h);
end
end
end