我正在尝试在opencv-python中显示DICOM图像。我正在使用pydicom库,并添加API来创建一个完整的DICOM查看器,其中包含DOTNET,可以运行python(当然是使用进程实例调用python)!无法转换或查看未压缩的DICOM图像。每当我尝试加载或修改pixel_array时,都会出现错误消息。
import dicom
import cv2
import numpy
df=dicom.read_file("IM-0001-0002.dcm")
df.pixel_array
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
df.pixel_array
File "C:\Python27\lib\site-packages\dicom\dataset.py", line 394, in pixel_array
return self._get_pixel_array()
File "C:\Python27\lib\site-packages\dicom\dataset.py", line 376, in _get_pixel_array
raise NotImplementedError("Pixel Data is compressed in a format pydicom does not yet handle. Cannot return array")
NotImplementedError: Pixel Data is compressed in a format pydicom does not yet handle. Cannot return array
请建议我将图像转换为能够显示图像的cv2.imshow()函数的良好方法。
谢谢您提前的帮助!