Text archives Help
- From: Carlos Santos <csantos.incor@gmail.com>
- To: Gaetan Lehmann <gaetan.lehmann@jouy.inra.fr>
- Cc: Darby J Van Uitert <darbyb@sci.utah.edu>, Luis Ibanez <luis.ibanez@kitware.com>, scirun-users@sci.utah.edu, Insight Developers List <insight-developers@public.kitware.com>, Benoit Regrain <benoit.regrain@creatis.insa-lyon.fr>
- Subject: Re: [SCIRUN-USERS] extending ITK support
- Date: Tue, 18 Oct 2005 17:45:03 -0200
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=ous0PVmZ7pdOvRh7b5aS9dVT4wRWIfu1eVw+Tb3NHvuUTOiFULjrIKX/+L7iRPF4LF8uQWA2BG7G1MLZ8Jbqvq9x9bG79gU0D0TvrRHBzAS0Lkb3RqZ5RKsLxuMDgmGkgAiWRnzI7u3pxVG5KWOegqG5gtav5s5PL2r/HwPOX5Y=
Hi,
Many thanks to everyone who responded.
I made a python script which retrieves filter information, using the
current python wrapper for ITK. The output I get for each filter is
something like:
{'FilterName': 'itkGeodesicActiveContourLevelSetImageFilter',
'Instantiations': [[['float', '2'], ['float', '2']],
[['float', '3'], ['float', '3']]],
'Methods': ['SetAdvectionImage', 'SetAdvectionScaling',
'SetAutoGenerateSpeedAdvection', 'SetCurvatureScaling',
#etc
]}
That should be enough for speeding up the integration of ITK filters
into SCIRun, but with the wrapper demonstrated by Gaetan the process
would be very smoother. I guess the new wrapper is not even in CVS; is
there any plans for its release?
I guess the inclusion of XML filter descriptions in the wrapping
process might be useful to integrate ITK into other environments than
SCIRun, like the R-project (r-project.org). My first take on the
problem was looking at the output of gcc-xml to see if I could create
the SCIRun wrappers with XSLT transformations, but I found the format
too verbose -- so I resorted to python. But I guess many people could
try XSLT transformations if there was a more friendly XML descriptor.
Regards,
Carlos Santos
On 10/17/05, Gaetan Lehmann <gaetan.lehmann@jouy.inra.fr> wrote:
>
>
Hi,
>
>
The new wrapping process can be used to get informations about wrapped
>
classes and the template parameters used, but it will not be easy to use
>
if you need to have the filter parameters (and I think it's the case).
>
>
The new itk python module provides some methods to allow to discover
>
easily the available template parameters: each templated class provides a
>
dictionary interface which allow to list the available parameters. Also,
>
it's easy, from a python class, to get the templated class and the
>
parameters.
>
And find the methods of an object is still easy in python :-)
>
>
An example:
>
>
1> import itk
>
Warning: itkIndent not found
>
>
2> itk.MedianImageFilter.keys()
>
2>
>
[(<class 'itkImage_2D.itkImageSS2'>, <class 'itkImage_2D.itkImageSS2'>),
>
(<class 'itkImage_3D.itkImageSS3'>, <class 'itkImage_3D.itkImageSS3'>),
>
(<class 'itkImage_2D.itkImageUC2'>, <class 'itkImage_2D.itkImageUC2'>),
>
(<class 'itkImage_2D.itkImageSL2'>, <class 'itkImage_2D.itkImageSL2'>),
>
(<class 'itkImage_2D.itkImageD2'>, <class 'itkImage_2D.itkImageD2'>),
>
(<class 'itkImage_2D.itkImageF2'>, <class 'itkImage_2D.itkImageF2'>),
>
(<class 'itkImage_2D.itkImageUS2'>, <class 'itkImage_2D.itkImageUS2'>),
>
(<class 'itkImage_3D.itkImageUS3'>, <class 'itkImage_3D.itkImageUS3'>),
>
(<class 'itkImage_2D.itkImageUL2'>, <class 'itkImage_2D.itkImageUL2'>),
>
(<class 'itkImage_3D.itkImageSL3'>, <class 'itkImage_3D.itkImageSL3'>),
>
(<class 'itkImage_3D.itkImageUL3'>, <class 'itkImage_3D.itkImageUL3'>),
>
(<class 'itkImage_3D.itkImageSC3'>, <class 'itkImage_3D.itkImageSC3'>),
>
(<class 'itkImage_3D.itkImageF3'>, <class 'itkImage_3D.itkImageF3'>),
>
(<class 'itkImage_3D.itkImageUC3'>, <class 'itkImage_3D.itkImageUC3'>),
>
(<class 'itkImage_3D.itkImageD3'>, <class 'itkImage_3D.itkImageD3'>),
>
(<class 'itkImage_2D.itkImageSC2'>, <class 'itkImage_2D.itkImageSC2'>)]
>
>
3> (param, cl) = itk.MedianImageFilter.items()[0]
>
>
4> param
>
4> (<class 'itkImage_2D.itkImageSS2'>, <class 'itkImage_2D.itkImageSS2'>)
>
>
5> cl
>
5> <class 'itkMedianImageFilter.itkMedianImageFilterISS2ISS2'>
>
>
the lines above show how to get all the combinaisons of types of a template
>
and the python class associated to the template and a combinaison of types.
>
(You will not get all the types above: I have build the python wrappers
>
with as much types as possible to test everything works fine)
>
>
6> itk.template(param[0])
>
6> (<template itkImage>, (<itkCType signed short>, 2))
>
>
7> itk.template(cl)
>
7>
>
(<template itkMedianImageFilter>,
>
(<class 'itkImage_2D.itkImageSS2'>, <class 'itkImage_2D.itkImageSS2'>))
>
>
and here we get the template and the combinaison of types from an itk class
>
Also, get all the classes available in ITK should be easy:
>
>
8> [module for module in dir(itk) if not module.startswith("__") and
>
module[0].isupper() and len(module) > 2]
>
8>
>
['AbortCheckEvent',
>
'AbsImageFilter',
>
'AbsoluteValueDifferenceImageFilter',
>
'AcosImageFilter',
>
...snip...
>
'WhiteTopHatImageFilter',
>
'XorImageFilter',
>
'ZeroCrossingBasedEdgeDetectionImageFilter',
>
'ZeroCrossingImageFilter']
>
>
and get the available methods is still easy in python (after some cleanup):
>
>
9> [ method for method in dir(cl.New()) if isinstance(method, str) and
>
not method.startswith("__") and method[0].isupper()]
>
9>
>
['AbortGenerateDataOff',
>
'AbortGenerateDataOn',
>
'AddObserver',
>
'CreateAnother',
>
'DebugOff',
>
...snip...
>
'UpdateOutputInformation',
>
'UpdateProgress']
>
>
Note that I'm talking about the version I'm working on. I still don't know
>
what will be integrated in the official ITK.
>
>
Regards,
>
>
Gaetan
>
>
>
On Sun, 16 Oct 2005 04:19:26 +0200, Darby J Van Uitert
>
<darbyb@sci.utah.edu> wrote:
>
>
> Luis,
>
>
>
> The ITK XML file does not have to specify anything about a GUI. By
>
> default, any parameters will be text entry boxes in the module UI. At a
>
> minimum, the ITK XML file must contain information about how the filter
>
> is templated, any inputs and outputs, and any parameters. Chapter 8 of
>
> the SCIRun User Guide
>
> (http://software.sci.utah.edu/doc/User/Guide/usersguide/srug8.html)
>
> goes into it in more detail. I would be happy to help in any way I can
>
> since I helped write the wrapper. Thanks.
>
>
>
> -darby j
>
>
>
> On Sat, 15 Oct 2005 12:16:45 -0400
>
> Luis Ibanez <luis.ibanez@kitware.com> wrote:
>
>> Hi Carlos,
>
>>
>
>> We are planning to refactor the wrapping process in ITK,
>
>> so that wrappers are generated from CMake. I wonder if
>
>> an XML description can be added as part of this refactoring.
>
>>
>
>> If I remember correctly one of the extra information that
>
>> you need for SCIrun is to have some indication of the GUI
>
>> widgets that can be associated to filter parameters, along
>
>> with default values and ranges for those values.
>
>>
>
>> Is this still the case ?
>
>>
>
>>
>
>> Regards,
>
>>
>
>>
>
>> Luis
>
>>
>
>>
>
>> -----------------------
>
>> Carlos Santos wrote:
>
>>> Dear all,
>
>>>
>
>>> I am starting out with both SCIRun and ITK and I am really interested
>
>>> in incorporating more ITK filters into SCIRun. I found the
>
>>> documentation about wrapping the filters, distributed with the Insight
>
>>> Applications package and successfully wrapped the CannyEdgeDetection
>
>>> filter.
>
>>>
>
>>> Now I'd like to automate the generation of XML descriptions for the
>
>>> filters. Since I've built ITK with python support, I thought of using
>
>>> python's reflective abilities to discover information about the
>
>>> filters (like supported methods) and create the descriptors. Probably,
>
>>> some manual editing would still be necessary after that.
>
>>>
>
>>> Before diving into what might be duplicate work, I'd like to know if
>
>>> there are some other efforts for extending ITK support in SCIRun. Any
>
>>> comments on the described approach would be wellcome. I would be
>
>>> willing to contribute back to the SCIRun project any resultant
>
>>> extension.
>
>>>
>
>>> Yours sincerely,
>
>>> Carlos Santos
>
>>>
>
>>> ===========================================================================
>
>>> == The SCIRun Users mailing list: send email to
>
>>> majordomo@sci.utah.edu ==
>
>>> == for more details.
>
>>> ==
>
>>> == Please acknowledge use of SCIRun in your papers and
>
>>> reports: ==
>
>>> == see http://software.sci.utah.edu/scirun-biopse_citation.bib
>
>>> ==
>
>>> ===========================================================================
>
>>>
>
>>>
>
>>
>
>> ===========================================================================
>
>> == The SCIRun Users mailing list: send email to
>
>> majordomo@sci.utah.edu ==
>
>> == for more details.
>
>> ==
>
>> == Please acknowledge use of SCIRun in your papers and
>
>> reports: ==
>
>> == see http://software.sci.utah.edu/scirun-biopse_citation.bib
>
>> ==
>
>> ===========================================================================
>
>
>
> ...........................
>
> Darby J Van Uitert
>
> SCI Institute
>
> University of Utah
>
> Email: darbyb@sci.utah.edu
>
> Phone: 301.528.8469
>
> ...........................
>
>
>
>
--
>
Gaëtan Lehmann
>
Biologie du Développement et de la Reproduction
>
INRA de Jouy-en-Josas (France)
>
tel: +33 1 34 65 29 66 fax: 01 34 65 29 09
>
http://voxel.jouy.inra.fr
>
===========================================================================
== The SCIRun Users mailing list: send email to majordomo@sci.utah.edu ==
== for more details. ==
== Please acknowledge use of SCIRun in your papers and reports: ==
== see
http://software.sci.utah.edu/scirun-biopse_citation.bib ==
===========================================================================
Archive powered by MHonArc 2.6.16.