isolate_object#
- isolate_object(region, i, s=None)[source]#
Given an image containing labels, removes all labels except the specified one.
- Parameters:
region (ndarray) – An image containing labelled regions, as returned by
scipy.ndimage.label
.i (int) – The integer value
s (tuple of slice objects, optional) – If provided, then a subsection of
region
will be extracted and the function will be applied to this subsection only.
- Returns:
label – An ndarray the same size as
region
containing only the objects with the given valuei
. Ifs
is provided, the returned image will be a subsection ofregion
.- Return type:
ndarray
Examples
Click here to view online example.