PyDICOM 无法读取像素数据,需要 GDCM 或 Pillow

Sha*_*oon 4 python python-imaging-library gdcm pydicom

我正在使用pydicom,我的代码非常简单:

image = np.stack([s.pixel_array for s in scans])
Run Code Online (Sandbox Code Playgroud)

但这会产生运行时错误:

RuntimeError: The following handlers are available to decode the pixel data however they are missing required dependencies: GDCM (req. GDCM), Pillow (req. Pillow)
Run Code Online (Sandbox Code Playgroud)

我不知道该怎么做。任何帮助都会有帮助。

g_u*_*int 6

如果 GDCM 给您带来问题,请试一试 Pillow。
python -m pip install pillow
确保安装在正确的环境中。