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

Zachary Pincus zpincus at stanford.edu
Fri Apr 21 16:51:46 EDT 2006


> Some of our programs using ITK need to know the minimum/maximum  
> pixel values. Before your implementation we defined our own  
> NumericTraits for RGBPixel with max() of RGBPixel<unsigned char>  
> being the max of unsigned char, etc...
> With the current implementation of numeric traits for RGBPixel,  
> there is no way to know the maximum of the pixel type. One option  
> is to add the min() and max() functions returning the min and max  
> of the actual type (i.e unsigned char/unsigned short), but I don't  
> know if it's correct though. I'm open to suggestions here.

I'm not really sure what is best here either. I am definitely sure  
that the pixel classes need to #include the numeric traits  
specializations, so then the question becomes:
(1) Should ITK's default numeric traits for compound pixel types  
define min() and max(), and if so, should they return that pixel type  
filled with the min/max underlying value, or should they return the  
min/max underlying value?
or
(2) Should code that needs things like this not use NumericTraits,  
but have its own specializations like  
JulienNumericTraits<RGBPixel<...> >

I hope I haven't messed up anything too badly for you with these  
changes... but I also hope you agree that the changes were necessary  
in the general case.

> Also, do you plan to add RGBA pixel traits too?

I guess those ought to exist too. I had limited my changes to the  
minimum needed to prevent nasty link errors with the current traits.  
I've never done anything with the RGBAPixel class, but I assume a  
traits class should be pretty simple to make by analogy with the  
RGBPixel traits...

Zach



>
> Thanks,
>
> Julien
>
> Zachary Pincus wrote:
>> I have filed a bug on these problems, committed the changes to the  
>> CVS, and closed the bug.
>> Files changed to have the stanza suggested by Karthik (below) at  
>> the bottom:
>> Insight/Insight/Code/Common/itkCovariantVector.h
>> Insight/Insight/Code/Common/itkRGBPixel.h
>> Insight/Insight/Code/Common/itkSymmetricSecondRankTensor.h
>> Insight/Insight/Code/Common/itkVariableLengthVector.h
>> Insight/Insight/Code/Common/itkVector.h
>> Zach
>> On Apr 6, 2006, at 1:19 PM, Karthik Krishnan wrote:
>>> Pixel.h:
>>>  class Pixel{  ... };
>>>  #include "itkNumericTraitsVariableLengthVectorPixel.h"
>>>  #ifndef ITK_MANUAL_INSTANTIATION
>>>  #include "itkVariableLengthVector.txx"
>>>  #endif
>> _______________________________________________
>> Insight-developers mailing list
>> Insight-developers at itk.org
>> http://www.itk.org/mailman/listinfo/insight-developers
>
> _______________________________________________
> Insight-developers mailing list
> Insight-developers at itk.org
> http://www.itk.org/mailman/listinfo/insight-developers



More information about the Insight-developers mailing list