ITK/Examples/SimpleOperations/PixelInsideRegion

From KitwarePublic
< ITK‎ | Examples
Revision as of 21:20, 23 February 2011 by Daviddoria (talk | contribs) (Created page with "==PixelInsideRegion.cxx== <source lang="cpp"> #include "itkImageRegion.h" #include "itkIndex.h" #include "itkSize.h" int main(int, char *[]) { itk::Size<2> size; size.Fill(3...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

PixelInsideRegion.cxx

<source lang="cpp">

  1. include "itkImageRegion.h"
  2. include "itkIndex.h"
  3. include "itkSize.h"

int main(int, char *[]) {

 itk::Size<2> size;
 size.Fill(3);
 itk::Index<2> start;
 start.Fill(0);
 typedef itk::ImageRegion<2> RegionType;
 RegionType region(start,size);
 itk::Index<2> testPixel1;
 testPixel1[0] = 1;
 testPixel1[1] = 1;
 itk::Index<2> testPixel2;
 testPixel2[0] = 6;
 testPixel2[1] = 6;
 std::cout << region.IsInside(testPixel1) << std::endl;
 std::cout << region.IsInside(testPixel2) << std::endl;
 return EXIT_SUCCESS;

}

</source>

CMakeLists.txt

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

PROJECT(PixelInsideRegion)

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

ADD_EXECUTABLE(PixelInsideRegion PixelInsideRegion.cxx) TARGET_LINK_LIBRARIES(PixelInsideRegion ITKIO) </source>