Project-MONAI / Project-MONAI/MONAI

CropForegroundd on ROI with text

Open
#8,988 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
8.7k
Forks
1.6k
Avg merge
5d 1h
Merged PRs (30d)
20

Description

Describe the bug

CropForegroundd works very well for mammography images that contain only the breast and background. However, some mammograms also contain foreground text or markers (e.g., laterality labels, acquisition text, scanner annotations). Since these annotations are non-zero pixels, they are detected as foreground by select_fn, causing the computed bounding box to include them and resulting in a larger crop than desired.

To Reproduce

input:

Image
import numpy as np
from monai.transforms import CropForegroundd

transform = CropForegroundd(
    keys=["image"],
    source_key="image",
)

output = transform({"image": input_array})
cropped = output["image"]
cropped = np.transpose(cropped, (1, 2, 0))

Output returns same as input with text label.

Expected behavior

Maybe only return the breast region.

Contributor guide

Open the 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.

Research direction

Start at the CropForegroundd transform entry point and reproduce the provided NumPy example with the mammogram containing text or markers. Determine how select_fn produces the foreground bounding box and clarify the intended rule for excluding annotations while retaining the breast region. Done means the behavior is covered by a regression test and the crop no longer expands to include the unwanted text.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
computer-vision
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.