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: Elastography Simulation

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

What This Example Demonstrates

This example builds a high-resolution tissue block for elastography experiments. The setup uses a muscle-like background and explicitly constructs a stiff spherical inclusion in the shear-modulus map, which is the starting point for downstream displacement or reconstruction studies.

ComponentAPIValue
GridGrid::new4 cm cubic domain sampled at 0.2 mm spacing
Background tissueHeterogeneousTissueMedium::new(...Muscle)Starts from a muscle absorption/tissue model
Stiff lesionmu modulus mapUses a 3 kPa background with a 5 mm-radius stiffer inclusion

Key Code Snippet

let domain_size = 0.04f64; // 4 cm cubic domain
let dx = 0.0002f64; // 0.2 mm spacing
let n = (domain_size / dx).round() as usize;
let grid = Grid::new(n, n, n, dx, dx, dx)?;

info!(
    "Created {}x{}x{} grid with {} mm spacing",
    n,
    n,
    n,

Expected Output (if applicable)

The run logs grid creation and inclusion setup, then proceeds into the elastography phantom generation workflow.

Book Chapter

← Elastography: Imaging Tissue Mechanical Properties