ITK/Examples/VectorImages/VectorNeighborhoodIterator: Difference between revisions

From KitwarePublic
< ITK‎ | Examples
Jump to navigationJump to search
(Created page with "==NeighborhoodIterator.cxx== <source lang="cpp"> #include "itkVectorImage.h" #include "itkNeighborhoodIterator.h" typedef itk::VectorImage<unsigned char, 2> VectorImageType; ...")
 
(Deprecated content that is moved to sphinxe)
 
(4 intermediate revisions by one other user not shown)
Line 1: Line 1:
==NeighborhoodIterator.cxx==
{{warning|1=The media wiki content on this page is no longer maintained. The examples presented on the https://itk.org/Wiki/* pages likely require ITK version 4.13 or earlier releases.   In many cases, the examples on this page no longer conform to the best practices for modern ITK versions.
<source lang="cpp">
}}
#include "itkVectorImage.h"
#include "itkNeighborhoodIterator.h"
 
typedef itk::VectorImage<unsigned char, 2>  VectorImageType;
int main(int, char*[])
{
  // Create an image
  VectorImageType::Pointer image = VectorImageType::New();
  itk::Index<2> start;
  start.Fill(0);
 
  itk::Size<2> size;
  size.Fill(10);
  itk::ImageRegion<2> region(start,size);
  image->SetRegions(region);
  image->SetNumberOfComponentsPerPixel(3);
  image->Allocate();
 
  // Create the neighborhood iterator
  VectorImageType::SizeType radius;
  radius[0] = 1;
  radius[1] = 1;
   
   itk::NeighborhoodIterator<VectorImageType> iterator(radius, image, image->GetLargestPossibleRegion());
 
  while(!iterator.IsAtEnd())
    {
    iterator.GetCenterPixel();
    ++iterator;
    }
  return EXIT_SUCCESS;
}
</source>
 
{{ITKVTKCMakeLists|NeighborhoodIterator|}}

Latest revision as of 22:09, 5 June 2019

Warning: The media wiki content on this page is no longer maintained. The examples presented on the https://itk.org/Wiki/* pages likely require ITK version 4.13 or earlier releases. In many cases, the examples on this page no longer conform to the best practices for modern ITK versions.