Effacer les filtres
Effacer les filtres

convert 3d image to 2d images

20 vues (au cours des 30 derniers jours)
khaled alsaih
khaled alsaih le 17 Déc 2017
Commenté : Image Analyst le 30 Oct 2018
i have image with size of 1024*512*128 where 128 is the number of slices in the volume how can i get the 2d images and save it into .png and how to get them back thanks for your kind help

Réponse acceptée

Image Analyst
Image Analyst le 17 Déc 2017
Try something like this
[rows, columns, numberOfSlices] = size(image3d);
for slice = 1 : numberOfSlices
thisSlice = image3d(:,:, slice);
baseFileName = sprintf('Slice %d.png', slice);
fullFileName = fullfile(folder, baseFileName);
imwrite(thisSlice, fullFileName);
To get them back, use imread(). To tack onto a 3D image, use cat(3, image3d, thisSlice).
  4 commentaires
M. Siyabend KAYA
M. Siyabend KAYA le 30 Oct 2018
How can we use the Permute command for converting 3D to 2D?
Image Analyst
Image Analyst le 30 Oct 2018
permute() does not do that. It basically just rotates the 3D volume so that rows are now columns, etc.

Connectez-vous pour commenter.

Plus de réponses (0)


En savoir plus sur Image Processing Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by