Describe the bug
Two documented parameters in monai/apps/nuclick/transforms.py are accepted and stored but never used, so setting them has no effect.
1. SplitLabeld.min_area
Documented as "min_area: The smallest allowable object size.", assigned in __init__, and then never referenced again — __call__ uses mask_value, others_value and to_binary_mask, but nothing filters by area.
$ grep -rn "\.min_area\b" monai/
monai/apps/nuclick/transforms.py:157: self.min_area = min_area
That single line is the only occurrence in the package.
2. PostFilterLabeld.do_reconstruction
Documented as "do_reconstruction: Boolean Flag, Perform a morphological reconstruction of an image...", assigned in __init__, never read. __call__ runs
masks = self.post_processing(label, self.thresh, self.min_size, self.min_hole)
and post_processing does not accept the flag at all:
def post_processing(self, preds, thresh=0.33, min_size=10, min_hole=30):
masks = preds > thresh
for i in range(preds.shape[0]):
masks[i] = morphology.remove_small_objects(masks[i], min_size=min_size)
masks[i] = morphology.remove_small_holes(masks[i], area_threshold=min_hole)
return masks
so there is no morphological-reconstruction step anywhere in the class. nuc_points is likewise stored and unused, which is consistent with the reconstruction path (which is what would need the click points) never having been wired up.
To Reproduce
grep -rn "\.min_area\b" monai/ # 1 hit: the assignment
grep -rn "\.do_reconstruction\b" monai/ # 1 hit: the assignment
Expected behavior
Either the parameters take effect, or they are not offered.
Why I am filing this rather than sending a PR
Both plausible fixes involve a judgement call I would rather not make for you:
- implement them — filtering by
min_area, and adding a reconstruction branch using nuc_points — is writing new behaviour, and I do not know what the NuClick reference implementation expects here;
- remove them — accurate, but they are public keyword arguments on two transforms, so it is a breaking change that probably wants a deprecation cycle.
Happy to send a PR for whichever direction you prefer.
Environment
Verified against the current dev branch; the parameters are present and unused there.
Describe the bug
Two documented parameters in
monai/apps/nuclick/transforms.pyare accepted and stored but never used, so setting them has no effect.1.
SplitLabeld.min_areaDocumented as "min_area: The smallest allowable object size.", assigned in
__init__, and then never referenced again —__call__usesmask_value,others_valueandto_binary_mask, but nothing filters by area.That single line is the only occurrence in the package.
2.
PostFilterLabeld.do_reconstructionDocumented as "do_reconstruction: Boolean Flag, Perform a morphological reconstruction of an image...", assigned in
__init__, never read.__call__runsand
post_processingdoes not accept the flag at all:so there is no morphological-reconstruction step anywhere in the class.
nuc_pointsis likewise stored and unused, which is consistent with the reconstruction path (which is what would need the click points) never having been wired up.To Reproduce
Expected behavior
Either the parameters take effect, or they are not offered.
Why I am filing this rather than sending a PR
Both plausible fixes involve a judgement call I would rather not make for you:
min_area, and adding a reconstruction branch usingnuc_points— is writing new behaviour, and I do not know what the NuClick reference implementation expects here;Happy to send a PR for whichever direction you prefer.
Environment
Verified against the current
devbranch; the parameters are present and unused there.