Create A 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(int, char *[])
{
  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