将 DICOM 标签转换成更易读的东西
Convert DICOM tag into something more readable
我正在与 pydicom and a DICOMWeb client 合作。后者我用来从 DICOM 存储库中获取元数据。
检索 DICOM 元数据时,我只得到 DICOM 标签作为十六进制元组。我想知道如何使用 pydicom 查找标签并获得可读标识符。
例如,如何将标签0x10,0x20
转换成它的字符串representation/keyword("PatientID"
)? (参见 DICOM data dictionary 的规格)
pydicom 提供 some utility functions to handle the 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"
我正在与 pydicom and a DICOMWeb client 合作。后者我用来从 DICOM 存储库中获取元数据。
检索 DICOM 元数据时,我只得到 DICOM 标签作为十六进制元组。我想知道如何使用 pydicom 查找标签并获得可读标识符。
例如,如何将标签0x10,0x20
转换成它的字符串representation/keyword("PatientID"
)? (参见 DICOM data dictionary 的规格)
pydicom 提供 some utility functions to handle the 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"