-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAFQ_betweenPreviousCurrent.m
More file actions
106 lines (84 loc) · 2.82 KB
/
AFQ_betweenPreviousCurrent.m
File metadata and controls
106 lines (84 loc) · 2.82 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
function [Diff] = AFQ_betweenPreviousCurrent
%
% To compare the diffusivities between 2 measurement in different
%
% Example:
%
% AFQdata = '/home/jyeatman/matlab/svn/vistadata/AFQ'
% dt = dtiLoadDt6(fullfile(AFQdata,'subj2','dt6.mat'))
% fg_classified = AFQ_SegmentFiberGroups(dt)
% numberOfNodes = 30; clip2rois = 1; subDir = fullfile(AFQdata,'subj2');
% [fa md rd ad cl SuperFibersGroup] =
% AFQ_ComputeTractProperties(fg_classified,dt,numberOfNodes,clip2rois,subDir)
%%
[homeDir, subDir] = Tama_subj;
[homeDir2, subDir2] = Tama_subj2;
[homeDir3, subDir3] = Tama_subj3;
%%
id2 = [16,17,18,13];
id3 = [11,13,12,17];
% boxes to contain values
Diff = struct;
for ii = 1:3 ;
% take fg_classified from previous measurment
if ii<4,
sub_dir = fullfile(homeDir2,subDir2{id2(ii)},'dwi_2nd');
else
sub_dir = fullfile(homeDir,subDir{id2(ii)},'dwi_2nd');
end
fgDir = fullfile(sub_dir,'fibers');
fg_classified = fgRead(fullfile(fgDir,'MoriGroups_Cortex_clean_D5_L4.mat'));
dt = fullfile(sub_dir,'/dt6.mat');
dt6_2 = dtiLoadDt6(dt);
% t1 = niftiRead(dt.files.t1);
dt6_3 = dtiLoadDt6(fullfile(homeDir3,subDir3{id3(ii)},'/dwi_2nd/dt6.mat'));
%%
numberOfNodes = 100;
clip2rois = 1;
%% Compute TractProfile
[fa, md, rd, ad, cl, vol, TractProfile] = AFQ_ComputeTractProperties(fg_classified, dt6_2, numberOfNodes, clip2rois, sub_dir);
% [fa(ii,1), md(ii,1), rd(ii,1), ad(ii,1), cl(ii,1), vol(ii,1), TractProfile{ii,1}] = AFQ_ComputeTractProperties(fg_classified, dt6_2, numberOfNodes, clip2rois, sub_dir);
[fa2, md2, rd2, ad2, cl2, vol2, TractProfile2] = AFQ_ComputeTractProperties(fg_classified, dt6_3, numberOfNodes, clip2rois, sub_dir);
% Store the data
Diff.fa{ii} = fa;
Diff.md{ii} = md;
Diff.ad{ii} = ad;
Diff.rd{ii} = rd;
Diff.cl{ii} = cl;
Diff.cl{ii} = vol;
Diff.TP{ii} = TractProfile;
Diff.subject{ii} = sub_dir;
Diff.fa2{ii} = fa2;
Diff.md2{ii} = md2;
Diff.ad2{ii} = ad2;
Diff.rd2{ii} = rd2;
Diff.cl2{ii} = cl2;
Diff.cl2{ii} = vol2;
Diff.TP{ii} = TractProfile2;
clear fa md ad rd fa2 md2 ad2 rd2 TractProfile TractProfile2
end
%%
TamagawaPath('long')
cd result/
save Diff Diff
%%
cd /sni-storage/wandell/biac2/wandell/data/LHON_LongitudinalChange/result
load Diff
%%
X =1:100;
c = lines(10);
% dif = Diff.fa{1}(:,1)-Diff.fa2{1}(:,1);
for ii = 1:3
for jj = 1:20
figure; hold on;
Y1 = Diff.fa{ii}(:,jj);
Y2 = Diff.fa2{ii}(:,jj);
if ~isnan(nansum(Y1)) && ~isnan(nansum(Y2)),
plot(X,Y1,'color',c(3,:))
plot(X,Y2,'color',c(4,:))
% tractname = Diff.TP{1}(ii).name;
% tractname = strrep(tractname,' ','');
% title(ii)
end
end
end