ITK/Examples/Images/Index

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

This class is used to represent a location in an Image.

Index.cxx

<source lang="cpp">

  1. include "itkIndex.h"

int main(int, char *[]) {

 itk::Index<2> index;
 // Method 1 - set both index[0] and index[1] to the same value (in this case, 0).
 index.Fill(0);
 std::cout << index << std::endl;
 // Method 2 - set each component of the index individually.
 index[0] = 1;
 index[1] = 2;
 std::cout << index << std::endl;
 return EXIT_SUCCESS;

}

</source>

CMakeLists.txt

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

PROJECT(Index)

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

ADD_EXECUTABLE(Index Index.cxx) TARGET_LINK_LIBRARIES(Index ITKIO)

</source>