[Insight-users] Compilation problem with MaskImageFilter used with VectorImage

Thomas Feuvrier thomas.feuvrier at c-s.fr
Tue May 19 04:40:42 EDT 2009


Hello,

I am using the itk library, and I wanted to use the filter named 
"itkMaskImageFilter".
But I encountered a problem when I tried to template this filter with a 
VectorImage (VariableLengthVector<double>),
indeed my program was not able to compile any more.
By contrast, templating with a simple Image worked properly.

Here is the error log :

/home2/guillaume/ORFEO/OTB/Utilities/ITK/Code/BasicFilters/itkMaskImageFilter.h:61: 
error: invalid conversion from ‘const itk::VariableLengthVector<double> 
(*)(const itk::VariableLengthVector<double>&)’ to ‘unsigned int’
/home2/guillaume/ORFEO/OTB/Utilities/ITK/Code/BasicFilters/itkMaskImageFilter.h:61: 
error: initializing argument 1 of 
‘itk::VariableLengthVector<TValueType>::VariableLengthVector(unsigned 
int) [with TValueType = double]’

When I read the code of MaskImageFilter and at the line 61 :

00055 template< class TInput, class TMask, class TOutput=TInput >
00056 class MaskInput
00057 {
00058 public:
00059 typedef typename NumericTraits< TInput >::AccumulateType 
http://www.orfeo-toolbox.org/doxygen-current/classitk_1_1NumericTraits.html#cfb2707f3c4e7aaceb8421b2d8347bb7 
AccumulatorType;
00060 00061 MaskInput(): m_OutsideValue(NumericTraits< TOutput >::Zero) {};

I can see that the initialisation of the variable (m_OutsideValue) using 
NumericTraits seems to be the source of my problem.
The NumericTraits< TOutput >::Zero returns an unsigned int and not a 
VariableLengthVector. Then, if I try to delete the initialization of 
this variable my program can compile.

Do you think, there is a bug with the initialization ?

Thank you by advance.

Guillaume Borrut



More information about the Insight-users mailing list