Focus Function List
Focus Function List
2c0
.
20
cw_pressure
Description
is function is used to calculate continuous-wave pressures with the Fast Neareld Method in FO-
CUS.
Usage
pressure = cw_pressure(transducer, cg, medium, ndiv, f0);
pressure = cw_pressure(transducer, cg, medium, ndiv, f0, method);
Arguments
transducer: A FOCUS transducer array.
cg: A FOCUS coordinate grid.
medium: A FOCUS medium.
ndiv: e number of integral points to use.
f0: Frequency of the array in Hz.
method: e method to use when calculating the pressure. If the string 'sse' is present, SSE
instructions will be used to speed up the calculation where possible - see the documentation
for fnm_cw_sse for details. Valid calculation methods are:
'fnm': Use the Fast NeareldMethod(fnm_cw) tocalculate the pressure - this is the default.
'fareld': Use the fareld approximation (fareld_cw) to calculate the pressure.
'rayleigh': Use the Rayleigh-Sommerfeld Integral (rayleigh_cw) to calculate the pressure.
Output Parameters
pressure: A 3-d array representing the complex pressure at each point in space.
Notes
Advanced users may wish to use fnm_cw for access to more features and options.
e value of the ndiv parameter should be chosen based on the spatial location of the simulation
relative to the transducer and the desired calculation accuracy. e only way to determine the opti-
mal value for this parameter is to perform the calculation with a very large ndiv (e.g. 200) and then
compare calculations performed with progressively larger ndiv values to the reference pressure until
the desired accuracy is achieved. See the FNMcirc example (in /Examples/Papers) for an example of
this type of calculation.
A good approximation for the ndiv value for single transducers can be calculated by the formula
n = 2
d
n
N1
2
)
uniform: Uniform window--- w(n) = 1
r: An optional tuning parameter used only for Chebyshev apodization. r is the desired size of
the sidelobes relative to the main lobe in dB. e default value is 100.
Output Parameters
transducer: e transducer struct with the newamplitude values.
82
set_center_coordinate_grid
Description
Creates a coordinate grid centered at the given point.
Usage
cg = set_center_coordinate_grid(delta, x, y, z, nx, ny, nz);
Arguments
delta: An integer or vector ([dx dy dz]) representing the dierence between two points in the
grid.
x: e x coordinate of the center of the grid.
y: e y coordinate of the center of the grid.
z: e z coordinate of the center of the grid.
nx: e number of points in the x direction of the grid.
ny: e number of points in the y direction of the grid.
nz: e number of points in the z direction of the grid.
Output Parameters
cg: A coordinate grid struct with the given center.
Notes
If nx, ny, or nz is set to one, there will be no points in that direction of the grid, resulting in a coordi-
nate plane or coordinate line instead of a 3-d grid.
83
set_coordinate_grid
Description
Creates a coordinate grid data structure used by FOCUS for various calculations.
Usage
grid = set_coordinate_grid(delta, xmin, xmax, ymin, ymax, zmin, zmax);
grid = set_coordinate_grid(x_coords, y_coords, z_coords);
grid = set_coordinate_grid(vector);
Arguments
delta: e dierence between two data points in a coordinate direction. Should be a matrix of
the form [ dx dy dz ].
xmin: e lowest x plane.
xmax: e highest x plane.
ymin: e lowest y plane.
ymax: e highest y plane.
zmin: e lowest z plane.
zmax: e highest z plane.
x_coords: A list of x coordinates.
y_coords: A list of y coordinates.
z_coords: A list of z coordinates.
vector: a list of coordinates in [ [x1 y1 z1]; [x2 y2 z2];...] notation.
Output Parameters
grid: A coordinate grid struct that can be used by FNM functions.
Notes
If x_coords, y_coords, and z_coords are provided, each point is dened as point(i) = [ x_coords(i)
y_coords(i) z_coords(i) ]. If no arguments are provided, the user will be prompted to enter delta,
xmin, xmax, ymin, ymax, zmin, and zmax.
Calling this function with no arguments will cause the programto prompt the user for each required
value.
84
set_digitized_time_delays
Description
Notice: is function is deprecated. Please use set_time_delays instead.
Determine the time delays needed to focus a transducer array at the given point. Time delays are
shied to t the temporal grid rather than being allowed to fall between temporal samples.
Usage
transducer = set_digitized_time_delays(transducer, x, y, z, medium, fs);
Arguments
transducer: A FOCUS transducer array.
x: e x coordinate of the focus.
y: e y coordinate of the focus.
z: e z coordinate of the focus.
medium: A FOCUS medium.
fs: e sampling frequency in Hz.
Output Parameters
transducer: e input transducer array with adjusted time delays.
Notes
is function alters the transducer struct, the output transducer should be the same as the input
transducer (transducer).
85
set_excitation_function
Description
A function to create an excitation function suitable for use with transient_pressure and other tran-
sient pressure calculation functions.
Usage
fn = set_excitation_function(type, f0, w);
fn = set_excitation_function(type, f0, w, b);
fn = set_excitation_function(signal, sample_period, clipping_threshold);
Arguments
type: A string representing the function type. ree are available:
"tone burst": tone burst (A
0
sin(2f
0
t))
"hann pulse": Hann-weighted pulse (A
0
(1 cos(2
t
w
)) sin(2f
0
t))
"tcubed pulse": broadband t
3
pulse (A
0
t
3
e
Bt
sin(2f
0
t))
f0: Center frequency in Hz
w: width of the pulse in s
b: Exponential term in the t-cubed pulse.
signal: AMATLAB vector containing a set of time samples representing the excitation signal in
m/s.
sample_period: e duration between points in the excitation signal in s.
clipping_threshold: Optional argument describing the thresholdbelowwhichfrequency com-
ponents will be ignored. If this value is negative, it will be assumed to be in dB, otherwise any
value between zero and one can be used.
Output Parameters
fn: A MATLAB structure containing the values specied by the user.
Notes
Transient calculations can be performed with arbitrary input signals, however performance will be
improved if one of the signal types for which an analytical TSDexpression has been derived is used.
Otherwise, the calculation will be performed using FDTSD. See the documentation for fnm_tsd for
details.
Calling this function with no arguments will cause the programto prompt the user for each required
value.
e amplitude of the excitation can be set on each transducer by changing its amplitude property.
86
Excitation function types can also be described using their integer identiers; 1 for tone burst, 2 for
Hann-weighted pulse, and 3 for t-cubed pulse.
87
set_fdtsd_excitation
Description
Afunction to create an excitationfunctionfor use inFrequency Domain Time-Space Decomposition
(FDTSD) calculations.
Usage
fn = set_fdtsd_excitation(signal, sample_period, clipping_threshold);
Arguments
signal: AMATLAB vector containing a set of time samples representing the excitation signal in
m/s.
sample_period: e duration between points in the excitation signal in s.
clipping_threshold: Optional argument describing the thresholdbelowwhichfrequency com-
ponents will be ignored. If this value is negative, it will be assumed to be in dB, otherwise any
value between zero and one can be used. A value of zero will disable spectral clipping.
Output Parameters
fn: A MATLAB structure containing the specied values.
Notes
Transient calculations can be performed with arbitrary input signals, however performance will be
improved if one of the signal types for which an analytical TSDexpression has been derived is used.
Otherwise, the calculation will be performed using FDTSD. See the documentation for fnm_tsd for
details.
88
set_layered_medium
Description
Create a medium struct for use in ASA layered medium calculations.
Usage
layered_medium = set_layered_medium(z_start, medium_properties);
Arguments
z_start: An array of numbers representing the start point of each layer on the z-axis in m. e
rst layer must start at z = 0.
medium_properties: An array of FOCUS medium structs as constructed by set_medium.
Output Parameters
layered_medium: An array of MATLAB structs with the following properties:
specicheatolood
bloodperfusion
density
soundspeed
powerlawexponent
attenuationdBcmMHz
specicheat
thermalconductivity
nonlinearityparameter
z_start: e start point of the layer on the z-axis in m
z_end: e end point of the layer on the z-axis in m. is is equivalent to the start point
of the following layer or innity for the last layer.
Notes
Each layer is constructed such that layer n spans from z_start(n) to z_start(n + 1) and has all of the
properties specied in medium_properties(n).
89
set_medium
Description
Create a medium struct for use with other FOCUS functions.
Usage
medium = set_medium(cb, wb, rho, c_sound, b, atten_coeff, ct, kappa, beta);
medium = set_medium('lossless');
medium = set_medium('specificheatofblood',cb,'bloodperfusion',wb,'density',rho,\
'soundspeed',c_sound,'powerlawexponent',b,'attenuationdBcmMHz',atten_coeff,\
'specificheat',ct,'thermalconductivity',kappa,'nonlinearityparameter',beta);
Arguments
cb: Specic heat of blood in J/kg/K
wb: Blood perfusion in kg/m
3
/s
rho: e density of the medium in kg/m
3
c_sound: e speed of sound in m/s
b: Power lawcoecient; unitless.
atten_coe: Attenuation coecient in dB/cm/MHz
ct: Specic heat of the medium in J/kg/K
kappa: ermal conductivity in W/m/K
beta: Nonlinear parameter; unitless.
Output Parameters
medium: A MATLAB struct with the following properties:
specicheatolood
bloodperfusion
density
soundspeed
powerlawexponent
attenuationdBcmMHz
specicheat
thermalconductivity
nonlinearityparameter
90
Notes
Callingset_mediumwithastringargument will create one of the default mediacreatedbydene_media.
e options for these strings are:
lossless
attenuated
water
skin
fat
muscle
liver
When the arguments are preceded by their names (e.g. set_medium('density',1500);), they can be in
any order and any number of them can be missing. Calling set_medium with no arguments would
be equivalent to calling set_medium('lossless');.
Calling this function with no arguments will cause the programto prompt the user for each required
value.
91
set_parameters
Description
Notice: is function is deprecated. Please use set_medium instead.
Create a parameter struct for use with FNM functions.
Usage
params = set_parameters('c_sound', c_sound, 'atten_coeff', atten_coeff,\
'rho_density', rho, 'f0', f0, 'fs', fs);
Arguments
c_sound: e speed of sound in m/s
atten_coe: e attenuation coecient in dB/cm/MHz
rho: e density of the medium in kg/m
3
f0: e frequemcy of the transducer array in Hz
fs: e sampling frequency in Hz
Output Parameters
params: A parameter struct.
Notes
Calling this function with no arguments will cause the programto prompt the user for each required
value.
92
set_phases
Description
is function is used to apodize transducer arrays by setting the amplitudes of the individual trans-
ducers.
Usage
transducer = set_phases(transducer, phases);
Arguments
transducer: A FOCUS transducer array.
phases: Avector the same size as the transducer array containing the phase to be used for each
element in the array, e.g. [0 /2 /2 0] for a ve-element array.
Output Parameters
transducer: e transducer struct with the newphase values.
93
set_temporal_coordinate_grid
Description
Notice: is function is deprecated. Please use set_time_samples and set_coordinate_grid instead.
Creates a coordinate grid for use with transient functions.
Usage
tcg = set_temporal_coordinate_grid(vector, time_vector);
tcg = set_temporal_coordinate_grid(vector, tmin, tmax, deltat);
tcg = set_temporal_coordinate_grid(delta, xmin, xmax, ymin, ymax, zmin, zmax,\
time_vector);
tcg = set_temporal_coordinate_grid(delta, xmin, xmax, ymin, ymax, zmin, zmax,\
tmin, tmax, deltat);
Arguments
vector: A vector containing a list of coordinates.
time_vector: A vector containing an explicit list of sampling points.
delta: e dierence between two data points in a coordinate direction. Should be a matrix of
the form [ dx dy dz ].
xmin: e lowest x plane.
xmax: e highest x plane.
ymin: e lowest y plane.
ymax: e highest y plane.
zmin: e lowest z plane.
zmax: e highest z plane.
tmin: e starting time.
tmax: e ending time.
deltat: e dierence between adjacent time samples.
Output Parameters
tcg: A temporal coordinate grid struct.
Notes
Calling this function with no arguments will cause the programto prompt the user for each required
value.
94
set_time_delays
Description
Determine the time delays required to focus a transducer array at a given point. Time delays cal-
culated with set_time_delays may fall between temporal samples unless the sampling frequency is
provided, in which case the delays are shied to t the temporal grid (digitized) rather than being
allowed to fall between temporal samples.
Usage
transducer = set_time_delays(transducer, x, y, z, medium);
transducer = set_time_delays(transducer, x, y, z, medium, fs);
transducer = set_time_delays(transducer, x, y, z, medium, fs, linear_array);
transducer = set_time_delays(transducer, delays);
Arguments
transducer: A transducer array, e.g. one created by create_circ_csa.
x: e x coordinate of the focus.
y: e y coordinate of the focus.
z: e z coordinate of the focus.
medium: A medium struct.
fs: Optional sampling frequency in Hz. If provided, digitized time delays (i.e. time delays
shied to align with the sampling frequency) will be used.
linear_array - Whether to treat the array as a linear array, i.e. all array elements with the same
x-coordinate will be focused together and have the same delay.
delays: e time delays to assign to the array elements such that the time delay of transducer(n)
= delays(n).
Output Parameters
transducer: e input transducer array with adjusted time delays.
Notes
is function alters the transducer struct so the output transducer should be the same as the input
transducer. If the sampling frequency is provided, the time delays will be digitized, i.e. they will be
shied to occur exactly on the time samples rather than between them.
95
set_time_samples
Description
Create a time sample struct for use with transient functions.
Usage
time_struct = set_time_samples(samples);
time_struct = set_time_samples(deltat, tmin, tmax);
Arguments
samples: A vector containing time samples (e.g. [ t1 t2 t3 ]).
deltat: e dierence between adjacent time samples.
tmin: e starting time.
tmax: e ending time.
Output Parameters
time_struct: A structure containing time sample information.
Notes
Calling set_time_samples with no arguments will cause the function to prompt the user to enter
deltat, tmin, and tmax. Additionally, note that set_time_samples(samples) is VERY dierent from
set_time_samples(deltat, tmin, tmax); the former will create a grid that samples only at the specied
points, whereas the latter will create a regular grid between tmin and tmax.
96
trans_rot
Description
is is an internal function used by draw_array and its related functions. Users are not expected to
use this function. It is designedtointerpret Euler angles whendrawing transducer arrays inMATLAB.
97
transient_pressure
Description
Calculates the transient pressure eld from an arbitrary transducer array using the Fast Neareld
MethodandTime-Space Decompositionor FrequencyDomainTime-Space Decomposition, depend-
ing on the input signal.
Usage
pressure = transient_pressure(transducer_array, coordinate_grid, medium, time_struct,\
ndiv, excitation_function); pressure = transient_pressure(transducer_array, coor-
dinate_grid, medium, time_struct,\
ndiv, excitation_function, calculation_method);
Arguments
transducer_array: A transducer_array.
coordinate_grid: A coordinate grid struct like the ones created by set_coordinate_grid.
medium: A medium struct like the ones created by set_medium.
time_struct: A time samples struct created by set_time_samples.
ndiv: e number of integral points to use.
excitation_function: An excitation function created by set_excitation_function.
calculation_method: e pressure calculation algorithm to use. Options are:
'fnm': Fast Neareld Method with Time-Space Decomposition
'fnm transient': Fast Neareld Method without TSD
'rayleigh': Transient Rayleigh-Sommerfeld method
Output Parameters
pressure: A 3-d array representing the complex pressure at each point in space.
Notes
Advanced users may wish to use the individual calculation functions directly for access to more fea-
tures and options.
FDTSD calculations are not as fast as TSD calculations. It is therefore recommended that users use
one of the analytical TSD expressions if possible for the greatest speed.
is functiononly calculates pressures inlossless media, soany attenuationparameter set by the user
will be ignored.
98