Slices 3D object into 2D figures

1 回表示 (過去 30 日間)
Trang Hu Jia
Trang Hu Jia 2022 年 2 月 2 日
回答済み: yanqi liu 2022 年 2 月 7 日
Hello everyone
I'm performing the image-processing with 3D object.
Suppose I have the 3D object as shown below.
The coordinates for each node in X, Y and Z direction corresponding to the faces of 3D object are attached (Coords and faces).
I want to slices this 3D object in to XY plane in 2D image along with Z direction (10 slices) and save in .TIFF file.
Does anyone know how to overcome this problem ?
Any other suggestions are really appreciate.
Thanks for the attendtion.

採用された回答

yanqi liu
yanqi liu 2022 年 2 月 7 日
clc; clear all; close all;
Coord = [ 0 2 0
0 2 1
0 3 0
0 3 1
0 4 0
0 4 1
1 2 0
1 2 1
1 3 0
1 3 1
1 4 0
1 4 1
2 2 0
2 2 1
2 3 0
2 3 1
2 4 0
2 4 1
3 2 0
3 2 1
3 3 0
3 3 1
3 4 0
3 4 1
4 2 0
4 2 1
4 3 0
4 3 1
4 4 0
4 4 1];
faces = [ 1 3 4 2
1 7 8 2
1 7 9 3
2 8 10 4
3 5 6 4
3 9 10 4
3 9 11 5
4 10 12 6
5 11 12 6
7 9 10 8
7 13 14 8
7 13 15 9
8 14 16 10
9 11 12 10
9 15 16 10
9 15 17 11
10 16 18 12
11 17 18 12
13 15 16 14
13 19 20 14
13 19 21 15
14 20 22 16
15 17 18 16
15 21 22 16
15 21 23 17
16 22 24 18
17 23 24 18
19 21 22 20
19 25 26 20
19 25 27 21
20 26 28 22
21 23 24 22
21 27 28 22
21 27 29 23
22 28 30 24
23 29 30 24
25 27 28 26
27 29 30 28];
colors = colormap(jet(size(Coord,1)));
close all;
spc = max(Coord(:,3))-min(Coord(:,3));
for i = 1 : 10
Coordi = Coord;
Coordi(:,3) = Coordi(:,3) / 10 + spc/10*(i-1);
S.Vertices = Coordi;
S.Faces = faces;
S.FaceVertexCData = colors;
S.FaceColor = 'flat';
S.EdgeColor = 'red';
S.LineWidth = 2;
figure
patch(S)
view(3)
xlabel('x');ylabel('y');zlabel('z');
axis([min(Coord(:,1)) max(Coord(:,1)) min(Coord(:,2)) max(Coord(:,2)) min(Coord(:,3)) max(Coord(:,3))]);
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeScalar Volume Data についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by