def __init__(self, dataset):
if isinstance(dataset, Dataset):
self.ds = dataset
elif isinstance(dataset, (string_types, BytesIO)):
try:
self.ds = \
read_file(dataset, defer_size=100, force=True)
except:
# Raise the error for the calling method to handle
raise
else:
# Sometimes DICOM files may not have headers,
# but they should always have a SOPClassUID
# to declare what type of file it is.
# If the file doesn't have a SOPClassUID,
# then it probably isn't DICOM.
if not "SOPClassUID" in self.ds:
raise AttributeError
else:
raise AttributeError
######################## SOP Class and Instance Methods #######################
评论列表
文章目录