Medical Image Standard

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

Image Abstractions

Unified API across DICOM, PNG, and in-memory images with lazy loading and automatic format handling.

GPU Acceleration

Transparent device management with automatic inference, mixed precision, OOM fallback, and multi-GPU support.

Extensible Algorithms

Composable algorithm framework with 11 built-in implementations for segmentation, filtering, and enhancement.

Dataset Integration

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:

  1. Data Layer — Abstract Image class with concrete implementations for DICOM, PNG, and in-memory formats. All pixel data stored as torch.Tensor.

  2. Processing Layer — Stateless operations (filters, thresholds, morphology, metrics) applied via static methods on loaded images.

  3. Algorithm Layer — Algorithm base class using the Template Method pattern. Algorithms compose processing operations into pipelines.

  4. Dataset Layer — PyTorch-compatible BaseDataset with lazy sample loading and standard dict output.

  5. 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)