FFS → HFS DICOM Conversion Script (Universal Metadata Reorientation with Python)
Standardize patient orientation across any DICOM series — CT, MR, PET, or CBCT — without touching pixel data.
This Python script package (using pydicom and numpy) converts DICOM datasets acquired in Feet-First Supine (FFS) into Head-First Supine (HFS) by adjusting only the relevant metadata tags. It ensures consistent orientation for analysis, visualization, and concatenation.
📦 Two Versions Included
- Original Script (v1) – lightweight version that updates orientation tags only.
- Updated Script (v2) – robust version that also adjusts the Image Position (Patient) (0020,0032) z-component for full compatibility with ITK-based and other DICOM viewers.
✨ Features
- Automated Tag Updates:
- • Patient Position (0018,5100)
- • Instance Number (0020,0013)
- • Slice Location (0020,1041)
- • (v2 only) Image Position (Patient) (0020,0032)
- Geometry-Aware Sorting: Preserves 3D spatial relationships using Image Position + Orientation.
- Non-Destructive Workflow: Original files remain unchanged; outputs a clean derived series.
- Universal Support: CT, MR, PET, CBCT, and other DICOM series.
- Simple & Flexible: Clear, documented code with minimal dependencies (pydicom, numpy).
✅ Why This Script Package is Essential
- Eliminates orientation mismatches between scanners or sessions.
- Speeds up preprocessing for concatenation, deformable registration, or radiotherapy workflows.
- Keeps geometry consistent across multi-modality studies.
- Learn and compare: v1 shows the minimal fix, v2 shows the robust implementation.
👩⚕️ Who It’s For
Medical physicists, imaging scientists, and developers who need fast, reliable DICOM reorientation without resampling.
⚡ Next Step: Pair this with Part 2 (Concatenation + Registration Script) to seamlessly merge multiple CT datasets into one stitched series.