【发布时间】:2021-03-13 00:57:34
【问题描述】:
我正在使用pydicom 和DICOMWeb client。后者我用来从 DICOM 存储库中获取元数据。
在检索 DICOM 元数据时,我只将 DICOM 标记作为十六进制元组获取。我想知道如何使用 pydicom 查找标签并获得可读的标识符。
例如,如何将标签0x10,0x20 转换为其字符串表示/关键字("PatientID")? (参见DICOM data dictionary 的规格)
【问题讨论】:
我正在使用pydicom 和DICOMWeb client。后者我用来从 DICOM 存储库中获取元数据。
在检索 DICOM 元数据时,我只将 DICOM 标记作为十六进制元组获取。我想知道如何使用 pydicom 查找标签并获得可读的标识符。
例如,如何将标签0x10,0x20 转换为其字符串表示/关键字("PatientID")? (参见DICOM data dictionary 的规格)
【问题讨论】:
pydicom 提供some utility functions 来处理DICOM data dictionary:
import pydicom as dicom
tag = dicom.tag.Tag(0x10,0x20)
# Option 1) Retrieve the keyword:
keyword = dicom.datadict.keyword_for_tag(tag)
# Option 2) Retrieve the complete datadict entry:
entry = dicom.datadict.get_entry(tag)
representation, multiplicity, name, is_retired, keyword = entry
# keyword: "PatientID"
# name: "Patient ID"
【讨论】: