itkwasm.image_from_array#

Module Contents#

Functions#

image_from_array

Convert a numpy array-like to an itkwasm Image.

API#

itkwasm.image_from_array.image_from_array(arr, is_vector: bool = False, image_type: Optional[itkwasm.image.ImageType] = None) itkwasm.image.Image#

Convert a numpy array-like to an itkwasm Image.

Parameters:
  • arr (NumPy ndarray or array-like, e.g. dask.Array or cupy.ndarray) – Input n-d array

  • is_vector (bool) – Whether the array is a vector image. If True, then a 3D array will be treated as a 2D vector image, otherwise it will be treated as a 3D image.

  • image_type (ImageType) – Explicitly specify the Image type

Returns:

Output Image

Rtype :

Image where pixel data is a view of the input array and default metadata