[Insight-users] Importing itk module generated by WrapITK is slow
Zachary Pincus
zpincus at stanford.edu
Tue Mar 28 12:50:56 EST 2006
Hi Kalle -
> 1. Enabling WRAP_rgb_unsigned_short in ccmake caused the "import
> itk" to fail, because the symbol NumericTraits<RGBPixel<unsigned
> short>> (or something to that effect) was not found. Disabling the
> wrapping fixed the issue.
Could you post the exact error if you can find it? I don't think
we've run into that in testing, and it would be good to get it fixed.
> 2. import itk from python interpreter takes a lot of time
> (generally in the range from ~120 seconds to ~150 seconds)
As you might expect, this is because the default WrapITK wrapper
libraries are huge (look at the size of the shared libs). The delay
is probably unavoidable when loading several hundred megabytes of
shared library code. I don't think there's any generally good way to
speed this up -- but rest assured, we're keeping our eyes open in
hopes of finding a better solution in the future.
There are two solutions you could use for now:
(1) Don't use 'import itk' and instead selectively import the
libraries that you want, e.g.:
'import BasicFiltersA' (which will also take care of importing any
dependencies).
(2) Modify the WrapITK distribution to wrap fewer classes. You should
feel free to move/rename the any number of the wrap_xxx.cmake files
from BasicFiltersA, BasicFiltersB, and Algorithms so that they are
not built. If you want to add those filters in later, creating an
external project and dropping the wrap_xxx.cmake files into that
project is a quick and seamless way of getting them in. You can
choose whether or not installed external projects are automatically
imported when you call 'import itk'.
Zach Pincus
Program in Biomedical Informatics and Department of Biochemistry
Stanford University School of Medicine
>
> The first problem isn't a problem since I don't really need the
> datatype. The delay in loading the library on the other hand is not
> very desirable.
>
> I'm not very well versed in using ITK and was looking forward to
> testing stuff from python. I guess I could do development in a way
> that the library was kept in memory and once I had something
> working, only wrap the classes that the code absolutely needs to
> keep the load time manageable.
>
> Is there some other way to speed up the loading of the itk module
> than cutting down on stuff it contains?
>
> Oh, in case it matters my GCC version is
> gcc version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9)
>
> I'd be happy to describe my setup further if it has anything to do
> with the issue.
>
> Kalle Pahajoki
>
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
More information about the Insight-users
mailing list