from_label_map#

static rlemasklib.RLEMask.from_label_map(label_map)[source]#

Convert a label map to a dict of RLEMasks.

This is the inverse of merge_to_label_map().

Label 0 is treated as background and not included in the output. Labels 1-255 become individual RLEMasks.

Parameters:

label_map (ndarray) – A 2D numpy array with integer labels 0-255.

Returns:

A dict mapping label values (1-255) to RLEMask objects. Only labels that appear in the input are included.

Return type:

dict[int, RLEMask]