[vtkusers] How to convert vtkImageCast back to vtkImageData
Quentan Qi
quentan at gmail.com
Sat Jun 13 08:36:19 EDT 2015
Hi there,
After casting an image using vtkImageCast, it becomes a vtkImageCast object, but I want to use vtkImplicitVolume which requires vtkImageData type. How to convert vtkImageCast back to vtkImageData?
```Python
reader = read_DICOM(path_dicom) # result is a vtkImageData
cast = vtk.vtkImageCast()
cast.SetInputData(reader) # vtkImageData —> vtkImageCast
cast.SetOutputScalarTypeToShort() # I need this type
implicit_volume = vtk.vtkImplicitVolume()
implicit_volume.SetVolume(reader) # It works but I need “cast” instead
# implicit_volume.SetVolume(cast) # It’s wrong because vtkImageData is required, but a vtkImageCast was given
# other things
```
Thanks a lot!
Cheers,
Quentan
More information about the vtkusers
mailing list