grains.analysis.label_image_apply_mask¶
-
grains.analysis.
label_image_apply_mask
(label_image, mask, value)[source]¶ Changes parts of a labeled image to a given value.
Convenience function, equivalent to
label_image[mask] = value
but the original arraylabel_image
is not overwritten.- Parameters
label_image (ndarray) – Labeled input image, represented as a 2D numpy array of positive integers.
mask (ndarray) – Boolean array of the same size as
label_image
, marking the pixels that will be replaced byvalue
.value (int) – The masked pixels are replaced by this value.
- Returns
ndarray – Copy of the input image, its selected pixels being replaced by the given value.