Medical Image Standard¶
A standardized Python framework for medical image processing with GPU acceleration, built around PyTorch tensors.
Install¶
pip install medical-image-std
Quick Example¶
from medical_image import DicomImage, FebdsAlgorithm
# Load a mammogram
image = DicomImage("mammogram.dcm")
image.load()
# Run microcalcification detection
output = image.clone()
algo = FebdsAlgorithm(method="dog", device="cuda")
algo(image=image, output=output)
# Extract binary mask
mask = output.pixel_data.cpu().numpy()
Key Features¶
Unified API across DICOM, PNG, and in-memory images with lazy loading and automatic format handling.
Transparent device management with automatic inference, mixed precision, OOM fallback, and multi-GPU support.
Composable algorithm framework with 11 built-in implementations for segmentation, filtering, and enhancement.
PyTorch-compatible dataset classes for INbreast and CBIS-DDSM with lazy loading and on-the-fly transforms.
Architecture Overview¶
The framework is built around five core layers:
Data Layer — Abstract
Imageclass with concrete implementations for DICOM, PNG, and in-memory formats. All pixel data stored astorch.Tensor.Processing Layer — Stateless operations (filters, thresholds, morphology, metrics) applied via static methods on loaded images.
Algorithm Layer —
Algorithmbase class using the Template Method pattern. Algorithms compose processing operations into pipelines.Dataset Layer — PyTorch-compatible
BaseDatasetwith lazy sample loading and standard dict output.Utilities — Device management, precision control, GPU memory tools, and export helpers.
Image (DICOM / PNG / InMemory)
|
v
Processing (Filters, Threshold, Morphology)
|
v
Algorithm (FEBDS, FCM, DeepSeg, ...)
|
v
Output (binary mask + annotations)