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

Parag Chandra Parag_Chandra at med.unc.edu
Fri Feb 13 15:54:47 EST 2004


Hi Brad,

I hate to bounce this back to you, but I already searched for the word
"create" in Wrapping/Tcl. It came up with hits in 4 files: itkTclCommand.h,
itkTclStringStream.cxx, itkTclStringStream.h, and itkTclAppInit.cxx. Not one
of them defines any sort of create() function though. Just to be sure, I
search for "create" in the Wrapping/Tcl subdir of my build directory.
There's a lot of hits in here, but they all seem to be for a
CreateClassWrapper() method. Is the function not actually defined as
"create" in the source?

-Parag

-----Original Message-----
From: Brad King [mailto:brad.king at kitware.com] 
Sent: Friday, February 13, 2004 3:24 PM
To: Parag Chandra
Cc: Cable Mailing List
Subject: Re: [cable] Do Tcl-wrapped classes have to appear in itk namespace?

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