File Exchange

image thumbnail

High intensity focused ultrasound simulator

version (180 KB) by Josh Soneson
Simulates high intensity focused ultrasound beams and heating effects in layered media


Updated 29 Mar 2011

View License

Contains two modules. The first solves the KZK equation for the pressure distribution of an axisymmetric focused ultrasound transducer, produces salient plots, and dumps the computed data to the Matlab workspace. The second module uses the pressure distribution to compute heating and thermal dose according to a user-defined treatment protocol. Again plots are produced and data is available for postprocessing.

Comments and Ratings (14)

f o

f o (view profile)

pouya nam

I face to error from BHT can someone help me ?


I met a question as I run the program of High intensity focused ultrasound simulator
Warning--f/1.18 exceeds the conditions
under which KZK is derived (> f/1.37).
Is there anybody who can help me for it? Thanks.

Hi Alessandra,

I think you're talking about the issue with the plotting of the final temperature maps, this is the error I was getting: "Error using contour (line 48) Vector Y must be strictly increasing or strictly decreasing with no repeated values."

You need to change the following three lines in BHT_Plots.m:
(13) r2 = [-flipud(r(1:length(r)-1));r];
(14) Dmat2 = [flipud(Dmat(1:length(r)-1,:));Dmat];
(41) Tmax_mat2 = [flipud(Tmax_mat(1:length(r)-1,:));Tmax_mat];

to the following:

(13) r2 = [-flipud(r(2:length(r)));r];
(14) Dmat2 = [flipud(Dmat(2:length(r),:));Dmat];
(41) Tmax_mat2 = [flipud(Tmax_mat(2:length(r),:));Tmax_mat];

Newer versions of Matlab throw an error that didn't exist when this was developed.
Hope this helps anyone who happens to come across this.


Is anyone else having errors with the heating code example?


Really excellent code for HIFU simulation. It is very user-friendly and the outputs are very clean.

hu dong

THe BHT_parameters.m program has some wrong.
t = [0:dt:T]; % time nodes
r = r(1:r_skip:round(J/2));
z = z(1:z_skip:M);
H = H(1:r_skip:round(J/2),1:z_skip:M);
[J,M] = size(H);
fprintf('\n\tdt = %2.2f sec\tN = %d\n',dt,N)
fprintf('\tdr = %2.2f mm\tJ = %d\n',10*r(2),J)
fprintf('\tdz = %2.2f mm\tM = %d\n\n',10*z(2),M)


gm (view profile)

Excellent code, but I didnt manage to change the parameters of sonication. I want to simulate a CW sequence of 60s and 48s of cooling. I set t_i=60 and t_c=48 and set number of pulses to 0 but the code persists on default values.


Excellent HIFU simulation codes!THANKS!

Well documented and with a large set of relevant output parameters.


Nice code, fast (axisymmetric calculation) and user-friendly.
It would be good to be able to specify more than 2 materials.


Should provide constants (alpha, beta, eta) for some other commonly used materials and media (like air) and/or cite sources on where to get them. Thanks


The software looks good although some basic sketches of the geometries, transducer positioning, materials, axes, naming conventions, etc. should be included in the instructions in order to understand basic examples and develop more advanced ones.

MATLAB Release Compatibility
Created with R14SP3
Compatible with any release
Platform Compatibility
Windows macOS Linux

Discover Live Editor

Create scripts with code, output, and formatted text in a single executable document.

Learn About Live Editor