[Insight-developers] Link errors and itk::NumericTraits on Windows

Zachary Pincus zpincus at stanford.edu
Wed Apr 5 10:00:38 EDT 2006


> Any instantiation using an RGB pixel type must have included the  
> RGB pixel header, which should provide the NumericTraits  
> specializations for RGB pixel types.

This is unfortunately not the case, since my original problem was  
that we were getting link errors for instantiations using RGB pixel  
types. This means that the appropriate NumericTraits specializations  
were not getting pulled in, despite the fact that we had included the  
RGBPixel header as part of creating that template instantiation.

Digging a little deeper, it appears that *none* of the headers for  
compound pixel types which have NumericTraits specializations in  
separate itkNumericTraitsXXX.h headers include those headers.

By which I mean:
itkRGBPixel.h does not #include itkNumericTraitsRGBPixel.h
itkVector.h does not #include itkNumericTraitsVectorPixel.h
itkCovariantVector.h does not #include  
itkNumericTraitsCovariantVectorPixel.h
itkVariableLengthVector.h does not #include  
itkNumericTraitsVariableLengthVectorPixel.h
itkSymmetricSecondRankTensor.h does not #include  
itkNumericTraitsTensorPixel.h

So this is still a problem and it should be fixed. Fixes include:
(1) Make the above headers #include the correct numeric traits.
(2) Make the master NumericTraits header #include all subsidiary  
headers. (Brad didn't really like this, but I list it for completeness.)
(3) By convention, every time a user uses a compound pixel type, they  
will have to remember to also #include the correct NumericTraits, in  
case any of the filters they will use need such traits.

Right now the de facto "solution" is 3. I think 1 or 2 is better, and  
it seems that Brad thinks 1 is the way to go.

Should I go ahead and add fix (1) to the ITK CVS?

Zach


More information about the Insight-developers mailing list