diff --git a/CHANGELOG b/CHANGELOG index 30b5a4b..605c23c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +0.20.2 + - ref: remove __init__ from SegmentThresh 0.20.1 - fix: relative basin locations not written correctly - enh: increase deque size threshold for waiting for writer diff --git a/src/dcnum/logic/ctrl.py b/src/dcnum/logic/ctrl.py index a2a77a2..09fd36e 100644 --- a/src/dcnum/logic/ctrl.py +++ b/src/dcnum/logic/ctrl.py @@ -666,7 +666,6 @@ def task_segment_extract(self): num_extractors = max(1, num_extractors) num_segmenters = max(1, num_segmenters) self.job.kwargs["segmenter_kwargs"]["num_workers"] = num_segmenters - slot_chunks = mp_spawn.Array("i", num_slots) slot_states = mp_spawn.Array("u", num_slots) diff --git a/src/dcnum/segm/segm_thresh.py b/src/dcnum/segm/segm_thresh.py index dc3837e..6c8963b 100644 --- a/src/dcnum/segm/segm_thresh.py +++ b/src/dcnum/segm/segm_thresh.py @@ -10,18 +10,6 @@ class SegmentThresh(CPUSegmenter): } requires_background_correction = True - def __init__(self, thresh=-6, *args, **kwargs): - """Simple image thresholding segmentation - - Parameters - ---------- - thresh: int - grayscale threshold value for creating the mask image; - For a background-corrected image, pixels with values below - this value are considered to be part of the mask. - """ - super(SegmentThresh, self).__init__(thresh=thresh, *args, **kwargs) - @staticmethod def segment_approach(image, *, thresh: float = -6): diff --git a/tests/test_meta_ppid_segm.py b/tests/test_meta_ppid_segm.py index 96fe437..8b7aa37 100644 --- a/tests/test_meta_ppid_segm.py +++ b/tests/test_meta_ppid_segm.py @@ -1,3 +1,4 @@ +from dcnum.meta import ppid from dcnum import segm import pytest @@ -26,6 +27,22 @@ def test_ppid_decoding_thresh_check_kwargs(): assert kwargs["kwargs_mask"]["closing_disk"] == 3 +def test_ppid_kwargs_to_ppid(): + """Make sure that subclasses correctly implement __init__ (if they do)""" + segm_dict = segm.get_available_segmenters() + for segm_key in segm_dict: + segm_cls = segm_dict[segm_key] + inst = segm_cls() + kwargs = inst.kwargs + kwargs["num_workers"] = 2 + ppid.kwargs_to_ppid( + cls=segm_cls, + method="segment_approach", + kwargs=kwargs, + allow_invalid_keys=False, + ) + + @pytest.mark.parametrize("segm_code", segm.get_available_segmenters().keys()) def test_ppid_required_method_definitions(segm_code): segm_class = segm.get_available_segmenters()[segm_code]