Running Focus
scripts/run_focus.jl computes transcranial transmit delays (geometric or HASA) for 2D and 3D domains, optionally verifying focus quality with k-Wave. It supports both water and CT-backed skull media. scripts/compare_focus_estimators.jl runs both estimators side-by-side and writes a comparison figure.
Single Focusing Case
Default skull-backed HASA case:
julia --project=. scripts/run_focus.jl \
--estimator=hasa \
--aberrator=skull \
--slice-index=250Centered target at 60 mm below the transducer:
julia --project=. scripts/run_focus.jl \
--dimension=2 \
--estimator=hasa \
--aberrator=skull \
--placement=fixed_transducer \
--slice-index=250 \
--focus-mm=60:03D water-backed HASA setup dry enough for checking the focusing delays without k-Wave:
julia --project=. scripts/run_focus.jl \
--dimension=3 \
--estimator=hasa \
--aberrator=water \
--focus-mm=60:0:0 \
--receiver-aperture-y-mm=60 \
--receiver-aperture-z-mm=60 \
--run-kwave=false3D skull-backed k-Wave outward propagation without inward verification:
julia --project=. scripts/run_focus.jl \
--dimension=3 \
--estimator=hasa \
--aberrator=skull \
--outward-propagation=kwave \
--verify-inward-kwave=false \
--focus-mm=30:0:0 \
--slice-index=250 \
--skull-transducer-distance-mm=5 \
--receiver-aperture-y-mm=20 \
--receiver-aperture-z-mm=20Target 30 mm below the inner skull:
julia --project=. scripts/run_focus.jl \
--dimension=2 \
--estimator=hasa \
--aberrator=skull \
--placement=fixed_focus_depth \
--slice-index=250 \
--focus-mm=60:0 \
--focus-depth-from-inner-skull-mm=30Compare Estimators
julia --project=. scripts/compare_focus_estimators.jl \
--medium=skull_in_water \
--slice-index=250Main Options
--ct-path: DICOM folder for CT-backed skull runs.--slice-index: CT slice used for the 2D focusing medium.--frequency-mhz: transmit frequency.--dimension:2or3.--focus-mm: target coordinates. Usedepth:lateralin 2D anddepth:y:zin 3D.--receiver-aperture-mm: transducer aperture width. In 3D,--receiver-aperture-y-mmand--receiver-aperture-z-mmoverride each axis independently.--estimator:geometricorhasa.--aberrator:none,water, orskull.--placement:auto,fixed_transducer, orfixed_focus_depth(2D only).--focus-depth-from-inner-skull-mm: target depth below the inner skull for fixed-depth placement (2D only).--skull-transducer-distance-mm: gap between the outer skull surface and the transducer plane.--outward-propagation:angular_spectrumorkwave.--verify-inward-kwave: setfalseto skip the return pressure simulation after computing transmit delays.--run-kwave: legacy shorthand; setting it tofalsealso skips inward verification.--kwave-use-gpu: settrueto run k-Wave on GPU.--transverse-mm: transverse grid extent (mm). In 3D,--transverse-y-mmand--transverse-z-mmoverride each axis independently.--dx-mm,--dz-mm: lateral and axial grid spacing.--dy-mmoverrides lateral spacing for the y axis in 3D.--axial-mm: axial domain extent; defaults toauto(derived from focus depth and padding).--axial-padding: multiplicative padding applied to the focus depth when computing the axial domain size (default1.5).--out-dir: override the automatically generated output directory.
scripts/run_focus.jl writes summary.json, result.jld2, and pressure.png. scripts/compare_focus_estimators.jl writes summary.json and comparison.png. Focus runs also write sensor_timings.png, which visualizes the computed transmit delay and normalized amplitude at the active sensor/aperture elements.