dcnum.segm.segmenter_sto

Classes

STOSegmenter

Segmenter with single thread operation

Module Contents

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

Bases: dcnum.segm.segmenter.Segmenter, abc.ABC

Segmenter with single thread operation

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

hardware_processor = 'gpu'

Required hardware (“cpu” or “gpu”) defined in first-level subclass.

segment_batch(images: numpy.ndarray, bg_off: numpy.ndarray | None = None)[source]

Perform batch segmentation of images

Before segmentation, an optional background offset correction with bg_off is performed. After segmentation, mask postprocessing is performed according to the class definition.

Parameters:
  • images (3d np.ndarray of shape (N, Y, X)) – The time-series image data. First axis is time.

  • bg_off (1D np.ndarray of length N) – Optional 1D numpy array with background offset

Notes

  • If the segmentation algorithm only accepts background-corrected images, then images must already be background-corrected, except for the optional bg_off.

segment_single(image, bg_off: float | None = None)[source]

This is a convenience-wrapper around segment_batch