Surface area calculation for irregular shape

20 visualizaciones (últimos 30 días)
Afsaneh
Afsaneh el 12 de Nov. de 2014
Editada: Akira Agata el 18 de Jul. de 2019
Hi guys. I work on 3d medical images and I extracted specious area from each slice. After 2D segmentation 3d reconstruction is done to create suspected areas. I need to calculate surface area of segmented image(3D)? If any body has any Idea, please help me.
Best regards Afsaneh

Respuestas (1)

Akira Agata
Akira Agata el 18 de Jul. de 2019
Editada: Akira Agata el 18 de Jul. de 2019
How about the following?
%% Example in the following page
% https://jp.mathworks.com/help/matlab/visualize/visualizing-volume-data.html
load mri D % load data
D = squeeze(D); % remove singleton dimension
limits = [NaN NaN NaN NaN NaN 10];
[x, y, z, D] = subvolume(D, limits); % extract a subset of the volume data
[fo,vo] = isosurface(x,y,z,D,5); % isosurface for the outside of the volume
[fe,ve,ce] = isocaps(x,y,z,D,5); % isocaps for the end caps of the volume
figure
p1 = patch('Faces', fo, 'Vertices', vo); % draw the outside of the volume
p1.FaceColor = 'red';
p1.EdgeColor = 'none';
p2 = patch('Faces', fe, 'Vertices', ve, ... % draw the end caps of the volume
'FaceVertexCData', ce);
p2.FaceColor = 'interp';
p2.EdgeColor = 'none';
view(-40,24)
daspect([1 1 0.3]) % set the axes aspect ratio
colormap(gray(100))
box on
camlight(40,40) % create two lights
camlight(-20,-10)
lighting gouraud
%% Calculate are of the red surface
% Extract vertices and faces of the patch object
verts = p1.Vertices;
faces = p1.Faces;
% Calculate area of each triangle, and sum them
a = verts(faces(:, 2), :) - verts(faces(:, 1), :);
b = verts(faces(:, 3), :) - verts(faces(:, 1), :);
c = cross(a, b, 2);
area = 1/2 * sum(sqrt(sum(c.^2, 2)));
% Display the result
fprintf('\nThe surface area is %f\n\n', area);
>>
The surface area is 7560.636129

Categorías

Más información sobre Volume Visualization en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by