[vtkusers] How to pass a vtk object between python to C++

Yi-Yu Chou chouyiyu at hotmail.com
Thu Oct 9 16:56:19 EDT 2003


Hi,
I would like to pass a vtk object (vtlimageData) between python to my own
C++ class using SWIG. The structure of my code would be like :
// A.py
from imgReg import *
.......
img1 = vtkImageData()
IR = ImgReg() <----- my own C++ function
IR.SetImg(img1)
.......

//imgReg.i
%module imgReg
{% 
#include "imgReg.h"
%}
#include imgReg.h

//imgReg.h
#include "vtkImageData.h"
class imgReg {
public :
   imgReg();
  ~imgReg();
  SetImg(vtkImageData *);
};

My question is :
1. Is this available by using SWIG ?
2. Do I need to include vtkImageData.h in my imgReg.i ?
3. Because vtkImageData.h contains other .h files, do I 
   need to include all of them ? And how to include ?(they are a lot)
4. How to build the module _imgReg.so with so many .h file ?
   g++ -shared imgReg.o imgReg_wrap.o -o _imgReg.so ?

Thanks in advance !!!!!!!

_________________________________________________________________
現在就上 MSN 台灣網站:與親朋好友緊密聯繫,即時掌握新聞、財經、娛樂的最新訊
息 http://msn.com.tw 




More information about the vtkusers mailing list