我在这里再次提到有关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。我不明白发生了什么...... =(