[Insight-users] data type limits

Darren Weber darren.weber.lists at gmail.com
Tue Nov 3 12:31:53 EST 2009


How do we learn to use itk::NumericTraits?  This does not appear in the ITK
Software Guide and the doxygen is not very helpful as a use guide.  There
are many examples and test progams that use NumericTraits, but wading
through them may not provide a concise conceptual overview of these tools
(in the absence of anything better, it will have to do).  A quick search on
the ITK wiki does not reveal a useful guide on this topic.

TIA,
Darren



On Mon, Nov 2, 2009 at 11:55 PM, Karthik Krishnan <
karthik.krishnan at kitware.com> wrote:

> 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/cd0006ff/attachment.htm>


More information about the Insight-users mailing list