[vtkusers] [KWWidgets] How do I write a TCL-wrappable C++ function that will take an ITK image as an argument?

Sebastien BARRE sebastien.barre at kitware.com
Fri Jun 26 12:07:19 EDT 2009


At 6/26/2009 11:56 AM, kent williams wrote:

>What I'd like to know is what the method would be to directly accept
>an ITK image as a parameter to a VTK-wrapped class method.

Long story short Kent, unless I missed some VTK wrapping development 
in VTK, no, it can not wrap ITK parameters, sorry. The VTK Tcl 
wrappers are generated by a parser in VTK that handles a very 
specific syntax based on macros in vtkSetGet.h; It has no knowledge 
of ITK. The ITK Tcl wrappers (if they still exist) are very 
different, mostly to handle templated C++, if I recall.

>I'm suspecting it will end up being something as dreadful as this:
>
>void SetImage(void *Image)
>{

You can not pass an arbitrary pointer either, I don't think it will 
be wrapped.
"Everything is a string in Tcl".  You could pass the address of the 
pointer as a string, and do your own hacking there to find the 
corresponding ITK objects, but I wouldn't advise that...

Now I'm not sure why your back and forth is costly. At the end of the 
day, the image should be stored the same way, so you don't even need 
to copy/transfer the data around, you could devise a class that just 
wraps and unwraps around that pointer. Isn't that what vtkITKImage does?




More information about the vtkusers mailing list