[vtk-developers] GSOC Project Questions

David Gobbi david.gobbi at gmail.com
Thu Mar 12 17:04:45 EDT 2015


On Thu, Mar 12, 2015 at 2:13 PM, Ben Boeckel <ben.boeckel at kitware.com>
wrote:
>
>
> > I have experience doing Lua wrapping for other open source projects, so
> I'm
> > especially confident I could do the former project.
>
> There is wrapping infrastructure in Wrapping/Tools which does all the
> parsing and data extraction already. What would need to be done is to
> take those structures and turn them into Lua code to call the right
> functions, do type conversions, etc. Extending the wrapping
> infrastructure to expose any information Lua needs would be in scope as
> well.
>
> > If someone could clarify what people would like to be able do with Lua
>
> Similar things as Python: take VTK objects, put them into a pipeline,
> load data, do computations, etc.
>
> > and which parts of the project would need to be wrapped, that would be
> > great.
>
> If the wrapping infrastructure is used, "all" of VTK shouldn't be too
> much past the initial push. There are bound to be corner cases that will
> need to be handled though.
>
> David Gobbi is the main developer behind the wrapping infrastructure,
> but I've done some work in it as well.
>

I can add a bit more info about how the VTK python wrappers work.
Basically, the wrappers use a custom C++ parser (specifically tuned
to VTK) that reads all the VTK header files and create a C data structure
that describes the VTK API in all of its gory detail.  That information is
then
used to generate the python wrapper code for each of the VTK classes.
The entire python wrapper generator is actually written in C.

If there is a desire to add other wrapper languages, there are options:

1) I have a modification to the VTK wrappers that generates a full xml
description of the VTK API at https://github.com/dgobbi/WrapVTK ,
and this xml could be fed into a customized wrapper-code generator.

2) A person could write a back-end for our custom C++ parser that
generates swig .i files, and then swig can be used to generate the
language wrappers. Or, the aforementioned xml could be converted
into a set of .i files for swig.

3) The same approach could be taken as for the existing wrappers,
i.e. write the wrapper-generator in C (or C++).  :)

Due to its complexity, VTK is probably not amenable to off-the-shelf
wrapping tools.  So just as Qt chose to write their own PySide wrapper
tools (and Riverbank wrote sip before that), and just as ITK chose to
use a hybrid gccxml/swig approach, VTK is well served by a customized
wrapping solution.

 - David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20150312/87ab5051/attachment.html>


More information about the vtk-developers mailing list