>>>>> "Andrea" == Andrea Gavana <[EMAIL PROTECTED]> writes:
Andrea> Hi Prabhu, I have stumped into another problem... in one
Andrea> of my functions, I call:
Andrea> cells = array2vtkCellArray(ids)
Andrea> This, in turn, calls the method set_id_type_array, which
Andrea> obviously doesn't exist anywhere except in a pyrex (?)
Andrea> compiled extension for tvtk. I am not a C/C++ guru, and it
Andrea> is not very clear to me what this function does. Is this
IIRC, this basically takes a connectivity list specified as numpy
arrays and reformats it to something VTK can readily use. Here is the
docstring which is more descriptive:
"""Given a 2D Int array (`id_array`), and a contiguous 1D numarray
array (`out_array`) having the correct size, this function sets
the data from `id_array` into `out_array` so that it can be used
in place of a `vtkIdTypeArray` in order to set the cells of a
`vtkCellArray`.
Note that if `shape = id_array.shape` then `size(out_array) ==
shape[0]*(shape[1] + 1)` should be true. If not you'll get an
`AssertionError`.
`id_array` need not be contiguous but `out_array` must be.
"""
This approach is also documented here:
https://svn.enthought.com/enthought/wiki/TVTKIntroduction#array-handling
The section on CellArrays clarifies what is going on.
The pyrex code is fairly straight forward to build and re-use. Can't
you just copy out the pyrex file (or even the generated C code) and
use that? It just defines a couple of functions, builds on all
platforms and provides you exactly what you need.
Andrea> really the only way to deal with numpy+VTK? I know tvtk is
Andrea> tested on it and can do everything, but what I basically
Andrea> only need is array_handler module methods, nothing more.
I'd say get the pyrex generated sources array_ext_sp.c, build and use
that extension.
Andrea> I'll try to download tvtk, but that would fairly slow my
Andrea> development pace, as I don't know almost anything about it
Andrea> :-(
Well, if you build VTK, you can't complain about building TVTK. ;-)
Its only dependencies (to build) are, traits (easily built) and VTK.
Follow these instructions:
1. Get the enthought source tree from SVN.
svn co https://svn.enthought.com/svn/enthought/trunk enthought
2. cd enthought/src/lib/enthought/traits
python setup.py build_ext --inplace
3. cd ../tvtk
python setup.py build_ext --inplace
4. export PYTHONPATH=$PYTHONPATH:path/to/enthought/src/lib
5. If this command:
python -c "from enthought.tvtk.api import tvtk"
works, you are all set. In fact you can also try out mayavi2 if
you have gotten this far.
cd ../mayavi/examples
./streamline.py
cheers,
prabhu
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
MayaVi-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mayavi-users