ITK/Examples/Images/Size

From KitwarePublic

Jump to: navigation, search

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

Size.cxx

#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;
}

CMakeLists.txt

cmake_minimum_required(VERSION 2.8)
 
project(Size)
 
find_package(ITK REQUIRED)
include(${ITK_USE_FILE})
 
add_executable(Size Size.cxx)
 
if( "${ITK_VERSION_MAJOR}" LESS 4 )
  target_link_libraries(Size ITKReview ${ITK_LIBRARIES})
else( "${ITK_VERSION_MAJOR}" LESS 4 )
  target_link_libraries(Size ${ITK_LIBRARIES})
endif( "${ITK_VERSION_MAJOR}" LESS 4 )
Personal tools