Image preparation

Image preparation converts UK Biobank CMR source files into subject-level, analysis-ready files with stable modality names. It is the first contract between UKB source fields and downstream segmentation/feature extraction.

Modality
All modalities
Pipeline step
Step 1 preparation
Outputs
Prepared NIfTI images, optional retained DICOM folders, visit-specific subject directories, Slurm preparation scripts
Maturity
Source-audited method page

Current implementation boundary

step1_prepare_data_cmr.py generates Slurm scripts for visit 1 and, when configured, retest/visit 2. It maps raw modality groups to UKB CMR fields: scout 20207, long-axis 20208, short-axis 20209, aortic distensibility 20210, tagging 20211, LVOT 20212, blood flow 20213, and ShMOLLI/native T1 20214.

The generated scripts call scripts/prepare_data.py with modality-specific input folders and options such as --overwrite and --keepdicom. Downstream steps assume the prepared subject directories contain stable filenames such as sa.nii.gz, la_4ch.nii.gz, aortic_flow.nii.gz, lvot_processed.nii.gz, and shmolli_t1map.nii.gz where applicable.

Contract with downstream steps

Prepared images must preserve frame order, temporal spacing, voxel geometry, and modality naming. Segmentation and feature extraction scripts do not rediscover arbitrary filenames; they look for expected files inside the subject directory.

Geometry preservation

Silent affine, spacing, direction, origin, or frame-order changes can invalidate segmentation and measurement outputs. Geometry changes must be explicit and documented before downstream phenotype interpretation.

Prepared modality groups

Source groupUKB fieldTypical downstream use
Scout/localizer20207Aortic structure and vascular geometry
Cine long-axis20208Atrial structure/function, long-axis strain, annular and cross-chamber rows
Cine short-axis20209Ventricular volume, mass, function, wall thickness, SAX mechanics
Aortic distensibility cine20210Aortic area, equivalent diameter, pressure-normalized distensibility
Tagged MRI20211Tagged deformation and timing rows
LVOT cine20212Aortic annulus, sinuses, sinotubular junction
Phase-contrast flow20213Aortic velocity, flow, valve area, regurgitation, flow displacement
Native T1 mapping20214Native myocardial and blood-pool T1

Source audit

  • Raw field mapping and script-generation behavior were checked against step1_prepare_data_cmr.py.
  • Downstream filename expectations were checked against current modality pages and feature extraction sources.
  • Textbook context boundary: broad clinical textbook context is not surfaced here because this is a pipeline preparation method page.