From DICOM to model input

Six steps turn a DICOM mammogram into a 1024 × 1024 × 3 image. Pick a step to see what it does.

Lesion Breast crop

Windowing: from 14 bits to 256 grey levels

A window (centre, width) decides which DICOM values are visible. The preprocessing uses breast_tissue: the 25th–95th percentiles of pixels > 0, with the width × 1.5. Try other methods or move the window by hand.

DICOM LINEAR VOI function. The band in the histogram is the window: anything to its left becomes black and anything to its right becomes white.

How the breast is found

detect_breast_roi builds a mask and extracts its bounding rectangle. A 31 px circle fills the holes in fatty tissue (closing) and removes text and markers (opening). Change the circle size to see why 31 was chosen.

Filled by closing Removed by opening

Boxes follow the image

The preprocessing returns a transform dictionary recording each geometric step. With it, transform_boxes maps annotations onto the model image and inverse_transform_boxes maps predictions back to the DICOM, losslessly.

Original DICOM with the lesion
DICOM
Model input with the lesion
Model
image, transform = preprocess_mammogram(path) gt = transform_boxes(gt_boxes, transform) pred = inverse_transform_boxes(predictions, transform)