dcnum.segm.segm_thresh

Classes

SegmentThresh

Segmenter with multiprocessing operation

Module Contents

class dcnum.segm.segm_thresh.SegmentThresh(*, num_workers: int | None = None, kwargs_mask: dict | None = None, debug: bool = False, **kwargs)[source]

Bases: dcnum.segm.segmenter_mpo.MPOSegmenter

Segmenter with multiprocessing operation

Parameters:
  • num_workers – Number of workers (processes) to spawn

  • kwargs_mask (dict) – Keyword arguments for mask post-processing (see process_labels)

  • debug (bool) – Debugging parameters

  • kwargs – Additional, optional keyword arguments for segment_algorithm defined in the subclass.

mask_postprocessing = True

Whether to enable mask post-processing. If disabled, you should make sure that your mask is properly defined and cleaned or you have to call process_labels in your segment_algorithm implementation.

mask_default_kwargs

Default keyword arguments for mask post-processing. See process_labels for available options.

requires_background_correction = True

Whether the segmenter requires a background-corrected image

static segment_algorithm(image, *, thresh: float = -6)[source]

Mask retrieval using basic thresholding

Parameters:
  • image (2d ndarray) – Background-corrected frame image

  • thresh (float) – Threshold value for creation of binary mask; a negative value means that pixels darker than the background define the threshold level.

Returns:

mask – Mask image for the given index

Return type:

2d boolean ndarray