dcnum.segm.segm_torch.segm_torch_base
Classes
Base segmenter class |
Module Contents
- class dcnum.segm.segm_torch.segm_torch_base.TorchSegmenterBase(*, kwargs_mask: dict | None = None, debug: bool = False, **kwargs)[source]
Bases:
dcnum.segm.segmenter.SegmenterBase segmenter class
This is the base segmenter class for the multiprocessing operation segmenter
segmenter_mpo.MPOSegmenter(multiple subprocesses are spawned and each of them works on a queue of images) and the single-threaded operation segmentersegmenter_sto.STOSegmenter(e.g. for batch segmentation on a GPU).- Parameters:
kwargs_mask (dict) – Keyword arguments for mask post-processing (see process_labels)
debug (bool) – Enable debugging mode (e.g. CPU segmenter runs in one thread)
kwargs – Additional, optional keyword arguments for segment_batch.
- requires_background_correction = False
Whether the segmenter requires a background-corrected image
- 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_algorithmimplementation.
- mask_default_kwargs
Default keyword arguments for mask post-processing. See process_labels for available options.
- classmethod get_ppid_from_ppkw(kwargs, kwargs_mask=None)[source]
Return the pipeline ID from given keyword arguments
See also
get_ppidSame method for class instances
- classmethod validate_applicability(segmenter_kwargs: dict, meta: dict | None = None, logs: dict | None = None)[source]
Validate the applicability of this segmenter for a dataset
The applicability is defined by the metadata in the segmentation model.
- Parameters:
segmenter_kwargs (dict) – Keyword arguments for the segmenter
meta (dict) –
- Dictionary of metadata from an
hdf5_data.HDF5Data instance
- Dictionary of metadata from an
logs (dict) – Dictionary of logs from an
hdf5_data.HDF5Datainstance
- Returns:
applicable – True if the segmenter is applicable to the dataset
- Return type:
bool
- Raises:
SegmenterNotApplicable – If the segmenter is not applicable to the dataset