hnccorr.postprocessor module¶
Postprocesser component for selecting the best segmentation in HNCcorr.
-
class
hnccorr.postprocessor.SizePostprocessor(min_size, max_size, pref_size)[source]¶ Bases:
objectSelects the best segmentation based on the number of selected pixels.
Discards all segmentations that contain more pixels than
_max_sizeor less pixels then_min_size. If no segmentations remains, no cell was found andNoneis 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.
-
_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