[Insight-users] sorry, im again with wrappers

Brad King brad.king at kitware.com
Tue Jul 26 13:11:14 EDT 2005


Gaetan Lehmann wrote:
> 
> Hi Brad,
> 
> Since your fix in cableswig, I get a wrapping gap warning for  
> LabelStatisticsImageFilter (a some other classes) :
> 
> Generating wrap_itkLabelStatisticsImageFilterPython.cxx
> Warning  
> itk::Statistics::Histogram<double,1,itk::Statistics::DenseFrequencyContainer<float>  
> 
> 
>>
> has a class hierarchy that has wrapping gaps.
> The class hierarchy wrapping is as follows:
> Not wrapped: itk::Statistics::Sample<(itk::FixedArray<(double,1)>)>
>     Wrapped: itk::Object
>     Wrapped: itk::LightObject
> 
> I have wrapped itk::Statistics::Sample (see attached patch), and now I 
> get  another warning when building LabelStatisticsImageFilter :
> 
> Generating wrap_itkLabelStatisticsImageFilterPython.cxx
> :1: Warning(401): Nothing known about class  
> 'itk::Statistics::Sample<itk::FixedArray<double,1 > >'. Ignored.
> :1: Warning(401): Maybe you forgot to instantiate  
> 'itk::Statistics::Sample<itk::FixedArray<double,1 > >' using %template.
> 
> Sample builds without warning, but finally, I can't load InsightToolkit  
> module in python :
> 
> 1> import InsightToolkit
> ---------------------------------------------------------------------------
> exceptions.ImportError                               Traceback (most  
> recent call last)
> 
> /usr/lib/InsightToolkit/<console>
> 
> /usr/lib/InsightToolkit/python/InsightToolkit.py
> ----> 1 from itkalgorithms import *
>       2 from itkio import *
> 
> /usr/lib/InsightToolkit/python/itkalgorithms.py
> ----> 1 from itkbasicfilters import *
>       2 from itknumerics import *
>       3 __itk_import_data__ = itkbase.preimport()
>       4 from ITKAlgorithmsPython import *
>       5 itkbase.postimport(__itk_import_data__)
> 
> /usr/lib/InsightToolkit/python/itkbasicfilters.py
>       2 __itk_import_data__ = itkbase.preimport()
>       3 from ITKBasicFiltersAPython import *
> ----> 4 from ITKBasicFiltersBPython import *
>       5 from ITKBasicFiltersCPython import *
>       6 itkbase.postimport(__itk_import_data__)
> 
> /usr/lib/InsightToolkit/ITKBasicFiltersBPython.py
>      78 from itkExpandImageFilter import *
>      79 from itkIntensityWindowingImageFilter import *
> ---> 80 from itkLabelStatisticsImageFilter import *
>      81 from itkLaplacianRecursiveGaussianImageFilter import *
>      82 from itkLaplacianSharpeningImageFilter import *
> 
> /usr/lib/InsightToolkit/itkLabelStatisticsImageFilter.py
>      56 import vnl_vector
>      57 import vnl_vector_ref
> ---> 58 import itkSample
>      59 import itkImage_2D
>      60 import ITKRegions
> 
> /usr/lib/InsightToolkit/itkSample.py
>       3 # This file is compatible with both classic and new-style classes.
>       4
> ----> 5 import _itkSample
>       6
>       7 def _swig_setattr(self,class_type,name,value):
> 
> ImportError: No module named _itkSample
> 
> 
> 
> Do you know why Sample is not wrapped and how it can be fixed ?

By putting the fixedarray namespace inside the wrappers namespace you 
were telling CableSwig to try to wrap it.  Try the attached version. 
Don't forget to add it to wrap_ITKNumerics.cxx and CMakeLists.txt.

-Brad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wrap_itkSample.cxx
Type: text/x-c++src
Size: 1662 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/insight-users/attachments/20050726/5053ef6a/wrap_itkSample.cxx


More information about the Insight-users mailing list