[Insight-users] Converting US3 itk image to vtk
Mathieu Stumpf
mathieu.stumpf at etu.unistra.fr
Fri May 4 08:15:23 EDT 2012
Hello,
Using simple itk I was able to open a file and print properties, so I
know my file use unsigned short. By the way, does itk provide some
facilities to check this type ? As you must provide it to itk Image
constructors, this would be really handy to manage arbitrary type.
So, I recompiled the whole itk to wrappe US, but it still doesn't work :
Traceback (most recent call last):
File "/home/miv/stumpf/src/lampyre/Tests/OpeningImage.py", line 36, in <module>
connector = itk.ImageToVTKImageFilter[InputImageType].New()
File "/usr/local/lib/ITK-4.1/Python/itkTemplate.py", line 233, in __getitem__
raise KeyError, 'itkTemplate : No template %s for the %s class' % (str(parameters), self.__name__)
KeyError: "itkTemplate : No template [<class 'itkImagePython.itkImageUS3'>] for the itk::ImageToVTKImageFilter class"
Looks like itk::ImageToVTKImageFilter US3 wrapper isn't generated ! Did I miss some compilation option ?
Here is the code which produce the error :
# system import
import itk
# local import
from tools.Logorrhoea import logorrhoea as log # In short : wrapper for print
file_path = str("/home/miv/stumpf/images/Normal002-DTI")
# file reader
InputImageType = itk.Image.US3
log(dir(InputImageType))
reader = itk.ImageFileReader[InputImageType].New()
reader.SetFileName(file_path)
log(reader)
#
#
## itk->vtk conversion
connector = itk.ImageToVTKImageFilter[InputImageType].New()
More information about the Insight-users
mailing list