嗨,我正在使用 pydicom 读取 DICOM 文件
这篇文章不同于 pydicom 'Dataset' 对象没有属性 'TransferSyntaxUID'
这是我的代码
import dicom
dicom.read_file(file,force=True)
这会导致错误
AttributeError Traceback (most recent call last)
<ipython-input-32-a32aef2d2178> in <module>()
----> 1 dicom.read_file(raw_path + pat_lst[0] + '\\' + pat_dcm_lst[0],force=True)
D:\Program Files\Anaconda2\lib\site-packages\dicom\filereader.pyc in read_file(fp, defer_size, stop_before_pixels, force)
612 try:
613 dataset = read_partial(fp, stop_when, defer_size=defer_size,
--> 614 force=force)
615 finally:
616 if not caller_owns_file:
D:\Program Files\Anaconda2\lib\site-packages\dicom\filereader.pyc in read_partial(fileobj, stop_when, defer_size, force)
520 if preamble:
521 file_meta_dataset = _read_file_meta_info(fileobj)
--> 522 transfer_syntax = file_meta_dataset.TransferSyntaxUID
523 if transfer_syntax == dicom.UID.ImplicitVRLittleEndian:
524 pass
D:\Program Files\Anaconda2\lib\site-packages\dicom\dataset.pyc in __getattr__(self, name)
254 if tag not in self:
255 raise AttributeError("Dataset does not have attribute "
--> 256 "'{0:s}'.".format(name))
257 else: # do have that dicom data_element
258 return self[tag].value
AttributeError: Dataset does not have attribute 'TransferSyntaxUID'.
我认为匿名时出了点问题。我想知道为什么会这样。
是否删除与 DICOM 标准相关的 TransferSyntaxUID?
而且,我可以通读MATLAB
, VTK
,ITK
但是pydicom
所以现在我要做的是通过手动设置 TransferSyntaxUIDSimpleITK
并再次通过pydicom
.
我会告诉你什么时候这有效
提前致谢