-
Notifications
You must be signed in to change notification settings - Fork 1
/
afqConverterMulti.m
38 lines (31 loc) · 1.02 KB
/
afqConverterMulti.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
function out = afqConverterMulti(afq_filename, ref_src_filename)
if ~isdeployed
addpath(genpath('/N/u/brlife/git/vistasoft'));
addpath(genpath('/N/u/brlife/git/jsonlab'));
addpath(genpath('/N/u/brlife/git/o3d-code'));
end
config = loadjson('config.json');
load(fullfile(char(afq_filename)));
ref_src = fullfile(char(ref_src_filename));
%convert afq to trk
disp('Converting afq to .trk');
%sub1
fid=fopen('tract_name_list.txt', 'w');
if (config.tract1 > 0)
for tract = [config.tract1]
if (tract > 0)
tract_name=strrep(fg_classified(tract).name,' ','_');
write_fg_to_trk_shift(fg_classified(tract),ref_src,sprintf('%s_tract.trk',tract_name));
fprintf(fid, [tract_name, '\n']);
end
end
else
for tract=1:length(fg_classified)
tract_name=strrep(fg_classified(tract).name,' ','_');
write_fg_to_trk_shift(fg_classified(tract),ref_src,sprintf('%s_tract.trk',tract_name));
fprintf(fid, [tract_name, '\n']);
end
end
fclose(fid);
exit;
end