Skip to content

CropForegroundd on ROI with text #8988

Description

@pure-rgb

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions