Matlab将DCM转换为BMP
如何将Matlab将DCM转换为BMP,matlab,image-processing,Matlab,Image Processing,如何将.dcm(dicom)图像转换为.bmp格式 我已经试过了,但它对我不起作用 000000.dcm是一张医学肺部图像(大小为6MB) DCM图像读入dcmimg imwrite(dcmimg, 'myfile.bmp'); 获取错误: Error using writebmp (line 15) Expected X to be one of these types: logical, uint8, single, double Instead its type was uint
.dcm
(dicom)图像转换为.bmp
格式
我已经试过了,但它对我不起作用
000000.dcm
是一张医学肺部图像(大小为6MB)
DCM图像读入dcmimg
imwrite(dcmimg, 'myfile.bmp');
获取错误:
Error using writebmp (line 15)
Expected X to be one of these types:
logical, uint8, single, double
Instead its type was uint16.
Error in imwrite (line 477)
feval(fmt_s.write, data, map, filename, paramPairs{:});
我不理解这些错误,出了什么问题。帮帮我,谢谢 Dicom使用无符号16位整数。如错误消息所述,写入.bmp文件的函数需要不同的数据类型。这表明,应采取以下措施:
imwrite(double(dcmimg), 'myFile.bmp');
通过显式地将数据类型转换为
double
,您应该消除错误。实际上,一个
就足够了。。。它也可以在不损失精度的情况下表示16位整数。thank@Floris它工作了,但在阅读时给了我一张空白的图像。虽然它有大小。空白图像,嗯?在使用imscale(double(dcmimg))
保存到文件之前,是否可以尝试显示图像?可能存在缩放问题。。
imwrite(double(dcmimg), 'myFile.bmp');