0

我正在尝试从西门子的剂量报告中提取 dicom PixelData,但它只包含零。使用 GE 剂量报告,我可以轻松地使用 pydicom 或 simpleITK 读取数据。为什么西门子报告只包含零的任何想法?

谢谢!

走到这一步,人物却一团糟,我不知道还能做什么。

import dicom 
import numpy as np
import matplotlib.pyplot as plt

f="patient-protocol.dcm"
ds=dicom.read(f)  
overlay_px_data = ds[0x6000, 0x3000].value  
rows = ds[0x6000, 0x0010].value  
cols=ds[0x6000, 0x0011].value

arr=np.fromstring(overlay_px_data, dtype="uint8")  
arr=np.unpackbits(arr)  
arr=np.reshape(arr, (rows, cols))

plt.imshow(arr, cmap="gray")  
plt.show() 

剂量图像

4

1 回答 1

0
i_overlay = 1
n_bits = 8


# On (60xx,3000) are stored ovelays.
# First is (6000,3000), second (6002,3000), third (6004,3000),
# and so on.
dicom_tag1 = 0x6000 + 0*i_overlay

overlay_raw = data[0x6000,0x3000].value

# On (60xx,0010) and (60xx,0011) is stored overlay size
rows = data[0x6000,0x0010].value # rows = 512
cols = data[0x6000,0x0011].value # cols = 512

decoded_linear = np.zeros(len(overlay_raw)*n_bits)

# Decoding data. Each bit is stored as array element
for i in range(1,len(overlay_raw)):
    for k in range (0,n_bits):
        byte_as_int = overlay_raw[i]
        decoded_linear[i*n_bits + k] = (byte_as_int >> k) & 0b1


overlay = np.reshape(decoded_linear,[rows,cols])

plt.imshow(overlay)
plt.show()

暂时找到了解决办法。稍微编辑了一个代码(删除了 ord()),一个 numpy 解码解决方案会更好/更好。

代码源链接

于 2017-09-25T07:38:30.387 回答