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

Luis Ibanez ibanez@choroid.cs.unc.edu
Tue, 30 Oct 2001 07:29:32 -0500 (EST)


Brad,

The CABLE_CLASS_SET command is working fine for
defining intermediary types. A warning that you
may want to display somewhere is that care should
be taken to avoid the ending ">" of templates
declarations to be side by side and create the ">>"
token.

for example:

 CABLE_CLASS_SET(ImageType "itk::Image<char,3>")
 CABLE_CLASS_SET(ImagePointer "itk::SmartPointer<$ImageType>")

will give trouble because the replacement of ImageType in the
second line produces a ">>" token that is missinterpreted.
Maybe it could be nice to force the insertion of extra spaces
directly in Cable when the string-types like "$ImageType" are
replaced.

--

I couldn't use the tags anymore when using the CLASS_SETs...
is there a different way to do it ?

I tried

    CABLE_CLASS_SET(ImageType "itk::Image<char,3>")
    CABLE_WRAP_TCL( ImageTcl
      "myImageType:$ImageType;itkImage.h")

but, it ends up concatenating my tag and CABLE's
generated typename like "myImageTypeitkImage_char_3"

Tags are a neat idea because we can pick up names
that are more descriptive for a particular applications,
instead of using Cable's default names.

---

I added GetElement() and SetElement() methods in itkIndex
and itkSize so now in Tcl the following notation is possible

   $size SetElement 0 100
   $size SetElement 1 160

The notation

   $size SetSize { 100 160 }

didn't work for me, Tcl looked for a method of signature

   "SetSize( char*)"

---

How can I use "std::cout"  ?
should I ask cable to wrap the class too ?
I tried to call PrintSelf() in the image, but needed
to have cout for this.

---

Thanks


Luis


-----------------------


On Mon, 29 Oct 2001, Brad King wrote:
>
> >     typedef itk::Image< double, 3 > itkImage3Ddouble;
> >     typedef itkImageFileReader< itkImage3Ddouble > filterType;
> >
> >    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
>
> _______________________________________________
> Insight-developers mailing list
> Insight-developers@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-developers
>

-- 
Luis Ibanez                                      CB#:   7060
Research Assistan Professor                      phone: (919) 843 5436
Division of Neurosurgery                         fax:   (919) 966 6627
University of North Carolina at Chapel Hill      email: ibanez@cs.unc.edu
Chapel Hill, NC 27599-7060                       http://www.cs.unc.edu/~ibanez