我又在这里提出了另一个关于 python 中 SimpleITK 的问题。我想绘制一个 .mhd 图像,但我不知道如何。我正在尝试这里描述的函数Reading *.mhd/*.raw format in python:
load_itk('/home/bianca/Documents/PythonProcessing/result-Edep.mhd')
但它没有读取图像:
RuntimeError: Exception thrown in SimpleITK ReadImage: /tmp/SimpleITK-build/ITK/Modules/IO/Meta/src/itkMetaImageIO.cxx:483:
itk::ERROR: MetaImageIO(0x3a83730): File cannot be read: /home/bianca/Documents/PythonProcessing/result-Edep.mhd for reading.
Reason: Success
我也尝试过使用 scikit 图像...
img = io.imread('/home/bianca/Documents/PythonProcessing/result-Edep.mhd', plugin='simpleitk')
但我也收到一条错误消息
RuntimeError: Exception thrown in SimpleITK ReadImage: /tmp/SimpleITK-build/ITK/Modules/IO/Meta/src/itkMetaImageIO.cxx:483:
itk::ERROR: MetaImageIO(0x3a84280): File cannot be read: /home/bianca/Documents/PythonProcessing/result-Edep.mhd for reading.
Reason: Success
即使使用 medpy
from medpy.io import load
image_data, image_header = load('/home/bianca/Documents/PythonProcessing/result-Edep.mhd')
Traceback (most recent call last):
File "<pyshell#17>", line 1, in <module>
image_data, image_header = load('/home/bianca/Documents/PythonProcessing/result-Edep.mhd')
File "medpy/io/load.py", line 201, in load
raise err
DependencyError: Loading images of type Itk/Vtk MetaImage (.mhd, .mha/.raw) requires a third-party module that could not be encountered. Reason: No module named itk.
但我现在确实有 SimpleITK。我不明白发生了什么... =(