[vtkusers] vtk/python/swig: data type error

Yi-Yu Chou chouyiyu at hotmail.com
Mon Oct 13 18:12:43 EDT 2003


Hi ,
I am trying to pass a vtk object from python to my own C++ class,
but I got a data type error message :
    File "My_Reg.py", line 42, in set_OriImg
    def set_OriImg(*args): return apply(_My_Reg.Reg3D_set_OriImg,args)
   TypeError: Type error. Expected _p_vtkImageData

My codes are :
// My_Reg.h
#include < vtkImageData.h>

class Reg3D {
public:
  Reg3D();
  ~Reg3D();
  void set_OriImg(vtk ImageData *img);
};

//My_Reg.i
%modiule My_reg
%{
#include "My_Reg.h"
%}

%include My_Reg.h

//My_Reg.c
#include "My_Reg.h"
#include "vtkImageData.h"

Reg3D::Reg3D() {
}

Reg3D::~Reg3D() {
}

void Ref3D::set_OriImg(vtkImageData *img) {
}
.............................................................................................................................................


Then, I used the following commands to compile the module :
swig -c++ -python My_Reg.i
g++ -c My_Reg.c My_Reg_wrap.cxx -I/usr/local/include/python2.2 \
                                                    
-I/usr/lib/vtk40/VTK/Common \
                                                    -I/usr/lib/vtk40/VTK
g++ -shared My_Reg.o My_Reg_wrap.o -o -I/usr/local/vtk40/VTK/Common \
                                                             
-I/usr/local/vtk40/VTK \
                                                             _My_Reg.so
How  can I make this work ?

_________________________________________________________________
免費試聽 MSN 英語學習:和真人老師線上學英文 http://www.msn.com.tw/english/ 




More information about the vtkusers mailing list