darsia.Masks#

class Masks(labels, return_label=False)[source]#

Bases: object

Iterable object converting a label imaged to masks.

Constructor.

Parameters:
labelsImage

Labeled image.

return_labelbool

Flag controlling whether iterator also returns labels.

Methods

mask_for_label(label)

Boolean mask for label (precomputed at construction, read-only).

Attributes

size

Return routine for total number of labels.

labels

Label image.

unique_labels

Labels.

num_labels

Number of labels.

mask_for_label(label)[source]#

Boolean mask for label (precomputed at construction, read-only).

Parameters:
labelint

A value from unique_labels.

Returns:
np.ndarray

Boolean mask selecting the pixels belonging to label.

labels#

Label image.

num_labels#

Number of labels.

property size#

Return routine for total number of labels.

Returns:
int

Number of labels.

unique_labels#

Labels.