我正在尝试通过 itk 读取一个 nrrd 文件并通过 vtk 显示它。但是我在将itk转换为vtk时遇到了一些麻烦。
import itk
file_name = '/home/yao/workspace/test/1.nrrd'
image_type = itk.Image[itk.UC, 2]
reader = itk.ImageFileReader[image_type].New()
reader.SetFileName( file_name )
reader.Update()
itk_vtk_converter = itk.ImageToVTKImageFilter[image_type].New()
itk_vtk_converter.SetInput(reader.GetOutput())
itk_vtk_converter.Update()
我收到了消息
Traceback (most recent call last): File "ex1.py", line 11, in <module>
itk_vtk_converter = itk.ImageToVTKImageFilter[image_type].New() File "/usr/lib/InsightToolkit/WrapITK/Python/itkLazy.py", line 14, in
__getattribute__
value = types.ModuleType.__getattribute__(self, attr) AttributeError: 'LazyITKModule' object has no attribute 'ImageToVTKImageFilter'
我正在使用itk3.20,python2.7。我该如何解决?
问候。
姚