-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvof_lateralmedial_life.m
95 lines (80 loc) · 3.35 KB
/
vof_lateralmedial_life.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
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
function vof_lateralmedial_life(feFileToLoad, fibername, roisDir, roiNames, roiOperations, nboots, nmontecarlo)
% This function computes the strength of evidence for lateral and medial
% VOF. LIFE code and MBA code by Franco Pestilli are required.
% https://github.com/francopestilli/life
% https://github.com/francopestilli/mba
%
% INPUT:
% feFileToLoad: a full path to .mat file containing fe structure (generated by LIFE code). Use strings for loading multiple connectome data.
% fibername: a name for fibers. Used for output file name.
% roisDir: a directory containing waypoint ROI mat files
% roiNames: names for waypoint ROIs (string)
% roiOperations: 'and', selecting fiber passing through the ROI, 'not',
% excluding fiber passing through the ROIs, 'endpoints', selecting fibers
% with endpoint within the ROI.
% nboots: number of bootstrap. Default is 100000.
% nmontecarlo: number of the repetition of montecarlo simulation. Default is 5.
%
% In the paper, HT used the VOFPlane2 as 'AND' ROIs. Lateral/Medial white
% matter ROIs (with respect to CoS) were used as either 'endpoints' or
% 'not' ROIs.
%
% EXAMPLE:
% feFileToLoad{1} = '/home/vof/data/S1/life/LH_1stconnectome_fe.mat';
% feFileToLoad{2} = '/home/vof/data/S1/life/LH_2ndconnectome_fe.mat';
% feFileToLoad{3} = '/home/vof/data/S1/life/LH_3rdconnectome_fe.mat';
% fibername = 'LVOF_MedialFromCoS';
% roisDir = '/home/vof/data/S1/ROIs/Waypoint/';
% roiNames = {'LH_VOFPlane2.mat','LH_LateralFromCoS_WM.mat','LH_MedialfromCoS_WM.mat'};
% roiOperations = {'and','not','endpoints'};
% vof_lateralmedial_life(feFileToLoad, fibername, roisDir, roiNames, roiOperations);
%
% Copyright (c) Hiromasa Takemura and Franco Pestilli, 2013, Stanford VISTA team
% Argument checking
if notDefined('nboots')
nboots = 100000;
end
if notDefined('nmontecarlo')
nmontecarlo = 5;
end
% Define file name for output .mat file
savematfile = [fibername, '_StrengthEvidence.mat'];
sizecon = size(feFileToLoad);
for connum = 1:sizecon(2)
% Read ROI files
for iroi = 1:length(roiNames)
rois{iroi} = fullfile(roisDir,roiNames{iroi});
end
% Load LIFE file
disp('loading the LiFE structure...')
if ischar(feFileToLoad{connum})
fprintf('Loading %s ...\n',feFileToLoad{connum})
load(feFileToLoad{connum});
else
fe =feFileToLoad{connum};
clear feFileToLoad;
end
% Extract the fiber group from the FE structure
fg = feGet(fe,'fibers acpc');
% Segmenting VOF from connectome
fprintf('Segmenting the Tract from Connectome ...\n')
[fgsegment, keepFascicles] = feSegmentFascicleFromConnectome(fg, rois, roiOperations, 'prob connectome');
% Exclude outliers
fprintf('Excluding outliers from Fasciculus ...\n')
[fgsegment2 keepFascicles2] = vof_gradient_removeoutlier(fe, keepFascicles,2,rois{1},rois{2});
[fgsegment3, keepFascicle3] = mbaComputeFibersOutliers(fgsegment2,3,3,25);
keepFascicles4 = keepFascicles2;
keepFascicle2matrix = find(keepFascicles2);
for kj = 1:length(keepFascicle3)
if keepFascicle3(kj)==0,
keepFascicles4(keepFascicle2matrix(kj)) = 0;
else
end
end
% Start to test the tract
fprintf('Testing the Tract ...\n')
[se{connum}] = feVirtualLesion(fe, keepFascicles4);
end
% save file
save(savematfile, 'se');
end