[Insight-developers] RE: BinaryErodeImageFilter

Brad King brad . king at kitware . com
Fri, 23 Aug 2002 09:33:24 -0400 (EDT)


> The way the code is now, you could call GetKernel() then call
> SetParam1() on the kernel and then call SetKernel().

Yes, this functionality would be broken, but the user could still downcast
to the right type with dynamic_cast<> in C++.  In Tcl, I have ideas how to
get Cable to do automatic downcasting, but they are not implemented.
However, we could add a static SafeDownCast method using the itkTypeMacro
that would work from Tcl.

> If the TKernel template parameter is removed, a user will not be able to
> "Get" the current kernel with the correct type.  But this is something
> the user could work around (though it could be a bit clunky).  If the
> motivation is to reduce template parameters, then it would probably be
> okay to remove it.  If the interest is making it easier on the user, we
> could have a default to the BinaryBallStructuringElement, etc.

The motivation here is to remove the template argument so that Tcl
wrappers need fewer combinations, and to allow the user to specify the
kernel at run-time.  Unless there is a big performance hit from changing
the functionality from compile-time to run-time, I would say the change is
worthwhile.

We could have the constructor default to BinaryBallStructuringElement by
setting the ivar.  Then the user could change it by creating an instance
of the desired kernel implementation, setting its parameters, and then
calling a SetKernel() method on the filter.

-Brad