在python中读取没有标题的.img医学图像

在python中读取没有标题的.img医学图像,第1张

在python中读取没有标题的.img医学图像

通过下载JSRT数据库,我找到了一些像您一样的射线照相图像。我已经在此数据库的第一个映像上测试了以下代码:JPCLN001.IMG。

import matplotlib.pyplot as pltimport numpy as np# Parameters.input_filename = "JPCLN001.IMG"shape = (2048, 2048) # matrix sizedtype = np.dtype('>u2') # big-endian unsigned integer (16bit)output_filename = "JPCLN001.PNG"# Reading.fid = open(input_filename, 'rb')data = np.fromfile(fid, dtype)image = data.reshape(shape)# Display.plt.imshow(image, cmap = "gray")plt.savefig(output_filename)plt.show()

它产生一个输出文件JPCLN001.PNG,如下所示:

我希望我已经回答了你的问题。祝您编码愉快!



欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/4914635.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-11-12
下一篇 2022-11-12

发表评论

登录后才能评论

评论列表(0条)

保存