[vtkusers] InfoVis: geovis.py example problem?

Eric E. Monson emonson at cs.duke.edu
Mon Nov 17 16:42:47 EST 2008


Hey,

I was trying the Examples/Infovis/Python/geovis.py example (CVS  
today), and I couldn't get it to work, as is.

   File "geoview.py", line 23, in <module>
     view.AddDefaultImageRepresentation(data_dir + "NE2_ps_bath.jpg")
ValueError: method requires a VTK object

That methods seems to require a vtkImageData argument. Should this:

# Create the background image
view.AddDefaultImageRepresentation(data_dir + "NE2_ps_bath.jpg")

be changed to something like this?:

# Create the background image
image = vtkImageData()
jpg = vtkJPEGReader()
jpg.SetFileName(data_dir + "NE2_ps_bath.jpg")
jpg.Update()
image.ShallowCopy(jpg.GetOutputDataObject(0))
view.AddDefaultImageRepresentation(image)

Or, maybe there's an easier way (I'm not sure about that ShallowCopy()  
part)?

Thanks,
-Eric





More information about the vtkusers mailing list