ITK/Examples/Images/Size: Difference between revisions

From KitwarePublic
< ITK‎ | Examples
Jump to navigationJump to search
(Created page with "==Size.cxx== <source lang="cpp"> #include "itkSize.h" int main(int, char *[]) { itk::Size<2> size; // Method 1 size.Fill(0); /* // Method 2 size[0] = 1; size[1] ...")
 
mNo edit summary
Line 1: Line 1:
This class is used to represent the size of a region in an image.
==Size.cxx==
==Size.cxx==
<source lang="cpp">
<source lang="cpp">
Line 7: Line 9:
   itk::Size<2> size;
   itk::Size<2> size;


   // Method 1
   // Method 1 - set both components (size[0] and size[1]) to the same value (in this case, 0).
   size.Fill(0);
   size.Fill(0);
  std::cout << size << std::endl;


  /*
   // Method 2 - set each component separately.
   // Method 2
   size[0] = 1;
   size[0] = 1;
   size[1] = 2;
   size[1] = 2;
  */
 
   std::cout << size << std::endl;
   std::cout << size << std::endl;



Revision as of 13:52, 18 November 2010

This class is used to represent the size of a region in an image.

Size.cxx

<source lang="cpp">

  1. include "itkSize.h"

int main(int, char *[]) {

 itk::Size<2> size;
 // Method 1 - set both components (size[0] and size[1]) to the same value (in this case, 0).
 size.Fill(0);
 std::cout << size << std::endl;
 // Method 2 - set each component separately.
 size[0] = 1;
 size[1] = 2;
 std::cout << size << std::endl;
 return EXIT_SUCCESS;

}

</source>

CMakeLists.txt

<source lang="cmake"> cmake_minimum_required(VERSION 2.6)

PROJECT(Size)

FIND_PACKAGE(ITK REQUIRED) INCLUDE(${ITK_USE_FILE})

ADD_EXECUTABLE(Size Size.cxx) TARGET_LINK_LIBRARIES(Size ITKIO)

</source>