[Insight-developers] XML
Yarden Livnat
yarden@cs.utah.edu
Fri, 7 Mar 2003 10:01:29 -0700
--Apple-Mail-9-29813288
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
format=flowed
Here is the first of the more specific email:
please remember that the other issues are
1. XML description of ITK filters.
2. Dynamic Compilation.
3. Non-templated base classes for templated classes.
Background,
SCIRun is similar in many respect to AVS, Data Explorer and the such.
The key difference between ITK and these system is that the pipeline is
constructed dynamically at run-time rather then at compile time as is
done
with ITK. Each module (a more general version of an ITK filter) accept
user
input (via a GUI) as well as input from other modules.
1. XML
In order for us to create SCIRun modules from ITK filters without
changing
ITK code or imposing on ITK, we are using XML files that describe
ITK filter.
I attach an example of such an XML description files. We are using
these
files to automatically generate SCIRun wrappers for each filter.
Note that
the same can be done for other system as well. This has a generic
description.
I understand that there is some effort (or at least a desire for
some effort :-)
to generate description files for ITK filters (and other ?). As
such, we would like
to coordinate this effort.
Our view is to use a 3-level XML description.
Level 1:
ITK level XML: a single file per ITK filter which describe
the fiter
a. templated:
Specify the template types of this filter. In
other words, declare them
as new datatypes for the rest of the file,
without specifying exactly what
they are
b. inputs/outputs: set/get which are part of the pipeline
c. parameters: things the users can set via the GUI. Note,
each parameter
has only a name and a datatype (possibly a
default value). It does *not*
specify how the user see or manipulate it (i.e.,
a double. The user may
interact with it via a text entry, a slider,
etc.... but this is to specify some place
else as ITK itself does not deal with GUI).
d. include file: the *.h file which declare the filter.
--Apple-Mail-9-29813288
Content-Disposition: attachment;
filename=filter_DiscreteGaussianImageFilter.txt
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
x-unix-mode=0644;
name="filter_DiscreteGaussianImageFilter.txt"
<filter-itk name="DiscreteGaussianImageFilter">
<description>
Blurs an image by separable convolution with
discrete gaussian kernels. This filter performs
Gaussian blurring by separable convolution of an
image and a discrete Gaussian operator (kernel).
</description>
<templated>
<base>itk::Object</base>
<template>InputImageType</template>
<template>OutputImageType</template>
</templated>
<inputs>
<input>
<value>InputImageType</value>
<num>1</num>
</input>
</inputs>
<outputs>
<output>
<value>OutputImageType</value>
<num>1</num>
</output>
</outputs>
<parameters>
<param>
<name>Variance</name>
<type>double</type>
</param>
<param>
<name>MaximumError</name>
<type>double</type>
</param>
</parameters>
<includes>
<include>itkDiscreteGaussianImageFilter.h</include>
</includes>
</filter-itk>
--Apple-Mail-9-29813288
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
format=flowed
Level 2:
GUI XML. Each such file specify for a given ITK filer how the
parameters should be
presented to the user. This is an application specific. There
can be several GUI XML
files for the same ITK filter each presenting the user with a
different look. Obviously,
only one GUI at a time can be used.
--Apple-Mail-9-29813288
Content-Disposition: attachment;
filename=gui_DiscreteGaussianImageFilter.txt
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
x-unix-mode=0644;
name="gui_DiscreteGaussianImageFilter.txt"
<filter-gui name="Yarden-DiscreteGaussianImageFilterGui">
<parameters>
<param name="Variance">
<gui>text-entry</gui>
<default>10</default>
</param>
<param name="MaximumError">
<gui>text-entry</gui>
<default>0.001</default>
</param>
</parameters>
<types>
<type name="double">
<guivar>GuiDouble</guivar>
</type>
</types>
</filter-gui>
--Apple-Mail-9-29813288
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
format=flowed
Level 3:
Application specifc. Which GUI XML to use with an ITK XML.
Other application
specific info.
XSLT:
For SCIRun we wrote a few XSLT files which can take any ITK-XML
files and generate
the appropriate *.cc and *.h files. These files can then be
compiled and linked into SCIRun
without any modifications.
The same can be done for other system/application. ie., a set of
3-4 XSLT files which can
translate each ITK XML files to the particular system. VTK is an
example of a system which
is hardcoded into ITK and which could (I think) have been connected
via this kind of XML and
XSLT files instead of Macros inside the C++ code. FLTK is an
example of a GUI which can be
connected to ITK via the same mechanism.
Are other people working on similar ideas ? Are there other things that
should be put
into these XML files ?
One important point. We are _not_ going to implement this for each and
every filter.
My view is that this should become a requirement for all ITK filters
writers.
Yarden
--Apple-Mail-9-29813288--