You are a computational pathologist. You have been given a digitized whole-slide image (WSI) of a sentinel lymph node biopsy from a breast cancer patient. Your task is to examine the tissue and identify all regions containing metastatic tumor cells. == CLINICAL CONTEXT == In breast cancer surgery, sentinel lymph nodes (the first lymph nodes draining the tumor) are biopsied and examined by pathologists for metastases. The presence and size of metastases determines the pathological N-stage, which directly impacts treatment decisions. Tumor deposits in lymph nodes appear as clusters of epithelial cancer cells that are morphologically distinct from the normal lymphoid tissue. They often show: - Irregular glandular or sheet-like architecture - Large, pleomorphic nuclei with prominent nucleoli - Increased nuclear-to-cytoplasmic ratio - Pale or eosinophilic cytoplasm - Sometimes desmoplastic stromal reaction Normal lymph node tissue contains lymphocytes (small, dark, round nuclei), germinal centers (pale zones with mixed cells), sinuses (open spaces with histiocytes), and fibrous capsule/trabeculae. == AVAILABLE TOOLS == The WSI is in TIFF format and is a multi-resolution image pyramid (gigapixel at full resolution). You CANNOT load the entire image into memory. Instead, use the OpenSlide Python library: pip install openslide-python Key API: import openslide slide = openslide.OpenSlide("input/slide.tif") slide.dimensions # (width, height) at level 0 slide.level_count # number of pyramid levels slide.level_dimensions # dimensions at each level slide.level_downsamples # downsample factor per level slide.read_region((x, y), level, (w, h)) # read a patch slide.get_thumbnail((w, h)) # low-res overview IMPORTANT: The location parameter in read_region is ALWAYS in level-0 (full resolution) coordinates, regardless of which level you read from. == INPUT FILES == input/slide.tif - The whole-slide image (TIFF, multi-resolution pyramid) input/slide_metadata.json - Metadata including: slide_id - Identifier for this slide tissue_type - "sentinel_lymph_node" stain - "H&E" microns_per_pixel - Physical pixel size at level 0 analysis_tile_size - Tile size in pixels for the analysis grid (256) analysis_level - Which pyramid level to use for grid definition (0) == YOUR TASK == 1. Open the slide and understand its structure (dimensions, levels, magnification) 2. Generate a low-resolution overview to see where tissue is located 3. Identify tissue-containing regions (distinguish tissue from empty glass background) 4. Systematically scan tissue regions, starting at low magnification and zooming into suspicious areas 5. Classify each analysis grid tile as tumor-positive or tumor-negative 6. The analysis grid divides the slide into non-overlapping tiles of size analysis_tile_size × analysis_tile_size pixels at level analysis_level (level 0). Grid tile (x, y) corresponds to the region starting at pixel (x * tile_size, y * tile_size). == REQUIRED OUTPUT == Write a single JSON file to output/predictions.json with the following structure: { "slide_id": "", "tumor_present": true or false, "tumor_tiles": [ {"x": , "y": }, ... ], "tumor_tile_count": , "total_tissue_tiles": , "tumor_area_fraction": } Where: - tumor_present: true if you identified any tumor tiles, false otherwise - tumor_tiles: list of (x, y) grid coordinates of tiles containing tumor - tumor_tile_count: length of tumor_tiles list - total_tissue_tiles: number of grid tiles containing tissue (not background) - tumor_area_fraction: tumor_tile_count / total_tissue_tiles == STRATEGY HINTS == - Start with a low-resolution overview (level 2 or 3) to identify tissue regions - Use intermediate resolution (level 1) to scan for suspicious areas - Zoom to full resolution (level 0) only to confirm tumor in specific tiles - Tissue vs. background: tissue is pink/purple, background is white. A simple approach is Otsu thresholding on grayscale. - Do NOT try to read the entire slide at level 0 — it will crash. Work tile-by-tile.