Issue with dispaly of 3D images created from multiple 2D slices
古いコメントを表示
Hi,
I have multiple 2D grayscale image slices (all of them are of same dimensions). I need to stack them to dispaly 3D image. I tried cat function and then implay. But this just plays video, I am not able to see 3D image.
I came across many threads relevant to this. But I am not sure which one will serve the purpose.
I have attached few 2D grayscale slices here. Could someone please suggest the possible method to get 3D reconstruction from these images?
採用された回答
その他の回答 (1 件)
Mathieu NOE
2025 年 1 月 22 日
For a 3D rendering (like MRI) I suggest you try this : vol3d v2 - File Exchange - MATLAB Central
%% create a 3D rendering
out = [];
for k=1:5
img = rgb2gray(imread(['0' num2str(k) '.png']));
out = cat(3,out,img);
end
h = vol3d('cdata',out,'texture','3D');
view(3);
axis tight; daspect([1 1 .4])
alphamap('rampup');
alphamap(.06 .* alphamap);
5 件のコメント
Mathieu NOE
2025 年 1 月 22 日
if you just want to stack figures , you can do this

%% create stacked images (I am simply repeating the same image 5 times)
% plot each slice as a texture-mapped surface (stacked along the Z-dimension)
figure
hold on
for k=1:5
img = imread(['0' num2str(k) '.png']);
[X,Y] = meshgrid(1:size(img,2), 1:size(img,1));
Z = ones(size(img,1),size(img,2));
surface('XData',X-0.5, 'YData',Y-0.5, 'ZData',Z.*k, ...
'CData',img, 'CDataMapping','direct', ...
'EdgeColor','none', 'FaceColor','texturemap')
end
view(3), box on, axis tight square
set(gca, 'YDir','reverse', 'ZLim',[1 k])
hold off
MechenG
2025 年 1 月 23 日
MechenG
2025 年 1 月 23 日
MechenG
2025 年 1 月 23 日
カテゴリ
ヘルプ センター および File Exchange で Lighting, Transparency, and Shading についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
