本文整理汇总了Python中pydicom.dataset.Dataset.SmallestValidPixelValue方法的典型用法代码示例。如果您正苦于以下问题:Python Dataset.SmallestValidPixelValue方法的具体用法?Python Dataset.SmallestValidPixelValue怎么用?Python Dataset.SmallestValidPixelValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pydicom.dataset.Dataset
的用法示例。
在下文中一共展示了Dataset.SmallestValidPixelValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_pixel_representation_vm_one
# 需要导入模块: from pydicom.dataset import Dataset [as 别名]
# 或者: from pydicom.dataset.Dataset import SmallestValidPixelValue [as 别名]
def test_pixel_representation_vm_one(self):
"""Test correcting VM 1 elements which require PixelRepresentation."""
ref_ds = Dataset()
# If PixelRepresentation is 0 then VR should be US
ref_ds.PixelRepresentation = 0
ref_ds.SmallestValidPixelValue = b'\x00\x01' # Little endian 256
ds = correct_ambiguous_vr(deepcopy(ref_ds), True)
self.assertEqual(ds.SmallestValidPixelValue, 256)
self.assertEqual(ds[0x00280104].VR, 'US')
# If PixelRepresentation is 1 then VR should be SS
ref_ds.PixelRepresentation = 1
ref_ds.SmallestValidPixelValue = b'\x00\x01' # Big endian 1
ds = correct_ambiguous_vr(deepcopy(ref_ds), False)
self.assertEqual(ds.SmallestValidPixelValue, 1)
self.assertEqual(ds[0x00280104].VR, 'SS')
# If no PixelRepresentation then should be unchanged
ref_ds = Dataset()
ref_ds.SmallestValidPixelValue = b'\x00\x01' # Big endian 1
ds = correct_ambiguous_vr(deepcopy(ref_ds), True)
self.assertEqual(ds.SmallestValidPixelValue, b'\x00\x01')
self.assertEqual(ds[0x00280104].VR, 'US or SS')
示例2: test_write_explicit_vr_big_endian
# 需要导入模块: from pydicom.dataset import Dataset [as 别名]
# 或者: from pydicom.dataset.Dataset import SmallestValidPixelValue [as 别名]
def test_write_explicit_vr_big_endian(self):
"""Test writing explicit big data for ambiguous elements."""
# Create a dataset containing element with ambiguous VRs
ref_ds = Dataset()
ref_ds.PixelRepresentation = 1
ref_ds.SmallestValidPixelValue = b'\x00\x01' # Big endian 1
fp = BytesIO()
file_ds = FileDataset(fp, ref_ds)
file_ds.is_implicit_VR = False
file_ds.is_little_endian = False
file_ds.save_as(fp)
fp.seek(0)
ds = read_dataset(fp, False, False)
self.assertEqual(ds.SmallestValidPixelValue, 1)
self.assertEqual(ds[0x00280104].VR, 'SS')