/usr/src/WrapITK/Python/itk.py is in libinsighttoolkit3-dev 3.20.1+git20120521-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | """itk.py : Top-level container module for ITK wrappers."""
import itkBase, itkConfig, itkLazy, itkTypes, itkExtras, os, sys
thisModule = sys.modules[__name__]
if itkConfig.LazyLoading:
# If we are loading lazily (on-demand), make a dict mapping the available
# classes/functions/etc. (read from the configuration modules) to the
# modules they are declared in. Then pass that dict to a LazyITKModule
# instance and (later) do some surgery on sys.modules so that the 'itk'
# module becomes that new instance instead of what is executed from this file.
lazyAttributes = {}
for module, data in itkBase.module_data.items():
templateNames = [ t[0] for t in data['templates'] ]
attributes = dict( [(n, module) for n in templateNames] )
lazyAttributes.update(attributes)
if isinstance(thisModule, itkLazy.LazyITKModule):
# Handle reload case where we've already done this once.
# If we made a new module every time, multiple reload()s would fail
# because the identity of sys.modules['itk'] would always be changing.
thisModule.__init__(__name__, lazyAttributes)
del lazyAttributes
else:
thisModule = itkLazy.LazyITKModule(__name__, lazyAttributes)
else:
# We're not lazy-loading. Just load the modules in the order specified in
# the known_modules list for consistency.
for module in itkBase.known_modules:
itkBase.LoadModule(module, thisModule.__dict__)
# Regardless of how it was loaded, fill up the itk module with the ITK types
# and extras.
for k, v in itkTypes.__dict__.items():
if k != 'itkCType' and not k.startswith('_'):
setattr(thisModule, k, v)
for k, v in itkExtras.__dict__.items():
if not k.startswith('_'):
setattr(thisModule, k, v)
if itkConfig.LazyLoading:
# this has to be the last step, else python gets confused about itkTypes
# and itkExtras above. I'm not sure why...
sys.modules[__name__] = thisModule
else:
# do some cleanup
del module, thisModule
del itkBase, itkConfig, itkLazy, itkTypes, itkExtras, os, sys
|