[cable] Do Tcl-wrapped classes have to appear in itk namespace?

Brad King brad.king at kitware.com
Fri Feb 13 15:23:30 EST 2004


Parag Chandra wrote:
> Hi,
> 
>  
> 
> I spent yesterday playing around with Cable, trying to wrap my own 
> ITK-derived classes in Tcl. I am using v1.2 of ITK, so it is in fact 
> Cable that I am using, and not Cswig. I studied the structure of ITK’s 
> Wrapping directory and followed its example, and I am now at the point 
> where I have successfully wrapped one of my classes, which is in another 
> namespace called ‘aks’. The wrapping is in a DLL on Windows, and to test 
> it, I started up the itktcl interpreter and did ‘load 
> c:/some_path_to/AKSProcessingTcl.dll”. The library loads successfully; 
> however, trying the simple command ‘set filter [itk::create 
> Normalize01ImageFilterD2]’ results in
> 
>  
> 
> “invalid command name "itk::Normalize01ImageFilterD2"”
> 
>  
> 
> If I go back to the source file that I created to wrap my class and put 
> my class in the _/cable/_::wrappers::itk namespace, instead of 
> _/cable/_::wrappers::aks, recompile, and reload the DLL, then the 
> command above works: filter points to an instance of my custom class. So 
> my question is, do all classes wrapped via ITK_WRAP_TCL need to be in 
> the itk namespace? Is there a way I can create my own aks::create 
> command to mirror the construction of itk objects provided by 
> itk::create? Does Cswig provide a different mechanism that will allow me 
> to keep my classes in their own namespace?

The itk::create procedure is assuming the itk namespace.  It is 
implemented somewhere in Wrapping/Tcl.  You should just be able to read 
its implementation and figure out how to write an aks::create procedure.

-Brad




More information about the cable mailing list