我又来了,还有另一个关于 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。我不明白这是怎么回事... =(
请您参考如下方法:
