hnccorr.postprocessor module

Postprocesser component for selecting the best segmentation in HNCcorr.

class hnccorr.postprocessor.SizePostprocessor(min_size, max_size, pref_size)[source]

Bases: object

Selects the best segmentation based on the number of selected pixels.

Discards all segmentations that contain more pixels than _max_size or less pixels then _min_size. If no segmentations remains, no cell was found and None is returned. Otherwise the segmentation is returned that minimizes |sqrt(x) - sqrt(_pref_size)| where x is the number of pixels in the segmentation.

Variables
  • _min_size (int) – Lower bound for the cell size in pixels.

  • _max_size (int) – Upper bound for the cell size in pixels.

  • _pref_size (int) – Preferred cell size in pixels.

__init__(min_size, max_size, pref_size)[source]

Initializes a SizePostprocessor object.

_filter(segmentations)[source]

Returns a list of segmentations with size between min_size and max_size.

select(segmentations)[source]

Selects the best segmentation based on the number of selected pixels.

See class description for details.

Parameters

segmentations (List[Segmentation]) – List of candidate segmentations.

Returns

Best segmentation or None if all are discarded.

Return type

Segmentation or None