[Insight-developers] Re: Tcl Wrapped ImageGaussianFilter & Questions

Brad King brad.king@kitware.com
Mon, 29 Oct 2001 13:44:10 -0500 (EST)


Luis,

I'm glad to see someone is using CABLE.

> So far, the only extrange thing to note is that when building the
> example, "make" has to be called several times ( seven in this case ),
> the intermediate calls will print errors that change from one make to
> the other. the last one is free of messages.
I haven't seen this problem.  Correct dependencies should be generated by
CMake.  Would you please send me a log of a build in which this happens,
and a copy of the generated makefiles?

>     typedef itk::Image< double, 3 > itkImage3Ddouble;
>     typedef itkImageFileReader< itkImage3Ddouble > filterType;
> 
[snip]
>    What's the correct way of doing this ?

CABLE_CLASS_SET(ScalarType double)
CABLE_CLASS_SET(Dimension 3)
CABLE_CLASS_SET(ImageType "itk::Image<$ScalarType, $Dimension>")
CABLE_WRAP_TCL(Foo
  # Wrap the image type.
  $ImageType

  # Wrap the filter for the image type.
  "itk::ImageFileReader<$ImageType >"
)

The automatic tagging will create the pseudo-typedefs for you.  I designed
it this way so that adding more scalar types and dimensions would be easy.  
These commands are CMake specific.  CABLE's configuration files have no
notion of a "tag", but instead need explicit alternative names listed out.  
The CMake commands shown above only affect the auto-generation of the
config files for CABLE.

>    The problem is that the "name" of the method is "[]"
To set the size and index values, use the "SetSize" or "SetIndex" methods:

set size [itkSize_2]
set index [itkIndex_2]
$size SetSize {1 2}
$index SetIndex {3 4}

To get the values, you can still call the [] operator:

# Find size[0]:
$size {[]} 0

This should work despite being ugly.  It may be worth adding a method with
a better name to the Index/Size classes for this purpose.

> I would like to suggest to add another one, if you have a chance.
> Something that allows to see the list of all the classes (at leat the
> itk ones) that have been wrapped.
>It could be something like
>  wrap::ListWrappedClasses
That is easy to add.  I'll do it when I get a chance.  For now, you can
use this code to print out a list of commands related to ITK classes:

foreach i [lsort [info commands itk*]] { puts "$i" }

It will show each class twice, though.  Once with the foo<bar> notation,
and one with the foo_bar notation.  This is because Tcl doesn't know that
the commands do the same thing.

-Brad