-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcg_mantis_scalper_run.m
37 lines (30 loc) · 1.15 KB
/
cg_mantis_scalper_run.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
function res = cg_mantis_scalper_run( job )
%cfg_mantis_scalper_run Simple scalper of neonate T2 scan
% Calls external ITK code
exedir = char(cg_mantis_get_defaults('opts.itk'));
% Do we need to do something for windows?
exe = fullfile(exedir, 'neonateScalper');
exeprefix = char(cg_mantis_get_defaults('opts.externalcommandprefix'));
exe = [exeprefix exe];
% We need to be able to process multiple structural scans
for k=1:numel(job.vols)
prefix = job.scalperprefix;
structfile=char(job.vols{k});
[srcdir, corename, ext]=fileparts(structfile);
% get rid of the ,1 at the end of the filename
ext=regexprep(ext, ',\d$','');
T2=fullfile( srcdir, [corename ext]);
OUTPREF=fullfile(srcdir, [prefix corename ext]);
OUTMASK=fullfile(srcdir, [prefix 'mask' corename ext]);
command=[exe ' --input ' T2 ' --output ' OUTPREF ' --mask ' OUTMASK];
system(command);
outnames{k}=OUTPREF;
mantisCopyHeader(T2, outnames{k});
T2names{k}=T2;
disp(['Completed scalping ' corename]);
end
% result is the segmented csf. We need to return a structure containing
% this filename
res.scalped = outnames;
res.structural=T2names;
end