[vtkusers] Passing data between VTK and NumPy.

Prabhu Ramachandran prabhu at aero.iitm.ernet.in
Wed Sep 18 01:56:23 EDT 2002


>>>>> "MvdR" == Maurice van de Rijzen <maurice at akst.tn.tudelft.nl> writes:

    MvdR> using NumPy(A fast Numerical Extension of python).  The
    MvdR> problem is that I don't know how to get the data from the
    MvdR> SetExecuteMethod into NumPy.  Afaik know NumPy can read from
    MvdR> strings and files.

    MvdR> Do I need to convert the data into a string?  Is there a way
    MvdR> to 'say' to NumPy where in memory the 5D-dataset starts?
    MvdR> Does someone has experience in using NumPy in combination
    MvdR> with VTK?

Well, it really depends on how you want to do it.  Are you doing it
from the Python side of things or from C/C++?  If its C you need to
just look at the NumPy C API to figure out what you have to do.  NumPy
arrays has an array of char* with an array of ints (strides)
describing the strides along each dimension of the (multidimensional)
array.  The NumPy docs has all the necessary information.

prabhu



More information about the vtkusers mailing list