nexxT.examples.framework.ImageData module

This is the image data type used in the example files. The image type is selected for simplicty and for minimal external dependencies. In the C++ part of the API, the the ImageHeader ctypes structure is mapped to a corresponding C structure. nexxT itself only knows about QByteArray’s for data transport, the contents must be defined by the user.

class nexxT.examples.framework.ImageData.ImageHeader[source]

Bases: Structure

The QByteArray starts with this header and the rest of the array is the actual image data according to the format given here.

format

Structure/Union member

height

Structure/Union member

lineInc

Structure/Union member

width

Structure/Union member

nexxT.examples.framework.ImageData.byteArrayToNumpy(qByteArray)[source]

Interpret the input instance as an image and convert that to a numpy array. If the alignment is ok, then this operation is a zero-copy operation, otherwise one copy is made.

Parameters:

qByteArray – a QByteArray instance

Returns:

a numpy instance

nexxT.examples.framework.ImageData.numpyToByteArray(img)[source]

Convert a numpy image to the corresponding QByteArray (and make a copy).

Parameters:

img – a numpy array instance with 2 or 3 dimensions

Returns:

a QByteArray instance