[Insight-users] Template class in Fluid
Luis Ibanez
luis.ibanez at kitware.com
Mon Mar 6 07:39:47 EST 2006
Hi Jordi,
The solution that we typically use for this problem is
to create a three level inheritance for the application.
Something like:
ApplicationBase< T >
^
|
|
ApplicationGUI <---- FLUID Generated
^
|
|
Application
The class ApplicationBase contains all the code that
is GUI independent. This includes the instantiation
of ITK filters for particular types.
The ApplicationGUI class is created with Fluid, and
derives from a specific instantiation of ApplicationBase.
In fluid we only declare "virtual void f(void) " methods,
for the ApplicationGUI class. In this way every method is
the direct callback for one of the GUI elements (buttons,
sliders,...).
The Application class overloads the virtual methods defined
in ApplicationGUI, and because it has access to all the GUI
elements, it can contain all the GUI dependent code.
You will see this pattern being used in InsightApplications,
in directories such as:
* GaussianFilter
* Curves2DExtractor
* Curves3DExtractor
* DuctExtractor
* Morphogenesis
Please give it a try to this layered implementation
and let us know if you find any problems.
Thanks
Luis
----------------------
Jordi Inglada wrote:
> Hi all,
>
> This is not a pure itk question, but you may have crossed this kind of
> issue yourselves.
>
> I would like to build a fltk GUI for an itk filter by public inheritance
> from it, that is, my GUI inherits from the filter.
>
> The problem is that I do not know how to tell fluid that my GUI class is
> also a template class. The class window of fluid has only 2 fields:
> - the class name
> - the superclass name
>
> The first field will not accept the "template" keyword.
>
> Any ideas?
>
> Thanks.
>
> Jordi
>
>
More information about the Insight-users
mailing list