ITK/Examples/Images/Size

From KitwarePublic
< ITK‎ | Examples
Revision as of 13:52, 18 November 2010 by Daviddoria (talk | contribs)
Jump to navigationJump to search

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>