Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Example: Transcranial CT/MRI Reconstruction

Crate: kwavers
Run: cargo run -p kwavers --example transcranial_ct_mri_reconstruction Source: crates/kwavers/examples/transcranial_ct_mri_reconstruction.rs

What This Example Demonstrates

This example demonstrates transcranial CT/MRI reconstruction for focused ultrasound imaging. It loads co-registered NIfTI volumes through RITK, derives a CT acoustic model, reconstructs brain sound speed with masked FWI, and validates the result against MRI.

Pipeline

CT/MRI NIfTI  →  RITK Image  →  CT acoustic slice  →  masked FWI  →  MRI validation

Features

FeatureDescription
NIfTI LoadingCo-registered CT and T1 MRI through RITK
Image ProcessingHead-slice selection and grid resampling
Model GenerationCT-derived sound speed, density, and brain mask
ReconstructionSkull-frozen brain FWI with MRI correlation

Key Code Snippet

let ct_path = std::env::var("KWAVERS_CT_PATH")
    .unwrap_or_else(|_| "data/cfb_gbm_sample/ct.nii.gz".to_owned());
let Some(ct) = load_nifti(&ct_path) else {
    return Ok(());
};

let slice_index = select_head_slice(&ct.data)?;
let ct_slice = resample_head_slice(&ct.data, ct.spacing_mm, slice_index, GRID)?;
let acoustic = AcousticSlice::from_ct_hu(ct_slice.hu.clone(), ct_slice.spacing_m)?;
let grid = Grid::new(
    GRID + 2 * PAD,
    GRID + 2 * PAD,
    2,
    ct_slice.spacing_m,
    ct_slice.spacing_m,
    ct_slice.spacing_m,
)?;

Book Chapter

← Transcranial Ultrasound: Physics, Aberration Correction, and Therapy