本文整理汇总了Python中pydicom.dataset.Dataset.TestTwo方法的典型用法代码示例。如果您正苦于以下问题:Python Dataset.TestTwo方法的具体用法?Python Dataset.TestTwo怎么用?Python Dataset.TestTwo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pydicom.dataset.Dataset
的用法示例。
在下文中一共展示了Dataset.TestTwo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testAddEntry
# 需要导入模块: from pydicom.dataset import Dataset [as 别名]
# 或者: from pydicom.dataset.Dataset import TestTwo [as 别名]
def testAddEntry(self):
"""dicom_dictionary: Can add and use a single dictionary entry"""
add_dict_entry(0x10011001, "UL", "TestOne", "Test One")
add_dict_entry(0x10011002, "DS", "TestTwo", "Test Two", VM='3')
ds = Dataset()
ds.TestOne = 'test'
ds.TestTwo = ['1', '2', '3']
示例2: testAddEntries
# 需要导入模块: from pydicom.dataset import Dataset [as 别名]
# 或者: from pydicom.dataset.Dataset import TestTwo [as 别名]
def testAddEntries(self):
"""dicom_dictionary: add and use a dict of new dictionary entries"""
new_dict_items = {
0x10011001: ('UL', '1', "Test One", '', 'TestOne'),
0x10011002: ('DS', '3', "Test Two", '', 'TestTwo'),
}
add_dict_entries(new_dict_items)
ds = Dataset()
ds.TestOne = 'test'
ds.TestTwo = ['1', '2', '3']
示例3: print
# 需要导入模块: from pydicom.dataset import Dataset [as 别名]
# 或者: from pydicom.dataset.Dataset import TestTwo [as 别名]
from pydicom.datadict import DicomDictionary, keyword_dict
from pydicom.dataset import Dataset
print(__doc__)
# Define items as (VR, VM, description, is_retired flag, keyword)
# Leave is_retired flag blank.
new_dict_items = {
0x10011001: ('UL', '1', "Test One", '', 'TestOne'),
0x10011002: ('OB', '1', "Test Two", '', 'TestTwo'),
0x10011003: ('UI', '1', "Test Three", '', 'TestThree'),
}
# Update the dictionary itself
DicomDictionary.update(new_dict_items)
# Update the reverse mapping from name to tag
new_names_dict = dict([(val[4], tag) for tag, val in
new_dict_items.items()])
keyword_dict.update(new_names_dict)
# Test that it is working
ds = Dataset() # or could get one from dcmread, etc
ds.TestOne = 42
ds.TestTwo = '12345'
ds.TestThree = '1.2.3.4.5'
print(ds.top())