Draw a 3D array containing only 0,1 into a 3D image

3 ビュー (過去 30 日間)
岚
2022 年 8 月 29 日
回答済み: Abderrahim. B 2022 年 8 月 29 日
I have a 100*100*100 mat file with only 0 and 1 in it. Now I want to draw it as a 3D image, with 0 skeleton and 1 pore. Similar to the picture below. Ask for code! ! ! ! Ask for code! ! ! !

採用された回答

KSSV
KSSV 2022 年 8 月 29 日
[m,n,p] = size(A) ;
[X,Y,Z] = meshgrid(1:m,1:n,1:p) ;
x = X(:) ;
y = Y(:) ;
z = Z(:) ;
v = A(:) ;
idx = v==1 ;
scatter3(x(idx),y(idx),z(idx),[],'b','filled')

その他の回答 (1 件)

Abderrahim. B
Abderrahim. B 2022 年 8 月 29 日
Hi!
You have a volumetric data; I recommend that you use Volume Viewer to visualize it. An example below:
M = randi([0 1], 100,100,100) ;
volumeViewer(M)
Note that volumeViewer requires image processing toolbox.
Hope this helps

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

製品


リリース

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by