Utils

tat.utils.apply_colormap(image: numpy.ndarray, colormap=16) numpy.ndarray

Normalize array and apply colormap.

Parameters
  • image (numpy.ndarray) – The array to colorize.

  • colormap (cv2.COLORMAP) – The colormap to apply.

Returns

Colored array with the given colormap.

tat.utils.array2d_to_pixmap(array: numpy.ndarray, normalize=False, colormap: int = 16) PySide6.QtGui.QPixmap

Convert a 2D array (monochrome image) to a QPixmap

Parameters
  • array (numpy.ndarray) – The array to convert.

  • normalize (bool) – If True then apply colormap.

  • colormap – Colomap used if normalize is True

Returns

QPixmap containing the array.

tat.utils.array3d_to_pixmap(array: numpy.ndarray) PySide6.QtGui.QPixmap

Convert a 3D array (color image) to a QPixmap.

Parameters

array – The array to convert.

Returns

QPixmap containing the array.

tat.utils.create_cluster(layers: List[numpy.ndarray], normalized=False) Optional[numpy.ndarray]

Create a cluster array from a list of layers.

Parameters
  • layers – The layers to cluster.

  • normalized – If True, then normalize the resulting array.

Returns

A cluster with each layer on a centroid.

tat.utils.fit_to_frame(pixmap: PySide6.QtGui.QPixmap, frame: PySide6.QtCore.QSize) PySide6.QtGui.QPixmap
Parameters
  • pixmap – The QPixmap to resize.

  • frame – The frame within which the image should fit.

Returns

A pixmap fitting inside the given frame.