[Insight-users] data type limits

Karthik Krishnan karthik.krishnan at kitware.com
Tue Nov 3 02:55:12 EST 2009


On Mon, Nov 2, 2009 at 10:41 PM, Darren Weber
<darren.weber.lists at gmail.com>wrote:

>
> 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?
>

Yes. It extends the numeric limits provided by STL to provide traits used
by several filters in ITK.


>
> 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
>>
>
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20091103/027a041a/attachment.htm>


More information about the Insight-users mailing list