isolate_object(region, i, s=None)[source]

Given an image containing labels, removes all labels except the specified one.

  • 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.


label – An ndarray the same size as region containing only the objects with the given value i. If s is provided, the returned image will be a subsection of region.

Return type: