How to write each slices from volume in MATLAB into jpg format?

3 visualizzazioni (ultimi 30 giorni)
Hello dear may you please help for solving a problem: I have 3D Volume dataset in .niit format I read this data in MATLAB and also can show each slice from this volume....but I'm unable to write each slice in jpg /2D form How we can write each slice from volume by using imwrite in MATLAB?

Risposta accettata

Image Analyst
Image Analyst il 24 Mar 2018
Modificato: Image Analyst il 22 Giu 2020
You probably don't want to do that anyway, unless you use lossless jpeg2000 format. Use PNG for lossless compression
for sliceIndex = 1 : size(image3d, 3)
thisSlice = image3d(:,:,sliceIndex);
filename = sprintf('Slice #%d.png', sliceIndex);
imwrite(thisSlice, filename);
end
image3d is your 3-D image array.
  5 Commenti
Meriem YOUss
Meriem YOUss il 10 Giu 2021
how to do the same code with a set of images with a loop, and save only the first slice of each image?

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Image Processing Toolbox in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by