-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathgetArea.m
49 lines (47 loc) · 1.35 KB
/
getArea.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
function area = getArea( userdata, varargin )
% GETAREA Returns the surface area of an anatomical model
%
% Usage:
% area = getArea( userdata )
% Where:
% userdata - see importcarto_mem
% area - the surface area (cm^2)
%
% GETAREA accepts the following parameter-value pairs
% 'method' {'nofill'}|'fill'
%
% GETAREA Returns the surface area of an anatomical model. The anatomical
% model can first be closed (filling any holes) by specifying the 'method',
% 'fill' ('nofill' by default).
%
% Author: Steven Williams (2020) (Copyright)
% SPDX-License-Identifier: Apache-2.0
%
% Modifications -
%
% Info on Code Testing:
% ---------------------------------------------------------------
% area = getArea( userdata, 'method', 'fill' )
% ---------------------------------------------------------------
%
% ---------------------------------------------------------------
% code
% ---------------------------------------------------------------
nStandardArgs = 1; % UPDATE VALUE
method = 'nofill';
if nargin > nStandardArgs
for i = 1:2:nargin-1
switch varargin{i}
case 'method'
method = varargin{i+1};
end
end
end
switch method
case "nofill"
area = sum(real(triarea(userdata.surface.triRep))/100);
case "fill"
tr = getClosedSurface(userdata);
area = sum(real(triarea(tr))/100);
end
end