Heart Gated CT Processing

Process cardiac gated CT images into dynamic, animated heart models for visualization in NVIDIA Omniverse.

Overview

The physiomotion4d-heart-gated-ct script processes 4D cardiac CT scans through a complete pipeline that includes:

  • AI-based anatomical segmentation

  • Deformable image registration across cardiac phases

  • Surface mesh extraction and transformation

  • USD file generation with anatomically-realistic materials

This tool is ideal for:

  • Visualizing cardiac motion through the cardiac cycle

  • Creating patient-specific animated heart models

  • Research and educational demonstrations of cardiac physiology

  • Pre-procedural planning with dynamic anatomical models

Input Requirements

Data Format

Accepts two input formats:

Option 1: Single 4D NRRD file
  • Contains all cardiac phases in one file

  • Format: .nrrd or .seq.nrrd

  • Example: cardiac_4d_ct.nrrd

Option 2: Multiple 3D files (time series)
  • Separate file for each cardiac phase

  • Formats: .nrrd, .nii, .mha

  • Example: phase_00.nrrd, phase_10.nrrd, phase_20.nrrd

Image Quality Requirements

  • Modality: Cardiac CT (contrast-enhanced recommended)

  • Phases: Minimum 2, typically 10-20 cardiac phases

  • Resolution: 0.5-2mm isotropic recommended

  • Field of View: Must include entire heart and major vessels

  • Image Quality: Minimal motion artifacts, good contrast

Basic Usage

Single 4D File

physiomotion4d-heart-gated-ct cardiac_4d.nrrd --contrast

Multiple 3D Files

physiomotion4d-heart-gated-ct phase_*.nrrd --contrast --project-name patient_001

With Output Directory

physiomotion4d-heart-gated-ct cardiac.nrrd \
    --contrast \
    --output-dir ./results/patient_001 \
    --project-name patient_001

Command-Line Options

Required Arguments

input_files         Path to 4D NRRD file OR list of 3D files

Optional Arguments

Option

Default

Description

--output-dir DIR

./results

Output directory for intermediate and final files

--project-name NAME

cardiac_model

Project name used for USD file naming

--contrast

False

Flag for contrast-enhanced studies (recommended)

--reference-image PATH

Auto (70%)

Custom reference image for registration

--registration-iterations N

1

Number of registration refinement iterations

--registration-method

icon

Registration method: icon or ants

Processing Pipeline

The script executes these steps automatically:

  1. Load Time Series * Converts 4D to 3D time series OR loads multiple files * Selects reference image (default: 70% cardiac phase)

  2. Segmentation * Segments reference image using AI segmentation (TotalSegmentator or Simpleware) * Identifies: heart chambers, myocardium, vessels, lungs, bones

  3. Registration * Registers each phase to reference image * Creates separate registrations for dynamic vs static anatomy * Uses mass-preserving deformable registration

  4. Mesh Generation * Extracts VTK surface meshes from segmentation * Creates smooth anatomical surface representations

  5. Transform Application * Applies registration transforms to meshes at each time point * Generates animated mesh sequences

  6. USD Creation * Produces painted USD files with anatomical materials * Creates time-varying geometry for Omniverse

Output Files

Primary Outputs

Located in <output-dir>/:

<project_name>.dynamic_anatomy_painted.usd
    Animated heart and vessels with cardiac motion

<project_name>.static_anatomy_painted.usd
    Stationary anatomy (lungs, bones, tissues)

<project_name>.all_anatomy_painted.usd
    Combined model with all structures

Intermediate Files

intermediate/
├── slice_*.mha                  # Individual 3D images per time point
├── slice_*.labelmap.mha         # Segmentation masks
├── slice_*.reg_*.inverse_transform.hdf5  # Registration transforms
└── slice_max.reg_*.mha          # Maximum intensity projections

meshes/
├── *.vtk                        # VTK mesh files
└── *_4d.vtk                     # Time series VTK files

Examples

Contrast-Enhanced Cardiac CTA

physiomotion4d-heart-gated-ct cardiac_cta.nrrd \
    --contrast \
    --output-dir ./output/patient_123 \
    --project-name PatientXYZ_CTA

Non-Contrast Study with Custom Reference

physiomotion4d-heart-gated-ct phase_*.nrrd \
    --reference-image phase_05.mha \
    --output-dir ./results \
    --project-name noncontrast_cardiac

Research Dataset Processing

# Batch process multiple cases
for case_dir in /data/cardiac_studies/case_*/; do
    case_name=$(basename "$case_dir")
    physiomotion4d-heart-gated-ct ${case_dir}/*.nrrd \
        --contrast \
        --output-dir ./results/${case_name} \
        --project-name ${case_name}
done

With ANTs Registration

physiomotion4d-heart-gated-ct cardiac.nrrd \
    --contrast \
    --registration-method ants \
    --registration-iterations 50

Best Practices

Choosing Reference Image

  • Default (70% phase): Mid-diastole, suitable for most cases

  • Custom selection: Choose phase with:

    • Best image quality

    • Least motion artifact

    • Optimal vessel enhancement (for CTA)

Performance Optimization

  • GPU: Enable CUDA for faster registration (automatic if available)

  • RAM: 16GB+ recommended for large datasets

  • Storage: Use SSD for faster I/O operations

  • Iterations: Start with default (1), increase only if needed

Data Quality Tips

  • Verify cardiac phases are temporally ordered

  • Check consistent spacing and orientation across phases

  • Ensure uniform contrast enhancement (for CTA)

  • Confirm heart structures are within field of view

Troubleshooting

Input File Issues

Error: “Input file not found”
  • Verify file paths are correct

  • Use absolute paths if relative paths fail

  • Check file permissions

Error: “Unable to read image”
  • Confirm file format is supported (NRRD, NII, MHA)

  • Check file is not corrupted

  • Verify image metadata is complete

Segmentation Quality Issues

Poor heart segmentation
  • Use --contrast flag for CTA studies

  • Verify cardiac structures are visible

  • Check image quality (no severe artifacts)

Missing anatomical structures
  • Ensure structures are in field of view

  • Check image resolution is adequate

  • Verify reference image quality

Registration Failures

Registration not converging
  • Try different reference image (better quality phase)

  • Increase --registration-iterations

  • Switch registration method (--registration-method ants)

Excessive deformation
  • Verify sufficient temporal overlap between phases

  • Check image spacing is reasonable

  • Ensure phases are properly ordered

Memory Issues

Out of memory errors
  • Reduce image resolution if possible

  • Process fewer time points

  • Close other applications

  • Consider using machine with more RAM

See Troubleshooting for additional help.

Expected Processing Time

Approximate times on typical workstation (32GB RAM, NVIDIA GPU):

Dataset

GPU Available

No GPU

10 phases, 512³ volume

15-30 minutes

2-4 hours

20 phases, 512³ volume

30-60 minutes

4-8 hours

Viewing Results in Omniverse

  1. Open NVIDIA Omniverse

  2. Navigate to output directory

  3. Open .usd file

  4. Press Play to view cardiac motion animation

  5. Adjust timeline speed for desired visualization

Next Steps