[Insight-users] data type limits

Luis Ibanez luis.ibanez at kitware.com
Sat Nov 7 11:19:23 EST 2009


Hi Darren,

The use of NumericTraits is one of the many ITKdevelopment
aspects for which we have a void of documentation.

Most ITK developers have learned to use the itk::NumericTraits<>
by following examples from pre-existing classes.

We will be happy to help clarify their use if you are finding then
to be confusing.

Also, we probably should collect this information
in a page of the:

        http://www.itk.org/Wiki/ITK_InsightClopedia


       Regards,


              Luis


---------------------------------------
On Tue, Nov 3, 2009 at 12:31 PM, Darren Weber
<darren.weber.lists at gmail.com> wrote:
>
> 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
>>>
>>
>>
>>
>
>
> _____________________________________
> 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
>
>


More information about the Insight-users mailing list