[Insight-users] extend classes with cableswig
Gaetan Lehmann
gaetan.lehmann at jouy.inra.fr
Wed Aug 3 09:52:24 EDT 2005
Hi Brad,
swig allow to extend classes with the keyword %extend.
I want to implement methods such as __getitem__, __setitem__ and __len__
in Size, Index, Array and FixedArray classes, so those basic objects can
be accessed with native python interface, and with bound checking, which
is more python user friendly. Adding __repr__ or __str__ method to those
classes would also allow user to easily see the content of objects of
those classes...
Also, I want to implement __str__ in LighObject class, to return the
string produced by the Print method, so lots of itk objects can be printed
with "print anItkObject"
Sadely, with cableswig, it seems %extend have no effect. Do you know why ?
What can be done to extend classes ? Currently, I'm adding all those
method directly in .h files...
Thanks
Gaetan
--
Gaetan Lehmann <gaetan.lehmann at jouy.inra.fr>
Tel: +33 1 34 65 29 66
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
Web: http://voxel.jouy.inra.fr
More information about the Insight-users
mailing list