Point, Size, Extent

This document describes some of the classes used in the :mod`~ost.img` module to describe image properties such as size, pixel coordinates and extents.


class Point(x=0, y=0, z=0)
class Point(vec)
class Point(size)
class Point(point)
  • x (int) – integral x coordinate

  • y (int) – integral y coordinate

  • z (int) – integral z coordinate

  • vec (Vec3, Vec4) – The vectors coordinates will be rounded to the next integral value. In case of a Vec4, the coordinates will be divided by the homogenous coordinate.

  • point (Initialize from point) –

This class represents an image pixel. It is defined using three integer numbers, corresponding to the pixel’s indexes along the width, height and depth dimensions respectively.


Read-write access to the coordinates.

..code-block:: python

p=img.Point(1,2,3) print(p) p[1]=5


Converts the point to a Vec3


Converts the point to a Vec2. The z coordinate of the point is ommitted.


Converts the point to a Vec4, with the homogenous coordinate set to 1.


class Size(width, height, depth)
class Size(width, height)

This property describes the size of an image. It is defined using three integer numbers: When depth is not specified, the size is assumed to refer to a 2D image two-dimensional (depth=1).

The Size class can be passed to the CreateImage() function to define the size of the image being created.

# uses the size class to create an image
# uses a temporary instance of the Size class


class Extent(first_point, last_point)
class Extent(first_point, size)
class Extent(size, center_point)

This class describes the extent of an image in pixels. The image extent is a rectangle in 2d and a cuboid in 3d, and can be defined in a number of ways: giving the first and the last point of the extent, specifying the first point and the size of the extent, or listing the size of the extent and its central point.

Some examples:

# defines a rectangular extent that goes from pixel (2,4) to pixel (5,10)
# defines the same extent using its first point and its size
# again the same extent using its size and central pixel

The Extent class can be passed to the CreateImage() function to create an image with a specific extent.

# uses the Extent class to create an image
# uses a temporary instance of the Extent class

Given an Extent, is it possible to recover its full size, and also the length of each of its dimensions separately.


# gets the size of an extent (e is a 3D extent)
# gets the three dimensions separately

When one needs to visit all the image pixels belonging to an Extent in sequence, one can use an ExtentIterator:

# defines an iterator over an extent e
# visits all the pixels in the extent and
# prints out their values
for pixel in ei:


Enter search terms or a module, class or function name.


Documentation is available for the following OpenStructure versions:

(Currently viewing dev) / 2.7 / 2.6 / 2.5 / 2.4 / 2.3.1 / 2.3 / 2.2 / 2.1 / 2.0 / 1.9 / 1.8 / 1.7.1 / 1.7 / 1.6 / 1.5 / 1.4 / 1.3 / 1.2 / 1.11 / 1.10 / 1.1

This documentation is still under heavy development!
If something is missing or if you need the C++ API description in doxygen style, check our old documentation for further information.