-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathNucleusData.m
67 lines (57 loc) · 1.89 KB
/
NucleusData.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
classdef NucleusData < handle
properties
labelNum
area
areaToConvexHullRatio
centroid
cluster
small
numNuclei
end
methods
function nd = NucleusData(labelNum, area, areaToConvexHullRatio, cluster, centroid)
if nargin == 0
return;
end
nd.labelNum = labelNum;
nd.area = area;
nd.areaToConvexHullRatio = areaToConvexHullRatio;
nd.cluster = cluster;
nd.centroid = centroid;
end
function ln = getLabelNum(nd)
ln = nd.labelNum;
end
function a = getArea(nd)
a = nd.area;
end
function a2chr = getAreaToConvexHullRatio(nd)
a2chr = nd.areaToConvexHullRatio;
end
function sml = isSmall(nd)
sml = nd.small;
end
function clstr = isCluster(nd)
clstr = nd.cluster;
end
function str = toString(nd)
str = 'NucleusData[';
str = sprintf('%slabelNum=%d', str, nd.labelNum);
str = sprintf('%s,area=%d', str, nd.area);
str = sprintf('%s,areaToConvexHullRatio=%f', str, nd.areaToConvexHullRatio);
str = sprintf('%s,cluster=%d', str, nd.cluster);
str = sprintf('%s,small=%d', str, nd.small);
str = sprintf('%s,numNuclei=%d', str, nd.numNuclei);
str = sprintf('%s]', str);
end
function nd2 = copy(nd)
% nd2 = NucleusData(nd.labelNum, nd.area, nd.areaToConvexHullRatio, nd.cluster, nd.small, nd.numNuclei);
nd2 = NucleusData();
% p = fieldnames(struct(nd));
p = properties(nd);
for i = 1:numel(p)
nd2.(p{i}) = nd.(p{i});
end
end
end
end