CoolFace
Apppublic

QinLei086/pec-breast-mri-vce

sourceHugging Faceotherupdated 2mo agoView on Hugging Face
0likes
App README

Predictive Enhancement Calibration for Breast MRI VCE

Interactive research demo for Predictive Enhancement Calibration (PEC) and source-only breast MRI virtual contrast enhancement. The system couples a PEC intensity interface to a frozen FLUX.2 latent flow transformer using a condition-token LoRA.

Paper · Code and preprocessing · Released weights

How it works

  1. 1.Input: A 2-D pre-contrast array (.mha, .npy, .npz) or a 3-D NIfTI volume (.nii, .nii.gz).
  2. 2.Preparation: Auto mode detects released MAMA-standardized data or applies the archived MAMA global z-score (mean 107.41194, standard deviation 219.96181) to raw intensities. Images are aspect-preserving center-padded to the 512×512 model canvas. For a 3-D NIfTI, slices are ranked by their standardized maximum intensity, a random sample of 1–4 slices is drawn without replacement from a user-sized Top-K pool, and the user can confirm, edit, or randomly reselect the indices before generation. No target image or tumour mask is used.
  3. 3.PEC prediction: A small FT-Transformer predicts the target intensity upper endpoint from 47 pre-contrast intensity statistics.
  4. 4.Source encoding: The pre-contrast image is encoded to a 512×512 RGB PNG using the PEC shared coordinate (pre-min → predicted-high, gamma 2.2).
  5. 5.FLUX.2 generation: A FLUX.2 [klein] Base 9B latent flow transformer with EasyControl condition-token LoRA generates a synthetic enhanced image.
  6. 6.Output decoding: The generated PNG is decoded back to MRI intensity using the same PEC coordinate.

Input and output contract

Accepted uploads are finite, non-constant 2-D .mha / .npy / .npz files or 3-D .nii / .nii.gz volumes. Do not upload a display PNG, DICOM screenshot, 4-D DCE series, or patient-wise-normalized data. Auto mode is designed for the released MAMA preprocessing: the raw-intensity path makes original MAMA-MIA inputs convenient, but it is not a claim of calibrated scanner-independent performance on arbitrary external cohorts. Use the manual intensity selector when automatic detection is inappropriate. The full public pipeline is documented in `docs/DATA.md`.

The on-screen images are display previews in the shared PEC coordinate. A 2-D run returns one float32 .mha; a 3-D run returns a ZIP containing one .mha per selected slice, PNG previews, and a JSON manifest with slice indices and preprocessing details. Raw MAMA-compatible input is inverse-transformed to its source-like intensity units for download; standardized input remains in the archived MAMA z-score domain. Outputs use the 512×512 model canvas and are not reinserted into the original 3-D geometry. The app keeps the PEC endpoints, selected slice indices, seed, steps, and runtime visible in a compact run summary; the complete metadata remains available in the JSON panel and the downloaded manifest.

Included examples

DUKE_01.mhaDUKE_02.mhaISPY1_01.mhaISPY1_02.mhaISPY2_01.mha
[image][image][image][image][image]
ISPY2_02.mhaNACT_01.mhaNACT_02.mhaYUNNAN_01.mhaYUNNAN_02.mha
[image][image][image][image][image]

The gallery contains two cases from each of the four public collections in MAMA-MIA, selected deterministically at within-center source Q99.99 quantiles after excluding MAMA100, and two cases from the Yunnan DCE-MRI cohort. Clicking a thumbnail only fills and previews the input; it never starts the generator. Exact public case IDs, source licenses, selection rules, and all modifications are recorded in `assets/examples/manifest.json`. MAMA-MIA is distributed overall under CC BY-NC 4.0; its underlying source-collection terms continue to apply. Yunnan is CC BY 4.0.

Intended use

This is research code for breast MRI image-synthesis experiments. It is not a medical device and must not be used for clinical diagnosis or treatment decisions, including decisions about contrast administration. Do not upload identifiable clinical data to this public Space.

Repository-authored code is Apache-2.0. The runtime depends on the FLUX.2 klein-base-9B model and the released PEC challenge artifacts; their upstream and non-commercial terms continue to apply. See the model and data license notice.

Questions: Dr. Qin Lei