ITK/Examples/SimpleOperations/Offset

From KitwarePublic

Jump to: navigation, search

Offset.cxx

#include "itkIndex.h"
#include "itkOffset.h"
 
#include <iostream>
 
int main(int argc, char *argv[])
{
  itk::Index<2> index;
  index[0] = 5;
  index[1] = 5;
 
  itk::Offset<2> offset;
  offset[0] = 1;
  offset[1] = 1;
 
  std::cout << offset << std::endl;
 
  std::cout << index + offset << std::endl;
 
  return EXIT_SUCCESS;
}

CMakeLists.txt

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