Create an Image Region#

Synopsis#

This class holds an Index (the “bottom left” corner of a region) and a Size (the size of the region). These two items together completely describe a region.

Results#

Output::

ImageRegion (0x7fff45dad5c0) Dimension: 2 Index: [1, 1] Size: [3, 3]

Code#

C++#

#include "itkImageRegion.h"

int
main()
{
  constexpr unsigned int Dimension = 2;

  using RegionType = itk::ImageRegion<Dimension>;
  RegionType::SizeType size;
  size.Fill(3);

  RegionType::IndexType index;
  index.Fill(1);

  RegionType region(index, size);

  std::cout << region << std::endl;

  return EXIT_SUCCESS;
}

Python#

#!/usr/bin/env python

import itk

Dimension = 2

size = itk.Size[Dimension]()
size.Fill(3)

index = itk.Index[Dimension]()
index.Fill(1)

RegionType = itk.ImageRegion[Dimension]
region = RegionType()
region.SetIndex(index)
region.SetSize(size)

print(region)

Classes demonstrated#

template<unsigned int VImageDimension>
class ImageRegion : public itk::Region

An image region represents a structured region of data.

ImageRegion is an class that represents some structured portion or piece of an Image. The ImageRegion is represented with an index and a size in each of the n-dimensions of the image. (The index is the corner of the image, the size is the lengths of the image in each of the topological directions.)

See

Region

See

Index

See

Size

See

MeshRegion

ITK Sphinx Examples:

See itk::ImageRegion for additional documentation.