【问题标题】:DICOM slicing orders in pythonpython中的DICOM切片订单
【发布时间】:2020-04-01 20:56:58
【问题描述】:

我有一个关于切片排序的问题:

我有大约 80 张髋关节的照片,但没有从脚到头或从头到脚排列。

有什么方法可以按预期的顺序排列它们吗?

# pixel aspects, assuming all slices are the same
ps = slices[0].PixelSpacing
ss = slices[0].SliceThickness


ax_aspect = ps[1]/ps[0]
sag_aspect = ps[1]/ss
cor_aspect = ss/ps[0]

# create 3D array
img_shape = list(slices[0].pixel_array.shape)
img_shape.append(len(ct_images))
print(img_shape)

img3d = np.zeros(img_shape)

# fill 3D array with the images from the files
for i, s in enumerate(slices):
    img2d = s.pixel_array
    img3d[:, :, i] = img2d

# plot 3 orthogonal slices
a1 = plt.subplot(2,2,1)
plt.imshow(img3d[:,:,img_shape[2]//2])
a1.set_aspect(ax_aspect)

a2 = plt.subplot(2,2,3)
plt.imshow(img3d[:,img_shape[1]//2,:])
a2.set_aspect(sag_aspect)

a3 = plt.subplot(2,2,2)
plt.imshow(img3d[img_shape[0]//2,:,:].T)
a3.set_aspect(cor_aspect)


plt.show()

SOP 类 UID 是 CT 图像存储。

这是代码,这些是结果图片。

【问题讨论】:

    标签: python matplotlib slice dicom pydicom


    【解决方案1】:

    slices = sorted(slices, key=lambda x: x.ImagePositionPatient[2]) 可能是您想要的,这取决于您的 SOP 类 UID 是什么。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-02
      • 1970-01-01
      • 2021-11-26
      相关资源
      最近更新 更多