Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Python中使用SimpleTk读取mhd文件时出错_Python_Image Processing_Computer Vision_Itk_Simpleitk - Fatal编程技术网

在Python中使用SimpleTk读取mhd文件时出错

在Python中使用SimpleTk读取mhd文件时出错,python,image-processing,computer-vision,itk,simpleitk,Python,Image Processing,Computer Vision,Itk,Simpleitk,我在这里再次提出另一个关于python中SimpleTk的问题。我想画一个.mhd图像,但我不知道怎么画。我正在尝试下面描述的函数: 但它并不是在阅读图像: RuntimeError: Exception thrown in SimpleITK ReadImage: /tmp/SimpleITK-build/ITK/Modules/IO/Meta/src/itkMetaImageIO.cxx:483: itk::ERROR: MetaImageIO(0x3a83730): File cannot

我在这里再次提出另一个关于python中SimpleTk的问题。我想画一个.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 image

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.
从medpy.io导入加载
image_data,image_header=load('/home/bianca/Documents/PythonProcessing/result Edep.mhd'))
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
image_data,image_header=load('/home/bianca/Documents/PythonProcessing/result Edep.mhd'))
文件“medpy/io/load.py”,第201行,加载
提出错误
DependencyError:加载Itk/Vtk MetaImage(.mhd、.mha/.raw)类型的图像需要无法遇到的第三方模块。原因:没有名为itk的模块。

但我现在有SimpletK。我不明白发生了什么=(

您试图读取的文件是否有效?您可以使用其他图像显示工具检查是否有效,例如,或者。如果这些工具中的任何一个都可以打开它,请告诉我们您正在使用的SimpleTk的版本。

MHD文件通常需要一个MHD头和一个包含图像数据的原始文件-您是否在同一目录w中如果mhd头指向数据?

mhd文件通常需要一个mhd头和一个包含图像数据的原始文件-这两个文件是否与指向数据的mhd头位于同一目录中?Dzenan,感谢您的回答!现在,由于g.stevo线索,它正在读取文件(缺少原始文件).然而,现在我不知道如何显示图像…(我相信你可以猜到我只是一个初学者=/)你看到了吗:如果上面的笔记本不能帮助你搜索“SimpleTk Python教程”并遵循一些东西。@g.stevo你的评论应该是一个答案,因为这是我在我的案例中错过的。祝你一切顺利!
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.