[Insight-users] data type limits

Darren Weber darren.weber.lists at gmail.com
Mon Nov 2 22:41:21 EST 2009


Hi Dan,

Yes, that's it, thanks, Dan!

Can anyone explain the pros/cons of NumericTraits vs.
http://www.cplusplus.com/reference/std/limits/numeric_limits/

Does NumericTraits provide additional functionality specific to image
processing?

TIA,
Darren



On Mon, Nov 2, 2009 at 7:32 PM, Dan Mueller <dan.muel at gmail.com> wrote:

> Hi Darren,
>
> If I understand your question correctly, I believe you may be looking
> for itk::NumericTraits.
>
> You can use as follows:
>
> #include "itkNumericTraits.h"
>
> typedef unsigned char PixelType;
>
> std::cout << "max=" << itk::NumericTraits<PixelType>::max() << std::endl;
> std::cout << "min=" << itk::NumericTraits<PixelType>::min() << std::endl;
> std::cout << "zero=" << itk::NumericTraits<PixelType>::Zero << std::endl;
> std::cout << "one=" << itk::NumericTraits<PixelType>::One << std::endl;
> std::cout << "one=" << itk::NumericTraits<PixelType>::IsPositive( 42 )
> << std::endl;
> etc...
>
> Hope this helps.
>
> Cheers, Dan
>
> 2009/11/3 Darren Weber <darren.weber.lists at gmail.com>:
> >
> > Does ITK provide platform-independent constants for common data limits,
> to
> > supplement or replace limits.h?
> >
> > TIA,
> > Darren
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20091102/e92a81ff/attachment.htm>


More information about the Insight-users mailing list