本文整理汇总了Python中pydicom.dataset.Dataset.SOPClassUID方法的典型用法代码示例。如果您正苦于以下问题:Python Dataset.SOPClassUID方法的具体用法?Python Dataset.SOPClassUID怎么用?Python Dataset.SOPClassUID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pydicom.dataset.Dataset
的用法示例。
在下文中一共展示了Dataset.SOPClassUID方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_non_fatal_errors
# 需要导入模块: from pydicom.dataset import Dataset [as 别名]
# 或者: from pydicom.dataset.Dataset import SOPClassUID [as 别名]
def test_non_fatal_errors(self):
dataset = Dataset()
dataset.SOPClassUID = '1.2.840.10008.5.1.4.1.1.2' # CT Image Storage
file_dataset = FileDataset('test', dataset, file_meta=self.create_metadata())
write_file('test', file_dataset, write_like_original=False)
error_dict = self.validator.validate('test')
self.assertEqual(1, len(error_dict))
errors = error_dict['test']
self.assertNotIn('fatal', errors)
示例2: _create_temporary_dataset
# 需要导入模块: from pydicom.dataset import Dataset [as 别名]
# 或者: from pydicom.dataset.Dataset import SOPClassUID [as 别名]
def _create_temporary_dataset(shape=(100, 1024, 1024, 3), bit_depth=16):
"""Function to create a temporary dataset for use in testing.
Parameters
----------
shape : 4-tuple
The (frames, rows, columns, channels) of the test dataset.
bit_depth : int
The BitsAllocated value to use for the dataset, one of 8, 16, 32, 64.
Returns
-------
tempfile.TemporaryFile
A created DICOM File Format conformant dataset.
"""
ds = Dataset()
ds.is_little_endian = True
ds.is_implicit_VR = False
ds.file_meta = Dataset()
ds.file_meta.TransferSyntaxUID = ExplicitVRLittleEndian
ds.SOPClassUID = '1.2.3.4'
ds.SOPInstanceUID = generate_uid()
ds.BitsAllocated = bit_depth
ds.PixelRepresentation = 0
ds.PlanarConfiguration = 0
ds.Rows = shape[1]
ds.Columns = shape[2]
ds.NumberOfFrames = shape[0]
ds.SamplesPerPixel = shape[3]
if shape[3] == 1:
ds.PhotometricInterpretation = 'MONOCHROME2'
elif shape[3] == 3:
ds.PhotometricInterpretation = 'RGB'
arr = np.zeros(shape, dtype='uint{}'.format(bit_depth))
ds.PixelData = arr.tobytes()
if len(ds.PixelData) % 2:
ds.PixelData += b'\x00'
tfile = TemporaryFile(mode='w+b')
ds.save_as(tfile, write_like_original=False)
tfile.seek(0)
return tfile
示例3: test_unknown_sop_class
# 需要导入模块: from pydicom.dataset import Dataset [as 别名]
# 或者: from pydicom.dataset.Dataset import SOPClassUID [as 别名]
def test_unknown_sop_class(self):
dataset = Dataset()
dataset.SOPClassUID = 'Unknown'
file_dataset = FileDataset('test', dataset, file_meta=self.create_metadata())
write_file('test', file_dataset, write_like_original=False)
self.assert_fatal_error('test', 'Unknown SOPClassUID (probably retired): Unknown')