[Insight-users] WrapITK Problem

Gheorghe Postelnicu gheorghe.postelnicu at gmail.com
Wed Oct 25 10:37:53 EDT 2006


No, I have one I downloaded about 1 week ago. I noticed that the build
time (from scratch) was huge with WrapITK enabled - it took about 8
hours. Is this normal?

Also, I assume that updating from the CVS and then building would take
less time. Correct?

Finally, I had a question yesterday about adding new classes to the
Python wrapper. I meant one of the existing ITK classes, such as the
LBFGSBOptimizer. It was not hard for me to manually add that line in
the wrap_ITKOptimizers.cmake file, but is there an "ITK way" of
preserving that modification through an update? Sorry, probably this
question is a little silly, I know....

On 10/25/06, Gaetan Lehmann <gaetan.lehmann at jouy.inra.fr> wrote:
>
> Hi,
>
> On Wed, 25 Oct 2006 15:54:21 +0200, Gheorghe Postelnicu
> <gheorghe.postelnicu at gmail.com> wrote:
>
> > Hi,
> >
> > I have 2 question regarding the Python WrapITK CVS distribution:
> >
> > 1. when I use the syntax
> >
> > from itk import * in a python script, I get the message:
> >
> > Python 2.3.4 (#1, Mar 10 2006, 06:12:09)
> > [GCC 3.4.5 20051201 (Red Hat 3.4.5-2)] on linux2
> > Type "help", "copyright", "credits" or "license" for more information.
> >>>> from itk import *
> > Traceback (most recent call last):
> >   File "<stdin>", line 1, in ?
> >   File "/local/lib/InsightToolkit/WrapITK/Python/itkLazy.py", line 18,
> > in __getattribute__
> >     itkBase.LoadModule(module, namespace)
> >   File "/local/lib/InsightToolkit/WrapITK/Python/itkBase.py", line 85,
> > in LoadModule
> >     if not swigModuleName in sys.modules: module =
> > loader.load(swigModuleName)
> >   File "/local/lib/InsightToolkit/WrapITK/Python/itkBase.py", line 192,
> > in load
> >     return imp.load_module(name, fp, pathname, description)
> >   File "/local/lib/InsightToolkit/WrapITK/lib/IntensityFiltersPython.py",
> > line 1, in ?
> >     tionImageFilterINS_5ImageItLj2EEES2_E13CreateAnotherEv
> > NameError: name
> > 'tionImageFilterINS_5ImageItLj2EEES2_E13CreateAnotherEv' is not
> > defined
>
> It works fine for me.
> Are you using the last cvs version ?
>
> >
> > 2. It seems the Python examples in the ITK directories follow some
> > slightly different syntax, namely they use import InsightToolkit.
> > However, the install of the WrapITK produces the itk namespace. Is
> > this normal?
>
> Yes, that's normal.
> The itk namespace has been chosen to be more consistent with c++, and
> because it is shorter.
> Note that with the old wrappers, you had to do:
>
>    from InsighToolkit import *
>    median = itkMedianImageFilter...
>
> and with the new:
>
>    import itk
>    median = itk.MedianImageFilter...
>
> This last form has a huge advantage compared to the "from itk import *"
> you are using: it use the lazy loading, and should save lots of the
> loading time
>
> Gaetan
>
>
> --
> 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
>


-- 
Gheorghe Postelnicu, PhD
MGH, Harvard Medical School


More information about the Insight-users mailing list