from medpy.io import load
import SimpleITK
import vtk
image_data, image_header = load('/Users/N01-T2.mha')
print image_data.shape
And the error is:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/wuzhenglin/anaconda/lib/python2.7/site-packages/spyder/utils/site/sitecustomize.py", line 880, in runfile
execfile(filename, namespace)
File "/Users/wuzhenglin/anaconda/lib/python2.7/site-packages/spyder/utils/site/sitecustomize.py", line 94, in execfile
builtins.execfile(filename, *where)
File "/Users/wuzhenglin/Python_nice/SAL_LUNG/test.py", line 140, in <module>
changeage()
File "/Users/wuzhenglin/Python_nice/SAL_LUNG/test.py", line 42, in changeage
image_data, image_header = load('/Users/wuzhenglin/Python_nice/SAL_BRAIN/brain_healthy_dataset/Normal001-T2.mha')
File "/Users/wuzhenglin/anaconda/lib/python2.7/site-packages/medpy/io/load.py", line 201, in load
raise err
medpy.core.exceptions.ImageLoadingError: Failes to load image /Users/wuzhenglin/Python_nice/SAL_BRAIN/brain_healthy_dataset/Normal001-T2.mha as
Itk/Vtk MetaImage (.mhd, .mha/.raw). Reason signaled by third-party module:
'LazyITKModule' object has no attribute 'AnalyzeImageIO'
I want to deal with .mha image, but it doesn't work. I have installed medpy, itk and vtk.
I have searched on Google, but there is not related answer to this problem.
Does the same error occur without the
import SimpleITK
line? I don't think that is relevant to producing this error.ITK for Python and
SimpleITK
are two separate Python packages which provide different interfaces to ITK. The error you are seeing is lated to ITK for Python, or theitk
package on PyPi. Where did youitk
install come from. Can you run a simple program like this, with your install?