如何在matlab中从nifti图像中逐片写入?

时间:2018-03-12 05:02:19

标签: matlab image-processing

我使用matlab工具箱阅读nifti图像,但我们如何逐片写入另一种格式,如.jpg或png? 我试着这样:

V=niftiread('Brats17_2013_2_1_flair.nii.gz');
imshow(V(:,:,1),[]);
imwrite(V,'test.jpg')
Error using imwrite (line 442)
Cannot write signed integer data to a JPEG file.
imwrite((V(:,:,1),[]),'test.jpg');
imwrite((V(:,:,1),[]),'test.jpg');

↑
Error: Expression or statement is incorrect--possibly unbalanced (, {, or [.

1 个答案:

答案 0 :(得分:0)

只需通过“ saveas”命令保存图片。它正常工作。

h = imshow(V(:,:,1),[]);
saveas (h,'test.jpg');

祝你好运