atomscale.results.rheed_image.decode_mask_rle#

atomscale.results.rheed_image.decode_mask_rle(mask_rle: str | bytes, mask_height: int, mask_width: int) ndarray[tuple[Any, ...], dtype[_ScalarT]][source]

Decode a COCO RLE counts string into a binary segmentation mask.

Shared by every RHEED mask endpoint the SDK consumes (single-frame rheed/images/{id}/mask and per-frame rheed/images/{id}/frame_masks), which all return the same pycocotools frString format.

Parameters:
  • mask_rle (str | bytes) – COCO run-length-encoding counts string (pycocotools frString, column-major / Fortran order).

  • mask_height (int) – Mask height H in pixels.

  • mask_width (int) – Mask width W in pixels.

Returns:

An (H, W) uint8 array with values 0 or 1.

Return type:

(NDArray)