ITK/Examples/Images/Index: Difference between revisions
From KitwarePublic
Jump to navigationJump to search
Daviddoria (talk | contribs) (Created page with "==Index.cxx== <source lang="cpp"> #include "itkIndex.h" int main(int, char *[]) { itk::Index<2> index; // Method 1 index.Fill(0); /* // Method 2 index[0] = 1; in...") |
Daviddoria (talk | contribs) mNo edit summary |
||
Line 1: | Line 1: | ||
This class is used to represent a location in an Image. | |||
==Index.cxx== | ==Index.cxx== | ||
<source lang="cpp"> | <source lang="cpp"> | ||
Line 7: | Line 9: | ||
itk::Index<2> index; | itk::Index<2> index; | ||
// Method 1 | // Method 1 - set both index[0] and index[1] to the same value (in this case, 0). | ||
index.Fill(0); | index.Fill(0); | ||
std::cout << index << std::endl; | |||
// Method 2 - set each component of the index individually. | |||
// Method 2 | |||
index[0] = 1; | index[0] = 1; | ||
index[1] = 2; | index[1] = 2; | ||
std::cout << index << std::endl; | std::cout << index << std::endl; |
Revision as of 13:51, 18 November 2010
This class is used to represent a location in an Image.
Index.cxx
<source lang="cpp">
- 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>