问题描述
我正在使用 pydicom 处理 Dicom 图像。
但是我的项目在 fasai
中,我想使用 fastai 库打开那个 Dicom 图像。
在 fastai
中,我们通常对 png
或 jpg
执行 open_image(path) 它的工作正常,但是如果我们有 Dicom 图像,我们无法轻松打开它。所以我使用 pydicom,他们得到他们的像素数组,然后转换为 RGB and resized. But when I again apply to open that NumPy array which I made it can't open it because open_image needs
path` 而不是一个 numpy 图像。
我有一个问题,如何像打开简单的 png 图像一样打开 Dicom 图像。
我们像在 fastai 中一样打开普通图像:
im = open_image(img_path)
img.show(figsize=(4,4),ax=axs[0])
它给了我们 (3,H,W)
的形状但在 Dicom 的图像中,打开它并不容易。我需要像以前一样打开它。我尝试了下面的代码来使用 pydicom 库获取图像。
if (extension == 'dicom'):
xray = read_xray(img_path)
img = resize(xray)
img = to_rgb(img)
img = normalize(img)
img = torch.from_numpy(img)
img = np.transpose(img,[2,1])
请帮助摆脱这个问题。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)