Plane or ImagePlane what is the difference?

Hi,

I’d like to give an answer to a question I repeatedly got and I failed to find a useful written answer.
Among the classes in the :cvb: wrappers there are two classes that can easily be mixed up - to be fair they may not have the best names to distinguish them. So let me characterize those objects here.

ImagePlane

An ImagePlane defines a two dimensional data set that is part of an image. It cannot exist without an image object. Images consist of one or more ImagePlanes that all have the same dimension (width and height) but may have different data types. The memory described by an ImagePlane may be scattered, that means that ImagePlanes support variable x and y increments. Typical examples for ImagePlanes are the red, green and blue channels of RGB image. ImagePlanes do not own the memory they describe - the parent image of the plane does.

Plane

A Plane is hyperplane that my have 1 to N dimensions (ranks). Planes must have linear memory layout with constant increments for each dimension. If not explicitly created as views, Planes always own the memory they describe. Typical examples for Planes are the X, Y and Z components of a point cloud.

Q & A

Can every ImagePlane be represented as Plane?

Not generally. Planes only support contiguous and linear memory layouts, wherease ImagePlanes may have variable increments. However, variable increments are rarely required and therefore most ImagePlanes can effectively be represented as Planes. If you copy the ImagePlane into linear memory first, then it can always be represented as Plane.

Can every Plane be represented as ImagePlane?

Not generally. ImagePlanes must be 2D entities, whereas Planes can by hyper planes or even one dimensional data sets. One 3D Plane (rank=3) can be used for representing a RGB8 image with linear memory layout. Note that it is of course also possible to describe every color channel with an extra plane that could also be represented as ImagePlane. However, Planes do not require an extra object to describe their relation to each other. Such information must then be maintained by the user.

2 Likes