[vtkusers] How to get an image into python-land :)

Robert Stein rjstein at iu.edu
Wed Aug 6 17:02:48 EDT 2003


Hey,

    I'm currently using python-wrapped vtk in a project I'm working on and
would like to be able to get an image out of vtk and into python's world
(say with vtkJPEGWriter->WriteToMemoryOn())
    In the auto-generated python wrappers for
vtkUnsignedCharDataArrayPython.cxx  I can find the method call for
GetVoidPointer... which returns a SWIG style mangled void pointer...
    I'm assuming that I could instead return something like a
PyString_FromStringAndLength(blah, blah) and get this to work in python...
my problem / question is that in the python c-api code... it looks like this
actually allocates a "new" python string of this size...  I'd rather not
make an extra copy of my data...
    Do any of you vtk python guru's out there know if there's a way to stuff
the void* and length of a data array into this internal python structure?
    I realize this is a pretty involved question... but I hope some one can
answer ;)

Thanks,

Rob


Robert Stein
Senior Technical Lead
Indiana Pervasive Technology Labs
rjstein at iu.edu   -   (317) 278-8154




More information about the vtkusers mailing list