Performs a thinning operation on a label image to remove thin
protrusions from objects that are in contact with the background. Applies a
distance transform and sequentially removes pixels with small distances to
background that are not connected to higher distance pixels.
Parameters:
im_label (array_like) – A labeled segmentation mask
compaction (int) – Factor used in compacting objects to remove thin protrusions. Referred
to as d in the reference below. Default value = 3.
Notes
Implemented from the reference below.
Returns:
im_compact – A labeled segmentation mask with thin protrusions removed.
Computes a label mask highlighting a ring-like neighborhood of each
object or region in a given label mask
Parameters:
im_label (array_like) – A labeled mask image wherein intensity of a pixel is the ID of the
object it belongs to. Non-zero values are considered to be foreground
objects.
neigh_width (float, optional) – The width of the ring-like neighborhood around each object.
Returns:
im_neigh_label – A labeled mask image highlighting pixels in a ring-like neighborhood of
width upto neigh_width around each object in the given label mask.
The intensity of each pixel in the ring-like neighborhood is set
equal to the label of the closest object in the given label mask.
other pixels (including the ones inside objects) are set to zero.
nuclei_list (list): List of dictionaries with ‘points’ for polygons.
nuclei_format (str, optional): Output format (‘polygon’ or ‘bbox’).
return_selected (bool, optional): Return indices of selected nuclei (default: False).
Performs exterior boundary tracing of one or more objects in a label
mask. If a starting point is not provided then a raster scan will be performed
to identify the starting pixel.
Parameters:
im_label (array_like) – A binary mask image.
conn (int) – Neighborhood connectivity to evaluate. Valid values are 4 or 8.
Default value = 4.
trace_all (bool) – Specify True if you want to trace boundaries of all objects.
Default = False
x_start (int) – Starting horizontal coordinate to begin tracing. Default value = None.
y_start (int) – Starting vertical coordinate to begin tracing. Default value = None.
max_length (int) – Maximum boundary length to trace before terminating. Default value =
None.
simplify_colinear_spurs (bool) – If True colinear streaks/spurs in the object boundary will be
simplified/removed. Note that if the object boundary is entirely
colinear then the object itself will be removed. Default = True
eps_colinear_area (int) – Minimum area of triangle formed by three consecutive points on the
contour for them to be considered as non-colinear. Default value =
0.01.
Notes
The Improved Simple Boundary Follower (ISBF) from the reference below is
used for 4-connected tracing. This algorithm provides accurate tracing with
competitive execution times. 8-connected tracing is implemented using the
Moore tracing algorithm.
Returns:
X (array_like) – A set of 1D array of horizontal coordinates of contour seed pixels for
tracing.
Y (array_like) – A set of 1D array of the vertical coordinates of seed pixels for
tracing.
Removes thin objects from label image using maximum of distance
transform values within each object.
Parameters:
im_label (array_like) – A uint32 type label image generated by segmentation methods.
width (int) – width threshold for objects. Objects with fewer than ‘Area’ pixels will
be zeroed to merge with background.
Notes
Objects are assumed to have positive nonzero values. A binary mask is
generated for each object setting all other objects to the background value
(0). The maximum chamfered distance transform value of this mask is used
to represent the object width.
Returns:
im_thinned – A uint32 label where objects with pixels < Area are removed.