mitk.make_pixel_type

mitk.make_pixel_type#

mitk.make_pixel_type(dtype: object, components: SupportsInt = 1) mitk.PixelType#

Construct a PixelType from a NumPy dtype.

Parameters:
  • dtype – NumPy dtype or any value accepted by numpy.dtype() (string names like "float32", scalar types like numpy.float32, or an existing dtype object).

  • components – Number of components per pixel. Defaults to 1.

Returns:

A PixelType matching the requested layout.

Raises:

mitk.Exception – If the dtype is not supported by MITK.

Examples

>>> pt = mitk.make_pixel_type("float32")
>>> rgba = mitk.make_pixel_type("uint8", components=4)