-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtissueLevelAccuracySimplified.m
More file actions
104 lines (95 loc) · 3.47 KB
/
tissueLevelAccuracySimplified.m
File metadata and controls
104 lines (95 loc) · 3.47 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
103
104
function [accuracyinfo,tissuetally]=tissueLevelAccuracySimplified(matches,answers,partlist)
tissuetally={'neuron';'muscle',;'amphid';'hyp';'seam';'gut';'pharynx';'other'};%,unique({partlist{notempt,4}});
for i=1:size(tissuetally,1)
tissuetally{i,2}=0;%cases col
tissuetally{i,3}=0;%cases correct at cell level
tissuetally{i,4}=0;%non correct cases correct at tissue level
end
accuracyinfo=-1*ones(size(matches));
correctness=correctmatchesnames(matches, answers);
for i=1:length(matches)
%look up tissue index
indmatch=[];
indanswer=[];
%partlist match of automated
if ~isempty(matches{i})
indmatch=find(strcmpi(matches{i},partlist(:,2)));
end
%parlist match of answer
if ~isempty(answers{i})
indanswer=find(strcmpi(answers{i},partlist(:,2)));
end
tissueindex=[];
if ~isempty(indanswer)
tissueindex=find(strcmpi(partlist{indanswer,4},tissuetally(:,1)));
end
if(isempty(tissueindex))
tissueindex=size(tissuetally,1);
end
if~isempty(answers{i})
%increment found in category
tissuetally{tissueindex,2}=tissuetally{tissueindex,2}+1;
if(correctness(i))
accuracyinfo(i)=1;
tissuetally{tissueindex,3}=tissuetally{tissueindex,3}+1;
else
if ~isempty (indanswer)&~isempty(indmatch)
if strcmpi(partlist{indanswer,4},partlist{indmatch,4})
accuracyinfo(i)=2;
tissuetally{tissueindex,4}=tissuetally{tissueindex,4}+1;
end
end
end
end
end
%{
for i=1:length(matches)
indmatch=[];
indanswer=[];
%partlist match of automated
if ~isempty(matches{i})
indmatch=find(strcmpi(matches{i},partlist(:,2)));
end
if(strcmpi(answers{i},'Abarpaapaa'))
'test case'
end
%parlist match of answer
if ~isempty(answers{i})
indanswer=find(strcmpi(answers{i},partlist(:,2)));
end
%if both real and predicted are in part list
if ~isempty(indanswer)&~isempty(indmatch)
%find row in tally corresponding to actual tissue
tissueindex=find(strcmpi(partlist{indanswer,4},tissuetally(:,1)));
% tissueindexnswer=find(strcmpi(tissuetally(:,1),partlist{indmatch,4}));
if isempty(tissueindex)
tissueindex=size(tissuetally,1);
end
%increment found in category
tissuetally{tissueindex,2}=tissuetally{tissueindex,2}+1;
%match by identical
if strcmpi(matches{i},answers{i}) %indanswer==indmatch
accuracyinfo(i)=1;
tissuetally{tissueindex,3}=tissuetally{tissueindex,3}+1;
else
if strcmpi(partlist{indanswer,4},partlist{indmatch,4})
accuracyinfo(i)=2;
tissuetally{tissueindex,4}=tissuetally{tissueindex,4}+1;
end
end
else %is nonterminal/death and counts as other\
if(~isempty(answers{i}))
tissueindex=size(tissuetally,1);
%increment found in category
tissuetally{tissueindex,2}=tissuetally{tissueindex,2}+1;
end
if ~isempty(answers{i})&~isempty(matches{i})
%uncovered case of non terminal cells
if strcmpi(matches{i},answers{i})
accuracyinfo(i)=1;
tissuetally{tissueindex,3}=tissuetally{tissueindex,3}+1;
end
end
end
end
%}