from __future__ import annotations from abc import ABC, abstractmethod from PIL import Image from src.schemas.segmentation import MaskResult class Segmenter(ABC): """Segments a detected finding given its bounding box (Stage 2).""" @abstractmethod def segment( self, image: Image.Image, bbox_normalized: list[int], finding_label: str, image_path: str, image_index: int, ) -> MaskResult: """Return a MaskResult for one finding on one image view. bbox_normalized: [y0, x0, y1, x1] in [0, 1000] space (matches BBox.box_2d). """