ITK/Examples/SimpleOperations/NumericTraits: Difference between revisions

From KitwarePublic
< ITK‎ | Examples
Jump to navigationJump to search
(Created page with "==NumericTraits.cxx== <source lang="cpp"> #include "itkNumericTraits.h" int main(int, char* [] ) { std::cout << "Min: " << itk::NumericTraits< float >::min() << std::endl; s...")
 
(Deprecated content that is moved to sphinx)
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
==NumericTraits.cxx==
{{warning|1=The media wiki content on this page is no longer maintained.  The examples presented on the https://itk.org/Wiki/*  pages likely require ITK version 4.13 or earlier releases.  In many cases, the examples on this page no longer conform to the best practices for modern ITK versions.
<source lang="cpp">
}}
#include "itkNumericTraits.h"


int main(int, char* [] )
[https://itk.org/ITKExamples[ITK Sphinx Examples]]
{
  std::cout << "Min: " << itk::NumericTraits< float >::min() << std::endl;
  std::cout << "Max: " << itk::NumericTraits< float >::max() << std::endl;
  std::cout << "Zero: " << itk::NumericTraits< float >::Zero << std::endl;
  std::cout << "Zero: " << itk::NumericTraits< float >::ZeroValue() << std::endl;
  std::cout << "Is -1 negative? " << itk::NumericTraits< float >::IsNegative(-1) << std::endl;
  std::cout << "Is 1 negative? " << itk::NumericTraits< float >::IsNegative(1) << std::endl;
  std::cout << "One: " << itk::NumericTraits< float >::One << std::endl;
  std::cout << "Epsilon: " << itk::NumericTraits< float >::epsilon() << std::endl;
  std::cout << "Infinity: " << itk::NumericTraits< float >::infinity() << std::endl;
 
  if(0 == itk::NumericTraits< float >::infinity())
    {
    std::cout << " 0 == inf!" << std::endl;
    }
  else
    {
    std::cout << "Good" << std::endl;
    }
   
  return EXIT_SUCCESS;
}
</source>
 
==CMakeLists.txt==
<source lang="cmake">
cmake_minimum_required(VERSION 2.6)
 
PROJECT(NumericTraits)
 
FIND_PACKAGE(ITK REQUIRED)
INCLUDE(${ITK_USE_FILE})
 
ADD_EXECUTABLE(NumericTraits NumericTraits.cxx)
TARGET_LINK_LIBRARIES(NumericTraits
ITKBasicFilters ITKCommon ITKIO ITKStatistics)
 
</source>

Latest revision as of 19:33, 30 May 2019

Warning: The media wiki content on this page is no longer maintained. The examples presented on the https://itk.org/Wiki/* pages likely require ITK version 4.13 or earlier releases. In many cases, the examples on this page no longer conform to the best practices for modern ITK versions.

[ITK Sphinx Examples]