Guard clean_bw against the scikit-image remove_small_objects change before lifting the <0.25 pin

Open Beginner friendly
#446 3 comments 0 reactions 0 assignees View on GitHub

@riyagoyal01 is already working on this.

Since Nov 23, 2026.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python

Research direction

Start with the morphology.remove_small_objects call in process.py:112 and inspect the surrounding clean_bw implementation. Add a regression test using objects of 11, 12, and 13 pixels, then replace the version-sensitive removal call with an explicit area filter that keeps objects with area greater than or equal to minimum_area.

Written by the indexing model from the issue text.

Description

patch / enhancement testing

pyopia.process.clean_bw removes small objects with
morphology.remove_small_objects(imbw > 0, min_size=minimum_area) (process.py:112).

On the pinned scikit-image 0.24 this keeps objects of at least minimum_area pixels. With
minimum_area=12, objects of 11, 12 and 13 pixels leave the 12 and 13 pixel objects.

Reported on scikit-image 0.26.0 (not reproduced here): min_size is deprecated in favour of
max_size, which removes objects smaller than or equal to the given size. On the same max-map image and
threshold, 0.24.0 gives 116 particles and 0.26.0 gives 110; min_size=11 on 0.26.0 gives 116.

The pin (scikit-image>=0.24.0,<0.25) means we are unaffected today, but particle counts would change
silently when it is lifted.

Suggested:

  • add a regression test that pins the keep-at-least-minimum_area behaviour (an image with 11, 12 and 13
    pixel objects, expect the 12 and 13 pixel objects to remain)
  • replace the call with an explicit area filter (label the image and keep objects with area >= minimum_area),
    so the result does not depend on the scikit-image version
Dominant language
Jupyter Notebook
Stars
19
Forks
7
Avg merge
10d 11h
Merged PRs (30d)
1

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from SINTEF/pyopia

All issues in SINTEF/pyopia

Similar issues

More Computer Vision issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.