[Insight-users] Python Wrapping: A lonely journey
Carlos Phillips
carlos.phillips at mail.mcgill.ca
Mon, 9 Feb 2004 16:10:18 -0500
--Apple-Mail-1--730429466
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
format=flowed
Hi,
Over a month ago I set out to use ITK through python by wrapping custom
subclasses of ITK. I wrote most of the relevant ITK c++ code and
constructed vtk-python based visualization classes. During this time, I
posted several messages on this list asking for help in creating python
wrappers for custom subclasses of ITK. I was assured that this would
not be too hard, but I have yet to manage to do this. Also, no one
seems to have any working examples of wrapping custom classes. I have
managed to create wrappers for templated functions which access ITK
data structures as is done in ConnectVTKITK. I have also managed to
create wrappers for classes which do not subclass ITK classes. I have
not managed to create a wrapper for even the simplest ITK subclass:
template<typename TPixel>
class Image2D : public itk::Image< TPixel, 2 >
{
public:
typedef Image2D Self;
typedef itk::Image Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
itkNewMacro( Self );
itkTypeMacro( Image2D, Image );
}
I tried using the following cable config file:
%module TestPython
%{
#include "itkImage.h"
#include "Test.h"
%}
%include "Test.h"
%template(classNameUS2) className<itk::Image<short unsigned int, 2> >;
I can't seem to get this to be processed. Is there anyone out there who
could help me. I have invested considerable time in understanding ITK
and would hate to have to start looking for a new framework.
Any help would be greatly appreciated.
Carlos
--Apple-Mail-1--730429466
Content-Transfer-Encoding: 7bit
Content-Type: text/enriched;
charset=US-ASCII
Hi,
Over a month ago I set out to use ITK through python by wrapping
custom subclasses of ITK. I wrote most of the relevant ITK c++ code
and constructed vtk-python based visualization classes. During this
time, I posted several messages on this list asking for help in
creating python wrappers for custom subclasses of ITK. I was assured
that this would not be too hard, but I have yet to manage to do this.
Also, no one seems to have any working examples of wrapping custom
classes. I have managed to create wrappers for templated functions
which access ITK data structures as is done in ConnectVTKITK. I have
also managed to create wrappers for classes which do not subclass ITK
classes. I have not managed to create a wrapper for even the simplest
ITK subclass:
<fontfamily><param>Courier</param><color><param>1111,4242,7474</param><x-tad-bigger>template<<typename
TPixel>
class Image2D : public itk::Image<< TPixel, 2 >
{
public:
typedef Image2D Self;
typedef itk::Image Superclass;
typedef itk::SmartPointer<<Self> Pointer;
typedef itk::SmartPointer<<const Self> ConstPointer;
itkNewMacro( Self );
itkTypeMacro( Image2D, Image );
}
</x-tad-bigger></color></fontfamily>
I tried using the following cable config file:
<fontfamily><param>Courier</param><color><param>1111,4242,7474</param><x-tad-bigger>%module
TestPython
%{
#include "itkImage.h"
#include "Test.h"
%}
%include "Test.h"
%template(classNameUS2) className<<itk::Image<<short unsigned int, 2>
>;
</x-tad-bigger></color></fontfamily>
I can't seem to get this to be processed. Is there anyone out there
who could help me. I have invested considerable time in understanding
ITK and would hate to have to start looking for a new framework.
Any help would be greatly appreciated.
Carlos
--Apple-Mail-1--730429466--