Surface area calculation for irregular shape

22 ビュー (過去 30 日間)
Afsaneh
Afsaneh 2014 年 11 月 12 日
編集済み: Akira Agata 2019 年 7 月 18 日
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
  1 件のコメント
Elina Kapoor
Elina Kapoor 2019 年 7 月 17 日
Any updates?

サインインしてコメントする。

回答 (1 件)

Akira Agata
Akira Agata 2019 年 7 月 18 日
編集済み: Akira Agata 2019 年 7 月 18 日
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

カテゴリ

Help Center および File ExchangeVolume Visualization についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by