[vtkusers] New feature: vtkImageDataToTkPhoto

Blezek, Daniel J (Research) blezek at crd.ge.com
Fri Aug 30 16:11:13 EDT 2002


Hi all,

  I won't go into the rational behind this feature, rather I'll just expalain.

  I've added new Tcl and Python(Tk) commands into VTK.  The command is called vtkImageDataToTkPhoto.

Usage: vtkImageDataToTkPhoto image photo z
image - in Tcl image is a vtkImageData, in Python it is the address string image.__this__[:-2]
photo - the name of the photo widget returned from [image create photo] or Tkinter.PhotoImage()
z - the z slice to take from the image data

The command only handles 1,3, & 4 component unsigned char vtkImageData types.

For python, I added a class called vtkTkPhotoImage as a wrapper class around this command.  Since the
Python code took a bit more "hack"ing, you can use vktTkPhotoImage wherever you need a
Tkinter.PhotoImage.  vtkTkPhotoImage has a new method PutImageData that takes a vtkImageData and a z
slice, effectively hiding the call to vtkImageDataToTkPhoto.

Please let me know if you have questions or comments,
-dan

--
Daniel Blezek, Ph.D.
blezek at crd.ge.com
Visualization and Computer Vision Lab, Imaging Technologies
GE Global Research Center



More information about the vtkusers mailing list