[vtkusers] Python wrapping

tutu lamotte tutulamotte at yahoo.com
Mon Sep 29 11:08:57 EDT 2003


Yes...
If it's just to wrap around your own VTK filter, i
would tend to agree with David.


--- David Gobbi <dgobbi at imaging.robarts.ca> wrote:
> Hi John,
> 
> You can use CMake to do the wrapping for you.  All
> you should
> have to do is use the attached CMakeLists.txt file,
> search-and-replace
> 'vtkMyClass' with whatever your class is called, put
> it in the
> same directory as your class, and run cmake.  CMake
> will ask you
> where VTK build directory is, and should do all
> wrapping automatically
> from there.
> 
> Do not try to use swig, sip, or any other wrapping
> tools with your class!
> Even if you succeeded, you wouldn't be able to use
> your class together
> with the other VTK wrapped classes.
> 
>  - David
> 
> --
>   David Gobbi, PhD               
> dgobbi at imaging.robarts.ca
>   Advanced Imaging Research Group
>   Robarts Research Institute, University of Western
> Ontario
> 
> On Mon, 29 Sep 2003, Dubois, John R (MED) wrote:
> 
> > I am trying to locate information on how to create
> a Python wrapper from
> > C++ code. I have a filter written in C++ that I
> would like to use in
> > Python. Can anyone point me in the right
> direction?
> >
> > GE logoGE Medical Systems
> > _______________________________________________
> > John Dubois
> > Software Programmer
> >
> > Functional and Molecular Imaging
> > Phone: 519-858-5009
> > E-mail: John.Dubois at med.ge.com
> > <mailto:John.Dubois at med.ge.com?subject=e-mail
> reply>
> >
> >
> >
> > CMAKE_MINIMUM_REQUIRED(VERSION 1.6)
> PROJECT(MyProject)
> INCLUDE_REGULAR_EXPRESSION("^.*$")
> 
> # Look for a VTK build directory
> FIND_PACKAGE(VTK)
> IF (VTK_FOUND)
>   INCLUDE (${VTK_USE_FILE})
> ENDIF (VTK_FOUND)
> 
> # Source files included in the plugin
> SET( MyProject_SRCS
> vtkMyClass.cxx
> )
> 
> # The C++ files must be made into a C++ library
> ADD_LIBRARY ( vtkMyClass ${vtkMyClass_SRCS})
> 
> # set the libraries to link against
> TARGET_LINK_LIBRARIES(vtkMyClass vtkIO vtkRendering)
> 
> # Configure Python module, which is the plugin
> itself
> IF (VTK_WRAP_PYTHON)
>   VTK_WRAP_PYTHON2(vtkMyClassPython
> vtkMyClassPython_SRCS
>                    ${vtkMyClass_SRCS})
>   ADD_LIBRARY(vtkMyClassPython SHARED
> ${vtkMyClassPython_SRCS})
>   TARGET_LINK_LIBRARIES (vtkMyClassPython
>                          vtkMyClass
>                          vtkIOPython
> vtkRenderingPython)
> ENDIF (VTK_WRAP_PYTHON)
> 
> 
> 


__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com



More information about the vtkusers mailing list