how to convert itk image file to vtk with python? -
i'm trying read nrrd file itk , show vtk. have trouble on convert 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() and got message
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' i'm using itk3.20, python2.7. how can fix it?
regards.
yao
c++ filter itk::imagetovtkimagefilter not wrapped can use itk.vtkimageimport instead.you can see @ http://www.vtk.org/wiki/vtk/examples/python/vtkwithnumpy vtkimageimport in action. can use itkpybuffer transform itkimage in numpy array
Comments
Post a Comment