Converting 3D matrix to multiple images

Assume i have a 3D matrix with dimesions 32x32x500.
How can i convert this matrix into 500 tif images with dimensions 32x32?

 采纳的回答

DGM
DGM 2021-3-23
编辑:DGM 2021-3-23
I'm sure somebody has volumetric import/export tools to do this, but this is a basic approach:
numpages=size(inpict,3);
for p=1:numpages
imwrite(inpict(:,:,p),sprintf('image_slice_%03d.tiff',p))
end
This will give each filename a zero-padded number. Consider adding a destination directory to the specified path, otherwise everything is dumped into the current working directory.

更多回答(0 个)

类别

在 帮助中心 和 File Exchange 中查找有关 Convert Image Type 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by