ITK/Examples/SimpleOperations/PixelInsideRegion

From KitwarePublic

Jump to: navigation, search

PixelInsideRegion.cxx

#include "itkImageRegion.h"
#include "itkIndex.h"
#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;
}

CMakeLists.txt

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