ITK
5.4.0
Insight Toolkit
SphinxExamples/src/Core/Common/NeighborhoodIteratorOnVectorImage/Code.cxx
/*=========================================================================
*
* Copyright NumFOCUS
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
#include "
itkVectorImage.h
"
#include "
itkNeighborhoodIterator.h
"
using
VectorImageType =
itk::VectorImage<unsigned char, 2>
;
int
main()
{
// Create an image
auto
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;
}
itk::Index
Represent a n-dimensional index in a n-dimensional image.
Definition:
itkIndex.h:70
itk::Size< 2 >
itkNeighborhoodIterator.h
itk::ConstNeighborhoodIterator::GetCenterPixel
PixelType GetCenterPixel() const
Definition:
itkConstNeighborhoodIterator.h:162
itk::ImageRegion
An image region represents a structured region of data.
Definition:
itkImageRegion.h:69
itk::VectorImage
Templated n-dimensional vector image class.
Definition:
itkImageAlgorithm.h:29
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition:
itkGTestTypedefsAndConstructors.h:49
itk::Index::Fill
void Fill(IndexValueType value)
Definition:
itkIndex.h:274
itk::Size::Fill
void Fill(SizeValueType value)
Definition:
itkSize.h:213
itkVectorImage.h
itk::NeighborhoodIterator
Defines iteration of a local N-dimensional neighborhood of pixels across an itk::Image.
Definition:
itkNeighborhoodIterator.h:212
New
static Pointer New()
Generated on
unknown
for ITK by
1.8.16