You are on page 1of 73

Abersim 2.

x
Reference manual with tutorials

Halvard Kaupang

2008
ii
Contents

1 Intoduction to Abersim 1
1.1 Motivation and History . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Short description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.3 This Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

2 Tutorials 3
2.1 Tutorial 1: Getting started with Abersim . . . . . . . . . . . . . . . . . . 3
2.1.1 Create Propcontrol . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.1.2 Generation and visualization of pulses . . . . . . . . . . . . . . . . 5
2.1.3 Export and visualization of beam profiles . . . . . . . . . . . . . . 6
2.2 Tutorial 2: 2D linear homogeneous beam simulation . . . . . . . . . . . . 7
2.2.1 Preparing a simulation . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2.2 Running the simulation . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2.3 Visualizing beam profiles . . . . . . . . . . . . . . . . . . . . . . . 8
2.3 Tutorial 3: 3D linear homogeneous beam simulation . . . . . . . . . . . . 11
2.3.1 Preparing the simulation . . . . . . . . . . . . . . . . . . . . . . . 11
2.3.2 Running the simulation . . . . . . . . . . . . . . . . . . . . . . . . 12
2.3.3 Visualizing beam profiles . . . . . . . . . . . . . . . . . . . . . . . 13
2.4 Tutorial 4: 3D non-linear homogeneous beam simulation with rotational
symmetry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.4.1 Preparing the simulation . . . . . . . . . . . . . . . . . . . . . . . 15
2.4.2 Running the simulation . . . . . . . . . . . . . . . . . . . . . . . . 15
2.4.3 Visualizing beam profiles . . . . . . . . . . . . . . . . . . . . . . . 16
2.5 Tutorial 5: 3D non-linear heterogeneous beam simulation from an arbitrary
transducer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
2.5.1 Preparing the simulation . . . . . . . . . . . . . . . . . . . . . . . 21
2.5.2 Running the simulation . . . . . . . . . . . . . . . . . . . . . . . . 21
2.5.3 Visualizing beam profiles . . . . . . . . . . . . . . . . . . . . . . . 24

3 Function Reference 29
3.1 The Propcontrol Struct . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.1.1 The Fields of ’Propcontrol’ . . . . . . . . . . . . . . . . . . . . . . 29
3.1.2 The Function ’initpropcontrol’ . . . . . . . . . . . . . . . . . . . . 33
3.2 The Simulation Itself . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
3.2.1 The Function ’pulsegenerator’ . . . . . . . . . . . . . . . . . . . . . 34
3.2.2 The function ’beamsim’ . . . . . . . . . . . . . . . . . . . . . . . . 37
3.2.3 The function ’export beamprofile’ . . . . . . . . . . . . . . . . . . 38
3.2.4 The Function ’plot pulse’ . . . . . . . . . . . . . . . . . . . . . . . 39
3.2.5 The Function ’plot beamprofile’ . . . . . . . . . . . . . . . . . . . 39
3.3 Propagation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

iii
iv CONTENTS

3.3.1 Short Mathematical Description . . . . . . . . . . . . . . . . . . . 40


3.3.2 Linear Propagation and Diffraction . . . . . . . . . . . . . . . . . . 40
3.3.3 The Wave-Number Operator . . . . . . . . . . . . . . . . . . . . . 42
3.3.4 Non-Linear Propagation and Operator Splitting . . . . . . . . . . . 43
3.3.5 Non-Linearity and Burgers’ Equation . . . . . . . . . . . . . . . . 43
3.3.6 Frequency Dependent Attenuation . . . . . . . . . . . . . . . . . . 44
3.4 Implementation of Materials . . . . . . . . . . . . . . . . . . . . . . . . . . 44
3.4.1 The Material Struct . . . . . . . . . . . . . . . . . . . . . . . . . . 44
3.4.2 The Material File ’MUSCLE’ . . . . . . . . . . . . . . . . . . . . . 45
3.4.3 The Function ’list material’ . . . . . . . . . . . . . . . . . . . . . . 48
3.4.4 The Function ’get matparam’ . . . . . . . . . . . . . . . . . . . . . 48
3.4.5 Other Material Functions . . . . . . . . . . . . . . . . . . . . . . . 48
3.5 Aberration and heterogeneities . . . . . . . . . . . . . . . . . . . . . . . . 48
3.5.1 The Function ’bodywall’ . . . . . . . . . . . . . . . . . . . . . . . . 49
3.5.2 The Function ’timeshift’ . . . . . . . . . . . . . . . . . . . . . . . . 49
3.5.3 The Function ’aberrator’ . . . . . . . . . . . . . . . . . . . . . . . 49
3.5.4 Delay screen body wall . . . . . . . . . . . . . . . . . . . . . . . . 49

4 Version and Installation Guide 53


4.1 Abersim 2.0 - Matlab version . . . . . . . . . . . . . . . . . . . . . . . . . 53
4.1.1 Installation of FFTW . . . . . . . . . . . . . . . . . . . . . . . . . 53
4.1.2 Installation on UNIX systems . . . . . . . . . . . . . . . . . . . . . 53
4.1.3 Installation on Windows systems . . . . . . . . . . . . . . . . . . . 54
4.2 Abersim 2.0 - C version . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
4.2.1 Installation on UNIX systems . . . . . . . . . . . . . . . . . . . . . 55

5 License Agreement 57
Chapter 1

Intoduction to Abersim

Abersim is a computer program designed to simulate ultrasonic wave propagation in


nonlinear, heterogeneous and absorbing materials (i.e., soft tissue). The program has been
developed at the Department of Circulation and Medical Imaging (ISB) at the Norwegian
University of Science and Technology (NTNU) starting in 1999 and up to today. The main
contributors to this program, from now on referred to as the Abersim Team, has been
Bjørn Angelsen, Martijn Frijlink, Tonni F. Johansen, Halvard Kaupang, Rune Hansen,
Svein-Erik Måsøy, Peter Näsholm, Gunnar Taraldsen, Thor-Andreas Tangen and Trond
Varslot.

1.1 Motivation and History

Over the last decades, simulations have been widely used to study different phenomenas
related to acoustical wave propagation. First, linear behavior was studied, and then, as
the comuters became more and more powerful, nonlinear beahavior started to become an
issue. Later, the effects of heterogeneous media became interesting.
Abersim was constructed as a tool to simulate forward wave propagation to study effects
of aberration. Tonni Franke Johansen started the development in 1999, but Svein-Erik
Måsøy, Trond Varslot and Gunnar Taraldsen soon started to work more on the different
parts of the code. Svein-Erik Måsøy, especially, and Trond Varslot worked with the het-
erogeneous part related to aberration, and Trond Varslot and Gunnar Taraldsen worked
on the nonlinear parts. Version 1 of Abersim was never released as anything more than a
collection of files. Most of the code was written for 2D applications, but was extended to
also work in 3D around 2004. The last version of the 1.X series was version 1.5.3 which
was released in 2004. The last years, Halvard Kaupang has worked out the Abersim 2 ver-
sion partially based on the old code. The program is also ported to C and a link through
Matlab’s MEX interface is established. The rest of the Abersim Team has contributed in
form of specifc functionalities and tuning for applications. Abersim 2.0 is released under
the GNU General Public License, version 3 [5]. This license is included in Ch. 5.

1.2 Short description

Abersim is a program for solving directional wave propagation in retarded time. Phys-
ically, the wave equation has two solutions propagating in opposite directions. Abersim

1
2 CHAPTER 1. INTODUCTION TO ABERSIM

will choose the solution only propagating into the body, i.e., the positive z-direction. The
introduction of retarded time couples the depth coordinate z to the time coordinate t,
and one may say that Abersim simulates the solution propagating in positive time. This
makes it possible to simulate wave fields propagating either away from or towards the
transducer.
Choosing only one of the two solutions, the governing equation is a directional wave
equation. The medium in which the wave propagates is mostly soft tissues. Soft tissue is
shown to be attenuating and have a nonlinear elasticity [1,2]. Soft tissue is also heteroge-
neous, causing scattering, reflection and refraction effects. Since the wave equation used
in Abersim is directional, Abersim has no way to resolve both the forward propagating
and back scattered wave in one simulation. Simple back scatter studies using one or a
smaller group of point scatterers may be performed in Abersim simulation by first sim-
ulating the forward propagating field, and then simulate the scattered field back to the
transducer.
The effects of nonlinearity and attenuation is modeled as terms of the wave equation. Nu-
merically, Abersim solves the diffraction, nonlinearity and attenuation using an operator
splitting approach. This makes it easy to switch nonlinearity and attenuation on and off
to simulate wave propagationg in linear or lossless media. The final differential equation
is deducted from the Westervelt equation following somewhat the same procedure as for
the deduction of the classic KZK equation (a directional, parabolic approximation to the
Westervelt equation). Abersim, however, compared to other KZK simulation tools, has
the ability to solve the directional Westervelt equations in cartesian 2D and 3D grids, and
not the approximative KZK equation. Even though the diffraction for cartesian setups
is solved exactly, there are still directional approximations made. To solve the nonlinear
part, a plane wave approximation is made, and the nonlinearity is only accounted for
for wave travelling parallel to the z-axis. This introduces errors for steered beams and
sharply curved wave fronts.
The structure of Abersim is a folder tree consisting of several functions. This is why it
may be referred to as a computer package as well as a program. These functions may be
combined into new simulation scripts, or programs, specifically tuned to meet the needs
and requirements of the user. This package contains the basic functions, but the user is
encouraged to make their own scripts and functions, and to possibly improve the program.
The core routines concerning the propagation of wave fields, should not be altered without
publishing further verification and validation. The routines in this package is verified in
the papers of Varslot and Taraldsen [10] and Varslot and Måsøy [9]. When publishing
studies where Abersim has been used, the user is encouraged to refer to one of these two
papers.

1.3 This Manual

This manual contains information on the use of Abersim as well as simple tutorials. The
tutorials are presented in Chapter 2 and a more thorough reference of the functions and
variables of Abersim is found in Chapter 3. Chapter 4 contains information about how
to install Abersim.
Chapter 2

Tutorials

This chapter contains a few simple tutorials for Abersim 2. For more thorough information
on the different routines and functions please consult Chapter 3.

The available tutorials in this section are the following:

• Getting started with Abersim

• 2D linear homogeneous beam simulation in muscle tissue

• 3D linear homogeneous beam simulation in muscle tissue

• 3D non-linear homogeneous beam simulation with circular symmetry in water

• 3D non-linear beam simulation in heterogeneous muscle tissue

The tutorials are meant to provide some simple setups of different simulations. As you go
along, you will find that there are many ways to modify the setups and create your own
export routines, filters and such. How to specify a wave field at the transducer surface
is an art in itself, but initial fields may be generated using pulsegenerator or obtained
from other simulation tools such as Field II or measurements. Abersim and the function
beamsim handles transducers of arbitrary geometry and with arbitrary pulse shapes. As
a user, you are encouraged to modify and create what ever Abersim does that does not
concern the propagation itself.

2.1 Tutorial 1: Getting started with Abersim

The goal of this tutorial is to get used to the control struct Propcontrol and how to set
up wave fields, export beamprofiles and simple visualization of these.

Make sure the Abersim package is installed on your computer, and start up Matlab
from the Abersim directory. For help on the installation see Chapter 4. Then run
startup_abersim. This will add the Abersim folders to the Matlab path. Then run
this tutorial using the testscript tutorial_basic.m (located in the test folder). You
don’t have to be in the test folder to run the tutorial, but the test script will change the
active folder to the test folder for storage of files etc.

3
4 CHAPTER 2. TUTORIALS

2.1.1 Create Propcontrol

Abersim simulations depend on the control struct Propcontrol. For more information on
the different variables in Propcontrol, please consult Section 3.1. This struct is initialized
by calling initpropcontrol, and the output should look something like:

Start of part 1: Creating Propcontrol

The P r o p c o n t r o l i s c r e a t e d u s i n g i n i t p r o p c o n t r o l
Propcontrol = ini tpr opcontr ol

Propcontrol =

simname : ’ 20080817 101841 beamsim ’


ndims : 2
nx : 512
ny : 1
nt : 1024
PMLwidth : 0
diffrflag : 1
nonlinflag : 1
lossflag : 1
abflag : 0
annflag : 0
equidistflag : 0
historyflag : 1
stepsize : 0.0013
shockstep : 0.5000
endpoint : 0.1000
currentpos : 0
storepos : 0.0600
material : [ 1 x1 s t r u c t ]
d: 0.0200
offset : [ 2 x1 d o u b l e ]
numscreens : 8
abamp : [ 1 6 x1 d o u b l e ]
ablength : [ 1 6 x2 d o u b l e ]
abfile : ’ randseq3 ’
Fs : 40000000
dx : 1 . 1 6 6 7 e −04
dy : 1 . 2 9 0 3 e −04
dz : 8 . 2 2 2 5 e −05
dt : 2 . 5 0 0 0 e −08
fc : 1500000
bandwidth : 750000
Np : 2.5000
amplitude : 0.5000
harmonic : 2
filter : [ 2 x1 d o u b l e ]
Dx : 0.0224
Dy : 0.0120
Fx : 0.0600
Fy : 0.0600
cchannel : [ 2 x1 d o u b l e ]
Nex : 64
Ney : 1
esizex : 3 . 5 0 0 0 e −04
esizey : 0.0120
2.1. TUTORIAL 1: GETTING STARTED WITH ABERSIM 5

To get used to Propcontrol, type help initpropcontrol and run the function init-
propcontrol with different input arguments. The fields of Propcontrol may be altered
by the user directly, but this should be done with much care, and make sure that you
fully understand the effects of your alterations before running larger studies. All varaibles
regarding the computational domain, the transducer and wave fields, and the material
and its properties may be altered in Propcontrol.

2.1.2 Generation and visualization of pulses

To generate a simple wave field call the function pulsegenerator with Propcontrol as
the argument. This will return the wave field from a transducer specified in Propcontrol.
The default is a 1.5 MHz pulse transmitted from a linear array with 64 elements and total
aperture of 22.4 mm. Then, visualize the wave field by calling plot_pulse with the wave
field and Propcontrol as arguments. Use the help function or consult Section 3.2.4 for
more information on visualization. The returned wave field may be seen in Figure 2.1.
The output of the tutorial should look something like:

S t a r t o f p a r t 2 : C r e a t i n g a wave f i e l d a t t h e t r a n s d u c e r

The p u l s e i s c r e a t e d u s i n g p u l s e g e n e r a t o r
u = pulsegenerator ( Propcontrol , ’ transducer ’ ) ;

P r e s s any key t o plot p u l s e


plot pulse (u , Propcontrol ) ;

Figure 2.1: The generated wave field at the transducer surface.


6 CHAPTER 2. TUTORIALS

2.1.3 Export and visualization of beam profiles

To generate a beamprofile the function export_beamprofile is called with the wave


field and Propcontrol as arguments. The function export_beamprofile returns a 4D-
variable containing the beamprofiles. This variable is visualized using plot_beamprofile
in Figure 2.2. The output of the tutorial should look something like:
S t a r t o f p a r t 3 : C r e a t i n g a beam p r o f i l e

The beam p r o f i l e i s e x p o r t e d by c a l l i n g e x p o r t b e a m p r o f i l e
prof = export beamprofile (u , Propcontrol ) ;

P r e s s any key t o plot beam p r o f i l e


plot beamprofile (u , Propcontrol ) ;

Figure 2.2: The beam profile of the generated wave field at the transducer surface.
2.2. TUTORIAL 2: 2D LINEAR HOMOGENEOUS BEAM SIMULATION 7

2.2 Tutorial 2: 2D linear homogeneous beam simulation

The goal of this tutorial is to set up a simple simulation and run it using the simulation
script beamsim, and visualizing the output of the simulation.
This tutorial will set up a 2D beam simulation using a 1D linear array probe with infinite
extenision in the elevation direction. The default medium is muscle at 37 degrees Celcius,
which now is assumed to be linear and homogeneous. The diffraction is solved in the
frequency domain using the Angular Spectrum Method (see Sec. 3.3.2). Attenuation of
the medium is for linear simulations using Angular Spectrum baked into the wave number
operator (see Sec. 3.3.3). The tutorial follows the test script tutorial_2Dlinhom.m.

2.2.1 Preparing a simulation

The Propcontrol is an important part of any Abersim simulation. For a simulation it is


often necessay to specify input arguments for initpropcontrol. For this simulation we
will use the input arguments presented in Table 2.1. For a more thorough description of
the possible input variables and their effect, please consult Section 3.1.

Table 2.1: Input arguments for initpropcontrol for a 2D simulation in a linear, homogeneous
medium.

Input variable Value Desciption


name ’test 2Dlinhom’ Name of simulation for storage etc.
ndim 2 Number of dimensions
flags [1,0,1,0,0,0,1]
diffrflag 1 Type of diffraction (Ang. Spect.)
nonlinflag 0 Nonlinearity (off)
lossflag 1 Attenuation (on)
abflag 0 Heterogeneous medium (off)
annflag 0 Annular transducer (off)
equidistflag 0 Equidistant steps (on)
historyflag 1 History (save profiles)
harm 1 Fundamental imaging

The default imaging setup by initpropcontrol is fundamental imaging at 3 MHz, focused


at 60 mm and an azimuth aperture 22.4 mm. The endpoint of the simulation is at 100
mm. A wave field similar to the one in Figure 2.1 is generated, and the simulation is run
using the simulation function beamsim (see Sec. 3.2.2).

2.2.2 Running the simulation

The function beamsim is the main simulation function. This will setup a simulation.
The script and calculate the number of steps needed, export beam profiles and on-axis
pulses, store wave fields, applies eventual aberration and/or aberration correction. The
beam profiles, the on-axis pulse for each step and the wave field at the endpoint is output
variables from beamsim. The stored wave fields are stored in files with a filename specified
by the Propcontrol field simname and a further extension describing the position at
which the wave field was stored. The output produced from the first two parts of the
tutorial is:
8 CHAPTER 2. TUTORIALS

Start of part 1 : Preparing the simulation

The P r o p c o n t r o l i s c r e a t e d u s i n g i n i t p r o p c o n t r o l with a set o f arguments


The arguments t h a t a r e i m p o r t a n t a r e such a s t h e f l a g s , c e n t e r f r e q u e n c y ,
t h e number o f d i m e n s i o n s and a name f o r t h e s i m u l a t i o n . This t e s t s c r i p t
s e t s up a 2D s i m u l a t i o n i n a l i n e a r medium . The imaging mode i s t h u s
fundamental , o r f i r s t −harmonic , imaging . The imaging f r e q u e n c y , a p e r t u r e ,
and f o c a l depth a r e a s d e f a u l t by i n i t p r o p c o n t r o l .

P r e s s any key t o c o n t i n u e

In put v a r i a b l e s f o r P r o p c o n t r o l :
name = ’ test 2Dlinhom ’ ;
ndim = 2;
flags = [1 ,0 ,1 ,0 ,0 ,0 ,1];
harm = 1;

P r e s s any key t o c o n t i n u e

Generate P r o p c o n t r o l
P r o p c o n t r o l = i n i t p r o p c o n t r o l ( name , ndim , f l a g s , harm ) ;

Generate a wave f i e l d a t t h e t r a n s d u c e r
u = pulsegenerator ( Propcontrol , ’ transducer ’ ) ;

P r e s s any key t o c o n t i n u e t o t h e next p a r t

S t a r t o f p a r t 2 : Running t h e s i m u l a t i o n

The s i m u l a t i o n i t s e l f i s run u s i n g t h e function beamsim . This w i l l


p r o p a g a t e t h e i n i t i a l wave f i e l d up t o a c e r t a i n d i s t a n c e and e x p o r t
t h e beam p r o f i l e f o r each s t e p . These p r o f i l e s w i l l be r e t u r n e d by
beamsim . P r o p c o n t r o l i s a l s o r e t u r n e d i n a updated manner ( t h a t i s : t h e
c u r r e n t p o s i t i o n i s not l o n g e r 0 ( a t t h e t r a n s d u c e r ) , but has t h e v a l u e
of the endpoint .

P r e s s any key t o c o n t i n u e

[ u out , P r o p c o n t r o l , rmspro , maxpro , a x p l s e ] = beamsim ( P r o p c o n t r o l , u ) ;


S t a r t i n g l i n e a r s i m u l a t i o n o f s i z e 512 x 512
Simulation to f i n a l endpoint i s 10.00 percent complete ( s t . 8/ 8 0 ) , ETA 1 0 : 1 8
S i m u l a t i o n t o f i n a l e n d p o i n t i s 2 0 . 0 0 p e r c e n t c o m p l e t e ( s t . 16/ 8 0 ) , ETA 1 0 : 1 8
S i m u l a t i o n t o f i n a l e n d p o i n t i s 3 0 . 0 0 p e r c e n t c o m p l e t e ( s t . 24/ 8 0 ) , ETA 1 0 : 1 8
S i m u l a t i o n t o f i n a l e n d p o i n t i s 4 0 . 0 0 p e r c e n t c o m p l e t e ( s t . 32/ 8 0 ) , ETA 1 0 : 1 8
S i m u l a t i o n t o f i n a l e n d p o i n t i s 5 0 . 0 0 p e r c e n t c o m p l e t e ( s t . 40/ 8 0 ) , ETA 1 0 : 1 8
S i m u l a t i o n t o f i n a l e n d p o i n t i s 6 0 . 0 0 p e r c e n t c o m p l e t e ( s t . 48/ 8 0 ) , ETA 1 0 : 1 8
S i m u l a t i o n t o f i n a l e n d p o i n t i s 7 0 . 0 0 p e r c e n t c o m p l e t e ( s t . 56/ 8 0 ) , ETA 1 0 : 1 9
S i m u l a t i o n t o f i n a l e n d p o i n t i s 8 0 . 0 0 p e r c e n t c o m p l e t e ( s t . 64/ 8 0 ) , ETA 1 0 : 1 9
S i m u l a t i o n t o f i n a l e n d p o i n t i s 9 0 . 0 0 p e r c e n t c o m p l e t e ( s t . 72/ 8 0 ) , ETA 1 0 : 1 9
Simulation f i n i s h e d in 0 . 3 8 min u s i n g an a v e r a g e o f 0 . 2 8 sec pr s t e p

2.2.3 Visualizing beam profiles

Now we have a set of nsteps 1D beam profiles of the kind we plotted in Tutorial 1.
The beam profiles plots show the profile for the total field and for each of the harmonic
components. The harmonic components are obtained by bandpass filtering the total field
2.2. TUTORIAL 2: 2D LINEAR HOMOGENEOUS BEAM SIMULATION 9

in the frequency domain. The center frequency of the filter is nfc for the n’th harmonic
frequency, and the relative bandwidth of the filter is specified in the Propcontrol field
filter. A set of such beam profiles is in fact a 2D beam profile. This may be visualized
as an image as presented in Figure 2.3. The focal point beam profile is shown as an own
1D bemprofile in Figure 2.4, and the sudden fall of the profile around 15-20 mm comes
from the windowing of the solution to avoid wrap-around effects (see Sec. 3.2.2). The
on-axis pulse may be exported and plotted using the plot_pulse function with the input
argument axflag set to one. The on-axis pulse with its frequency spectrum is shown in
Figure 2.5. The output from the third part of the tutorial should look something like:
Start of part 3: V i s u a l i z a t i o n of r e s u l t s

In t h i s p a r t we w i l l plot t h e beam p r o f i l e s o b t a i n e d by beamsim .


S i n c e t h i s i s a 2D s i m u l a t i o n , o n l y t h e ( x , z)− p l a n e p r o f i l e i s
a v a i l a b l e . We w i l l a l s o plot t h e f o c a l p r o f i l e and t h e a x i a l
p u l s e f o r each s t e p .

P r e s s any key t o plot beam p r o f i l e


p l o t b e a m p r o f i l e ( rmspro , P r o p c o n t r o l ) ;

P r e s s any key t o plot f o c a l p o i n t beam p r o f i l e


Find i n d e x o f f o c a l p r o f i l e
i d x = round ( P r o p c o n t r o l . Fx / P r o p c o n t r o l . s t e p s i z e ) + 1 ;
p l o t b e a m p r o f i l e ( rmspro ( : , : , idx , : ) , P r o p c o n t r o l ) ;

P r e s s any key t o plot on−axis p u l s e s


p l o t p u l s e ( axplse , Propcontrol , 1 ) ;

Figure 2.3: The temporal RMS-value of the radiated ultrasound beam.


10 CHAPTER 2. TUTORIALS

Figure 2.4: The temporal RMS-value of the radiated ultrasound beam at the focal point as a
function of x.

Figure 2.5: The on-axis pulse for each depth (right) and its frequency spectrum (right).
2.3. TUTORIAL 3: 3D LINEAR HOMOGENEOUS BEAM SIMULATION 11

2.3 Tutorial 3: 3D linear homogeneous beam simulation

The goal of this tutorial is to set up and run a simulation in 3D using a rectangular
transducer with apodization, and to export and visualize 3D wave fields and beam profiles.

This tutorial will set up a 3D beam simulation using a 1D linear array probe with lens
focusing in the elevation direction. The medium is still muscle at 37 degrees, which is
assumed to be linear and homogeneous. The diffraction is solved in the frequency domain
using the Angular Spectrum Method (see Sec. 3.3.2). Attenuation of the medium is for
linear simulations using Angular Spectrum baked into the wave number operator (see
Sec. 3.3.3). The tutorial follows the test script tutorial_3Dlinhom.m. 3D simulations
are quite memory consuming and should be run on computer with a fairly large memory.
The memory consumption for this simulation is about 1 GB.

2.3.1 Preparing the simulation

The Propcontrol is prepared as described in Tutorial 2 (Sec. 2.2 and Tab. 2.1), but now
the number of dimensions is three. The standard imaging setup of fundamental imaging at
3 MHz, focused at 60 mm in, now both, azimuth and elevation direction, and the aperture
sizes are 22.4 mm and 12 mm in azimuth and elevation respectively. The endpoint of the
simulation is at 100 mm. In azimuth a rectangular apodization is used, and in elevation a
cosine apodization. A pulse similar to the one in Figure 2.1, but now in 3D, is generated,
and the simulation is run using beamsim. A 3D wave field may be plotted and visualized
in the same way as 2D pulses, and a 3D wave field is seen in Fig. 2.6.

Figure 2.6: The generated 3D wave field at the transducer surface. The elevation direction uses
a lens focusing and a cosine apodization. The top left panel is the pulse in the (x, t)-frame, the
bottom the in the (y, t)-frame. The right, top panel is the center channel pulse and the bottom if
the RMS intensity of the pulse in the cross sectional (x, y)-plane
12 CHAPTER 2. TUTORIALS

2.3.2 Running the simulation

3D simulations are more computationally demanding than 2D. The sampling is therefore
slightly coarser, but still sufficient. The padding with free space on either side of the pulse
is also reduced for the 3D grid compared to the 2D. The output produced from the first
two parts of the tutorial is:

Start of part 1 : Preparing the simulation

The P r o p c o n t r o l i s c r e a t e d u s i n g i n i t p r o p c o n t r o l with a set o f arguments


s i m i l a r t o t h e 2D t u t o r i a l s i m u l a t i o n .

P r e s s any key t o c o n t i n u e

In put v a r i a b l e s f o r P r o p c o n t r o l :
name = ’ test 3Dlinhom ’ ;
ndim = 3;
flags = [1 ,0 ,1 ,0 ,0 ,0 ,1];
harm = 1;

P r e s s any key t o c o n t i n u e

Generate P r o p c o n t r o l
P r o p c o n t r o l = i n i t p r o p c o n t r o l ( name , ndim , f l a g s , harm ) ;

Generate a wave f i e l d a t t h e t r a n s d u c e r with a c o s i n e a p o d i z a t i o n i n e l e v a t i o n


u = pulsegenerator ( Propcontrol , ’ transducer ’ , [ 0 1 ] ) ;

P r e s s any key t o plot p u l s e


3D p u l s e s may a l s o be p l o t t e d
plot pulse (u , Propcontrol ) ;

P r e s s any key t o c o n t i n u e t o t h e next p a r t

S t a r t o f p a r t 2 : Running t h e s i m u l a t i o n

The s i m u l a t i o n i t s e l f i s run u s i n g t h e function beamsim a s f o r t h e


l i n e a r 2D s i m u l a t i o n .

P r e s s any key t o c o n t i n u e

[ u out , P r o p c o n t r o l , rmspro , maxpro , a x p l s e ] = beamsim ( P r o p c o n t r o l , u ) ;


S t a r t i n g l i n e a r s i m u l a t i o n o f s i z e 256 x 192 x 256
Simulation to f i n a l endpoint i s 10.00 percent complete ( s t . 8/ 8 0 ) , ETA 1 0 : 4 1
S i m u l a t i o n t o f i n a l e n d p o i n t i s 2 0 . 0 0 p e r c e n t c o m p l e t e ( s t . 16/ 8 0 ) , ETA 1 0 : 4 1
S i m u l a t i o n t o f i n a l e n d p o i n t i s 3 0 . 0 0 p e r c e n t c o m p l e t e ( s t . 24/ 8 0 ) , ETA 1 0 : 4 1
S i m u l a t i o n t o f i n a l e n d p o i n t i s 4 0 . 0 0 p e r c e n t c o m p l e t e ( s t . 32/ 8 0 ) , ETA 1 0 : 4 1
S i m u l a t i o n t o f i n a l e n d p o i n t i s 5 0 . 0 0 p e r c e n t c o m p l e t e ( s t . 40/ 8 0 ) , ETA 1 0 : 4 1
S i m u l a t i o n t o f i n a l e n d p o i n t i s 6 0 . 0 0 p e r c e n t c o m p l e t e ( s t . 48/ 8 0 ) , ETA 1 0 : 4 2
S i m u l a t i o n t o f i n a l e n d p o i n t i s 7 0 . 0 0 p e r c e n t c o m p l e t e ( s t . 56/ 8 0 ) , ETA 1 0 : 4 1
S i m u l a t i o n t o f i n a l e n d p o i n t i s 8 0 . 0 0 p e r c e n t c o m p l e t e ( s t . 64/ 8 0 ) , ETA 1 0 : 4 1
S i m u l a t i o n t o f i n a l e n d p o i n t i s 9 0 . 0 0 p e r c e n t c o m p l e t e ( s t . 72/ 8 0 ) , ETA 1 0 : 4 2
Simulation f i n i s h e d in 2 2 . 9 7 min u s i n g an a v e r a g e o f 1 7 . 2 3 sec pr s t e p
2.3. TUTORIAL 3: 3D LINEAR HOMOGENEOUS BEAM SIMULATION 13

2.3.3 Visualizing beam profiles

We have a set of nsteps 2D beam profiles. This may be visualized using plot_beamprofile
as presented in Figure 2.7. Cross sections of the beam, or other more specific cross
sectional profiles, may also be plotted using plot_beamprofile. The focal profile in the
(x,y)-plane, or azimuth and elevation direction, is presented in Figure 2.8. The output
from the third part of the tutorial should look something like:
Start of part 3: V i s u a l i z a t i o n of r e s u l t s

In t h i s p a r t we w i l l plot t h e beam p r o f i l e s o b t a i n e d by beamsim .


S i n c e t h i s i s a 3D s i m u l a t i o n , both t h e ( x , z)− p l a n e p r o f i l e and
t h e ( y , z)− p l a n e p r o f i l e s a r e a v a i l a b l e . We w i l l a l s o plot t h e f o c a l
p r o f i l e i n t h e ( x , y)− p l a n e .

P r e s s any key t o plot beam p r o f i l e


p l o t b e a m p r o f i l e ( rmspro , P r o p c o n t r o l ) ;

P r e s s any key t o plot f o c a l p o i n t beam p r o f i l e


Find i n d e x o f f o c a l p r o f i l e
i d x = P r o p c o n t r o l . Fx / P r o p c o n t r o l . s t e p s i z e + 1 ;
p l o t b e a m p r o f i l e ( rmspro ( : , : , idx , : ) , P r o p c o n t r o l ) ;

Figure 2.7: The temporal RMS-value of the radiated ultrasound beam in depth over the azimuth
and elevation direction.
14 CHAPTER 2. TUTORIALS

Figure 2.8: The temporal RMS-value of the radiated ultrasound beam at the focal point over
the (x,y)-plane.
2.4. TUTORIAL 4: 3D NON-LINEAR HOMOGENEOUS BEAM SIMULATION WITH ROTATIONAL S

2.4 Tutorial 4: 3D non-linear homogeneous beam simula-


tion with rotational symmetry

The goal of this tutorial is to set up and run a non-linear simulation using a circular-
symmetric transducer in another material than the default muscle, and to visualize wave
fields and beam profiles when higher harmonic frequencies are present.
This tutorial will set up a 3D beam simulation with circular symmetry using an circu-
lar piston transducer. The medium is now water, which is non-linear and homogeneous,
and the latter enables the use of a symmetric simulation. Although the transducer it-
self is circular-symmetric regardless of the medium, a fully heterogeneous medium is not
symmetric in any way. This is why circular-symmetric simulation requires homogeneous
media. Piston transducers may, however, be used for heterogeneous medias as well, but
then the computation is performed in full 3D. Using circular symmtry, the diffraction is no
longer solved using the Angular Spectrum Method, but with a finite difference discretiza-
tion of the parabolic approximation of the wave equation, the classic KZK equation. The
tutorial follows the script in tutorial_3Dnonsym.

2.4.1 Preparing the simulation

The input variables to initpropcontrol is much the same as presented in Table 2.1,
but we add quite a few input arguments. For now, the flags diffrflag is set to 4 (or 5)
and nonlinflag is 1. The difference between diffrflag 4 and 5 is described in Section 3.1.
Note that ndim is kept as 2. This denotes the dimensions of the computational domain,
not the physical dimensions. Because of the symmetry conditions, the wave field is only
treated in the half-plane. Further we intend to do fifth harmonic imaging at 7.5 MHz,
requiring a transmit frequency of 1.5 MHz. One thing to keep in mind is that the input
argument fi in Propcontrol denotes the imaging frequency, whereas the field fc denotes
the center frequency of the transmitted pulse. This should on input be specified then
as fi of 7.5 MHz and harm as 5 denoting the fifth harmonic. The number of periods in
the transmitted pulse is 8 to ensure a high degree of generation. The transmit pressure
is set to 1 MPa, and no apodization is used. The number of elements in azimuth (and
elevation) is one (single element piston transducer), and the aperture size is 22.4 mm.
The transducer is focused at 60 mm, and the endpoint of the simulation is at 100 mm.
Using circular symmetry, the computation is performed in the half domain, and a wave
field in the half domain is plotted below in Figure 2.9.

2.4.2 Running the simulation

Non-linear simulations are more computationally demanding than linear due to the need
for several substeps through the introduction of operator splitting. The output produced
from the first two parts of the tutorial is:
Start of part 1 : Preparing the simulation

The P r o p c o n t r o l i s c r e a t e d u s i n g i n i t p r o p c o n t r o l with a set o f arguments


s i m i l a r t o t h e 2D t u t o r i a l s i m u l a t i o n . A 3D s i m u l a t i o n with r o t a t i o n a l
symmetry a l l o w s f o r a 2D c a l c u l a t i o n domain .

P r e s s any key t o c o n t i n u e
16 CHAPTER 2. TUTORIALS

In put v a r i a b l e s f o r P r o p c o n t r o l :
name = ’ test 3Dnonsym ’ ;
ndim = 2;
flags = [4 ,0 ,1 ,0 ,1 ,0 ,1];
harm = 5;
fi = 7.5;
bandwidth = 0 . 5 ;
Np = 8;
amp = 1;
m a t e r i a l = WATER;
temp = 20;
endpoint = 0 . 1 ;
Faz = 0.06;
Ne l az = 1;
dimelaz = 22.4;

P r e s s any key t o c o n t i n u e

Generate P r o p c o n t r o l and p u l s e

P r e s s any key t o plot p u l s e


3D symmetric p u l s e s i s shown i n h a l f domain
plot pulse (u , Propcontrol ) ;

P r e s s any key t o c o n t i n u e t o t h e next p a r t

S t a r t o f p a r t 2 : Running t h e s i m u l a t i o n

The s i m u l a t i o n i t s e l f i s run u s i n g t h e function beamsim a s f o r t h e


l i n e a r 2D s i m u l a t i o n .

P r e s s any key t o c o n t i n u e

[ u out , P r o p c o n t r o l , rmspro , maxpro , a x p l s e ] = beamsim ( P r o p c o n t r o l , u ) ;


S t a r t i n g non−l i n e a r s i m u l a t i o n o f s i z e 384 x 3072
Simulation to f i n a l endpoint i s 10.00 percent complete ( s t . 2 0 / 2 0 0 ) , ETA 1 2 : 2 1
Simulation to f i n a l endpoint i s 20.00 percent complete ( s t . 4 0 / 2 0 0 ) , ETA 1 2 : 2 2
Simulation to f i n a l endpoint i s 30.00 percent complete ( s t . 6 0 / 2 0 0 ) , ETA 1 2 : 2 1
Simulation to f i n a l endpoint i s 40.00 percent complete ( s t . 8 0 / 2 0 0 ) , ETA 1 2 : 2 1
Simulation to f i n a l e n d p o i n t i s 5 0 . 0 0 p e r c e n t c o m p l e t e ( s t . 1 0 0 / 2 0 0 ) , ETA 1 2 : 2 1
Simulation to f i n a l e n d p o i n t i s 6 0 . 0 0 p e r c e n t c o m p l e t e ( s t . 1 2 0 / 2 0 0 ) , ETA 1 2 : 2 1
Simulation to f i n a l e n d p o i n t i s 7 0 . 0 0 p e r c e n t c o m p l e t e ( s t . 1 4 0 / 2 0 0 ) , ETA 1 2 : 2 1
Simulation to f i n a l e n d p o i n t i s 8 0 . 0 0 p e r c e n t c o m p l e t e ( s t . 1 6 0 / 2 0 0 ) , ETA 1 2 : 2 1
Simulation to f i n a l e n d p o i n t i s 9 0 . 0 0 p e r c e n t c o m p l e t e ( s t . 1 8 0 / 2 0 0 ) , ETA 1 2 : 2 1
Simulation f i n i s h e d in 9 9 . 7 6 min u s i n g an a v e r a g e o f 2 9 . 9 3 sec pr s t e p

2.4.3 Visualizing beam profiles

Again, we have a set of nsteps 1D beam profiles, each over r for each depth z. The
beam profile for the total field and all the harmonic frequencies are visualized using
plot_beamprofile and presented in Figure 2.10. The 1D focal beam profile for all the
harmonics are presented in Figure 2.11. The on-axis pulse for a nonlinear simulation
may be seen in Figure 2.12. The output from the third part of the tutorial should look
something like:
Start of part 3: V i s u a l i z a t i o n of r e s u l t s
2.4. TUTORIAL 4: 3D NON-LINEAR HOMOGENEOUS BEAM SIMULATION WITH ROTATIONAL S

Figure 2.9: The generated half domain wave field at the transducer surface.

In t h i s p a r t we w i l l plot t h e beam p r o f i l e s o b t a i n e d by beamsim .


S i n c e t h i s i s a 3D symmetric s i m u l a t i o n , o n l y t h e ( r , z)− p l a n e
p r o f i l e i s a v a i l a b l e . We w i l l a l s o plot t h e f o c a l p r o f i l e and
t h e on−axis p u l s e f o r each s t e p .

P r e s s any key t o plot beam p r o f i l e


p l o t b e a m p r o f i l e ( rmspro , P r o p c o n t r o l ) ;

P r e s s any key t o plot f o c a l p o i n t beam p r o f i l e


Find i n d e x o f f o c a l p r o f i l e
i d x = P r o p c o n t r o l . Fx / P r o p c o n t r o l . s t e p s i z e + 1 ;
p l o t b e a m p r o f i l e ( rmspro ( : , : , idx , : ) , P r o p c o n t r o l ) ;

P r e s s any key t o plot on−axis p u l s e s


p l o t p u l s e ( axplse , Propcontrol , 1 ) ;
18 CHAPTER 2. TUTORIALS

Figure 2.10: The temporal RMS-value of the radiated ultrasound beam in depth over the radial
direction.
2.4. TUTORIAL 4: 3D NON-LINEAR HOMOGENEOUS BEAM SIMULATION WITH ROTATIONAL S

Figure 2.11: The temporal RMS-value of the radiated ultrasound beam at the focal point as a
function of r.
20 CHAPTER 2. TUTORIALS

Figure 2.12: The on-axis pulse for each depth (right) and its frequency spectrum (right).
2.5. TUTORIAL 5: 3D NON-LINEAR HETEROGENEOUS BEAM SIMULATION FROM AN ARBITR

2.5 Tutorial 5: 3D non-linear heterogeneous beam simula-


tion from an arbitrary transducer

The goal of this tutorial is to set up and run a non-linear 3D simulation using a rectangular
transducer in a heterogeneous material, and to store away the wave field at some pre-
defined positions.
This tutorial will set up a 3D beam simulation using a 1.75D array probe. The medium
is non-linear and heterogeneous muscle tissue at 37 degrees. The aberrating body wall is
contructed as a delay screen body wall generated from a set of random numbers, and is
set to be 20 mm thick by default. The diffraction is solved in the frequency domain using
the Angular Spectrum Method, and to ensure a further speed-up of the calculations, the
equidist flag is specified. Attenuation is for a non-linear medium not baked into the wave
number operator, but is solved separately as a part of the operator splitting scheme. The
tutorial follows the test script tutorial_3Dnonhet.m.

2.5.1 Preparing the simulation

The Propcontrol is prepared as described in Tutorial 3 (Sec. 2.3), but the nonlinflag
and abflag are set to one. The default imaging frequency is still 3 MHz, but now a
second-harmonic imaging scheme is prepared, i.e., the parameter harmonic is set to 2
and the transmit frequency is 1.75 MHz. The focal depths are in azimuth and elevation
70 mm and 50 mm respectively. The transducer uses delay focusing for both azimuth
and elevation, and the transducer consist of 64 elements in azimuth and 5 elements in
elevation. All elements are equal in size, and the total apertures are 22.4 mm and 12
mm for azimuth and elevation respectively. A rectangular apodization if used for both
azimuth and elevation.
The transmitted wave field may be seen in Figure 2.13, and this is similar, but not equal
to the one used in Tutorial 3 in Figure 2.6.

2.5.2 Running the simulation

3D non-linear simulations are the most computationally demanding. The sampling and
size of the computational domain is similar to the one used in Tutorial 3. The output
produced from the first two parts of the tutorial is:
Start of part 1 : Preparing the simulation

The P r o p c o n t r o l i s c r e a t e d u s i n g i n i t p r o p c o n t r o l with a set o f arguments


s i m i l a r t o t h e 3D t u t o r i a l s i m u l a t i o n .

P r e s s any key t o c o n t i n u e

In put v a r i a b l e s f o r P r o p c o n t r o l :
name = ’ test 3Dnonhet ’ ;
ndim = 3;
flags = [1 ,1 ,1 ,1 ,0 ,1 ,2];
harm = 2;
fi = 3.0;
bandwidth = 0 . 5 ;
Np = 2.5;
22 CHAPTER 2. TUTORIALS

Figure 2.13: The generated 3D wave field at the transducer surface. The elevation direction
uses a delay focusing and no apodization.

amp = 0.5;
material = MUSCLE;
temp = 37;
endpoint = 0.1;
Faz = 0.07;
Ne l az = 64;
dimelaz = 3 . 5 e −4;
Fel = 0.05;
Nelel = 5;
dimelel = 2 . 5 e −3;

P r e s s any key t o c o n t i n u e

Generate P r o p c o n t r o l and p u l s e

P r e s s any key t o plot p u l s e


plot pulse (u , Propcontrol ) ;

S t a r t o f p a r t 2 : Running t h e s i m u l a t i o n

The s i m u l a t i o n i t s e l f i s run u s i n g t h e function beamsim a s f o r t h e


l i n e a r 2D s i m u l a t i o n .

P r e s s any key t o c o n t i n u e

[ u out , P r o p c o n t r o l , rmspro , maxpro , a x p l s e ] = beamsim ( P r o p c o n t r o l , u);


S t a r t i n g non−l i n e a r s i m u l a t i o n o f s i z e 256 x 192 x 512
E n t e r i n g body w a l l
S i m u l a t i o n t o end o f body wa ll i s 6.25 percent complete ( s t . 1/ 1 6 ) , ETA 1 8 : 2 7
S i m u l a t i o n t o end o f body wa ll i s 1 2 . 5 0 p e r c e n t c o m p l e t e ( s t . 2/ 1 6 ) , ETA 1 8 : 2 6
S i m u l a t i o n t o end o f body wa ll i s 1 8 . 7 5 p e r c e n t c o m p l e t e ( s t . 3/ 1 6 ) , ETA 1 8 : 2 4
2.5. TUTORIAL 5: 3D NON-LINEAR HETEROGENEOUS BEAM SIMULATION FROM AN ARBITR

S i m u l a t i o n t o end o f body wa ll i s 2 5 . 0 0 p e r c e n t c o m p l e t e ( s t . 4/ 16) , ETA 18:24


S i m u l a t i o n t o end o f body wa ll i s 3 1 . 2 5 p e r c e n t c o m p l e t e ( s t . 5/ 16) , ETA 18:24
S i m u l a t i o n t o end o f body wa ll i s 3 7 . 5 0 p e r c e n t c o m p l e t e ( s t . 6/ 16) , ETA 18:26
S i m u l a t i o n t o end o f body wa ll i s 4 3 . 7 5 p e r c e n t c o m p l e t e ( s t . 7/ 16) , ETA 18:26
S i m u l a t i o n t o end o f body wa ll i s 5 0 . 0 0 p e r c e n t c o m p l e t e ( s t . 8/ 16) , ETA 18:34
S i m u l a t i o n t o end o f body wa ll i s 5 6 . 2 5 p e r c e n t c o m p l e t e ( s t . 9/ 16) , ETA 18:35
S i m u l a t i o n t o end o f body wa ll i s 6 2 . 5 0 p e r c e n t c o m p l e t e ( s t . 10/ 16) , ETA 18:34
S i m u l a t i o n t o end o f body wa ll i s 6 8 . 7 5 p e r c e n t c o m p l e t e ( s t . 11/ 16) , ETA 18:34
S i m u l a t i o n t o end o f body wa ll i s 7 5 . 0 0 p e r c e n t c o m p l e t e ( s t . 12/ 16) , ETA 18:34
S i m u l a t i o n t o end o f body wa ll i s 8 1 . 2 5 p e r c e n t c o m p l e t e ( s t . 13/ 16) , ETA 18:33
S i m u l a t i o n t o end o f body wa ll i s 8 7 . 5 0 p e r c e n t c o m p l e t e ( s t . 14/ 16) , ETA 18:34
S i m u l a t i o n t o end o f body wa ll i s 9 3 . 7 5 p e r c e n t c o m p l e t e ( s t . 15/ 16) , ETA 18:33
save p u l s e t o t e s t 3 D n o n h e t 0 2 0 0 0 . mat
Done with body w a l l
Simulation to f i n a l endpoint i s 1.56 percent complete ( s t . 1/ 64) , ETA 17:19 (+1)
Simulation to f i n a l endpoint i s 3.12 percent complete ( s t . 2/ 64) , ETA 17:19 (+1)
Simulation to f i n a l endpoint i s 4.69 percent complete ( s t . 3/ 64) , ETA 17:20 (+1)
Simulation to f i n a l endpoint i s 6.25 percent complete ( s t . 4/ 64) , ETA 17:20 (+1)
Simulation to f i n a l endpoint i s 7.81 percent complete ( s t . 5/ 64) , ETA 17:21 (+1)
Simulation to f i n a l endpoint i s 9.38 percent complete ( s t . 6/ 64) , ETA 17:21 (+1)
Simulation to f i n a l endpoint i s 10.94 percent complete ( s t . 7/ 64) , ETA 17:21 (+1)
Simulation to f i n a l endpoint i s 12.50 percent complete ( s t . 8/ 64) , ETA 17:22 (+1)
Simulation to f i n a l endpoint i s 14.06 percent complete ( s t . 9/ 64) , ETA 17:22 (+1)
Simulation to f i n a l endpoint i s 15.62 percent complete ( s t . 10/ 64) , ETA 17:59 (+1)
Simulation to f i n a l endpoint i s 17.19 percent complete ( s t . 11/ 64) , ETA 18:31 (+1)
Simulation to f i n a l endpoint i s 18.75 percent complete ( s t . 12/ 64) , ETA 18:40 (+1)
Simulation to f i n a l endpoint i s 20.31 percent complete ( s t . 13/ 64) , ETA 18:36 (+1)
Simulation to f i n a l endpoint i s 21.88 percent complete ( s t . 14/ 64) , ETA 18:33 (+1)
Simulation to f i n a l endpoint i s 23.44 percent complete ( s t . 15/ 64) , ETA 18:28
Simulation to f i n a l endpoint i s 25.00 percent complete ( s t . 16/ 64) , ETA 18:23
Simulation to f i n a l endpoint i s 26.56 percent complete ( s t . 17/ 64) , ETA 18:20
Simulation to f i n a l endpoint i s 28.12 percent complete ( s t . 18/ 64) , ETA 18:16
Simulation to f i n a l endpoint i s 29.69 percent complete ( s t . 19/ 64) , ETA 18:13
Simulation to f i n a l endpoint i s 31.25 percent complete ( s t . 20/ 64) , ETA 18:11
Simulation to f i n a l endpoint i s 32.81 percent complete ( s t . 21/ 64) , ETA 18:08
Simulation to f i n a l endpoint i s 34.38 percent complete ( s t . 22/ 64) , ETA 18:07
Simulation to f i n a l endpoint i s 35.94 percent complete ( s t . 23/ 64) , ETA 18:05
save p u l s e t o t e s t 3 D n o n h e t 0 5 0 0 0 . mat
Simulation to f i n a l endpoint i s 37.50 percent complete ( s t . 24/ 64) , ETA 18:03
Simulation to f i n a l endpoint i s 39.06 percent complete ( s t . 25/ 64) , ETA 18:02
Simulation to f i n a l endpoint i s 40.62 percent complete ( s t . 26/ 64) , ETA 18:00
Simulation to f i n a l endpoint i s 42.19 percent complete ( s t . 27/ 64) , ETA 17:59
Simulation to f i n a l endpoint i s 43.75 percent complete ( s t . 28/ 64) , ETA 17:57
Simulation to f i n a l endpoint i s 45.31 percent complete ( s t . 29/ 64) , ETA 17:57
Simulation to f i n a l endpoint i s 46.88 percent complete ( s t . 30/ 64) , ETA 17:55
Simulation to f i n a l endpoint i s 48.44 percent complete ( s t . 31/ 64) , ETA 17:55
Simulation to f i n a l endpoint i s 50.00 percent complete ( s t . 32/ 64) , ETA 17:54
Simulation to f i n a l endpoint i s 51.56 percent complete ( s t . 33/ 64) , ETA 17:52
Simulation to f i n a l endpoint i s 53.12 percent complete ( s t . 34/ 64) , ETA 17:52
Simulation to f i n a l endpoint i s 54.69 percent complete ( s t . 35/ 64) , ETA 17:51
Simulation to f i n a l endpoint i s 56.25 percent complete ( s t . 36/ 64) , ETA 17:51
Simulation to f i n a l endpoint i s 57.81 percent complete ( s t . 37/ 64) , ETA 17:50
Simulation to f i n a l endpoint i s 59.38 percent complete ( s t . 38/ 64) , ETA 17:50
Simulation to f i n a l endpoint i s 60.94 percent complete ( s t . 39/ 64) , ETA 17:49
save p u l s e t o t e s t 3 D n o n h e t 0 7 0 0 0 . mat
Simulation to f i n a l endpoint i s 62.50 percent complete ( s t . 40/ 64) , ETA 17:49
Simulation to f i n a l endpoint i s 64.06 percent complete ( s t . 41/ 64) , ETA 17:48
Simulation to f i n a l endpoint i s 65.62 percent complete ( s t . 42/ 64) , ETA 17:48
Simulation to f i n a l endpoint i s 67.19 percent complete ( s t . 43/ 64) , ETA 17:47
Simulation to f i n a l endpoint i s 68.75 percent complete ( s t . 44/ 64) , ETA 17:47
Simulation to f i n a l endpoint i s 70.31 percent complete ( s t . 45/ 64) , ETA 17:46
Simulation to f i n a l endpoint i s 71.88 percent complete ( s t . 46/ 64) , ETA 17:46
24 CHAPTER 2. TUTORIALS

Simulation to f i n a l endpoint i s 73.44 percent complete ( s t . 47/ 6 4 ) , ETA 1 7 : 4 5


Simulation to f i n a l endpoint i s 75.00 percent complete ( s t . 48/ 6 4 ) , ETA 1 7 : 4 4
Simulation to f i n a l endpoint i s 76.56 percent complete ( s t . 49/ 6 4 ) , ETA 1 7 : 4 5
Simulation to f i n a l endpoint i s 78.12 percent complete ( s t . 50/ 6 4 ) , ETA 1 7 : 4 4
Simulation to f i n a l endpoint i s 79.69 percent complete ( s t . 51/ 6 4 ) , ETA 1 7 : 4 4
Simulation to f i n a l endpoint i s 81.25 percent complete ( s t . 52/ 6 4 ) , ETA 1 7 : 4 3
Simulation to f i n a l endpoint i s 82.81 percent complete ( s t . 53/ 6 4 ) , ETA 1 7 : 4 3
Simulation to f i n a l endpoint i s 84.38 percent complete ( s t . 54/ 6 4 ) , ETA 1 7 : 4 3
Simulation to f i n a l endpoint i s 85.94 percent complete ( s t . 55/ 6 4 ) , ETA 1 7 : 4 3
Simulation to f i n a l endpoint i s 87.50 percent complete ( s t . 56/ 6 4 ) , ETA 1 7 : 4 2
Simulation to f i n a l endpoint i s 89.06 percent complete ( s t . 57/ 6 4 ) , ETA 1 7 : 4 2
Simulation to f i n a l endpoint i s 90.62 percent complete ( s t . 58/ 6 4 ) , ETA 1 7 : 4 2
Simulation to f i n a l endpoint i s 92.19 percent complete ( s t . 59/ 6 4 ) , ETA 1 7 : 4 2
Simulation to f i n a l endpoint i s 93.75 percent complete ( s t . 60/ 6 4 ) , ETA 1 7 : 4 1
Simulation to f i n a l endpoint i s 95.31 percent complete ( s t . 61/ 6 4 ) , ETA 1 7 : 4 1
Simulation to f i n a l endpoint i s 96.88 percent complete ( s t . 62/ 6 4 ) , ETA 1 7 : 4 1
Simulation to f i n a l endpoint i s 98.44 percent complete ( s t . 63/ 6 4 ) , ETA 1 7 : 4 0
Simulation finished i n 1 3 8 7 . 0 0 min u s i n g an a v e r a g e o f 1 3 0 0 . 3 1 sec pr step

2.5.3 Visualizing beam profiles

As for the linear simulation, we have a set of nsteps 2D beam profiles. This is visualized
using plot_beamprofile and presented in Figure 2.14. The cross sectional focal profiles
for the azimuth and elevation foci are shown in Figure 2.15 and Figure 2.16. Using a
historyflag of 2, the wave field is also stored at certain position pre-defined in the field
storepos. The wave field at the end of the body wall (at z=d =20 mm) is loaded and
visualized in Figure 2.17. The output from the third part of the tutorial should look
something like:
Start of part 3: V i s u a l i z a t i o n of r e s u l t s

In t h i s p a r t we w i l l plot t h e beam p r o f i l e s o b t a i n e d by beamsim .


We w i l l plot t h e ( x , z ) and ( y , z)− p l a n e beam p r o f i l e s , t h e ( x , y)−
p l a n e f o c a l p r o f i l e f o r both t h e azimuth and e l e v a t i o n f o c i . The
p u l s e a t t h e end o f t h e body w a l l w i l l a l s o be v i s u a l i z e d .

P r e s s any key t o plot beam p r o f i l e


p l o t b e a m p r o f i l e ( rmspro , P r o p c o n t r o l ) ;

P r e s s any key t o plot f o c a l p o i n t beam p r o f i l e s


Find i n d e x o f azimuth f o c a l p r o f i l e
i d x = P r o p c o n t r o l . Fx / P r o p c o n t r o l . s t e p s i z e + 1 ;
p l o t b e a m p r o f i l e ( rmspro ( : , : , idx , : ) , P r o p c o n t r o l ) ;
Find i n d e x o f e l e v a t i o n f o c a l p r o f i l e
i d x = P r o p c o n t r o l . Fy / P r o p c o n t r o l . s t e p s i z e + 1 ;
p l o t b e a m p r o f i l e ( rmspro ( : , : , idx , : ) , P r o p c o n t r o l ) ;

P r e s s any key t o plot t h e p u l s e a t t h e end o f t h e body w a l l


Find t h e f i l e n a m e o f t h e p u l s e
f n = [ P r o p c o n t r o l . simname g e t s t r p o s ( P r o p c o n t r o l . d∗1 e3 ) ’ . mat ’ ] ;
load ( fn , ’ u z ’ ) ;
plot pulse ( u z , Propcontrol ) ;
2.5. TUTORIAL 5: 3D NON-LINEAR HETEROGENEOUS BEAM SIMULATION FROM AN ARBITR

Figure 2.14: The temporal RMS-value of the radiated ultrasound beam in depth.
26 CHAPTER 2. TUTORIALS

Figure 2.15: The temporal RMS-value of the cross sectional profile at the azimuth focal point.
Note: the scale of the x- and y-axis are not equal.
2.5. TUTORIAL 5: 3D NON-LINEAR HETEROGENEOUS BEAM SIMULATION FROM AN ARBITR

Figure 2.16: The temporal RMS-value of the cross sectional profile at the elevation focal point.
Note: the scale of the x- and y-axis are not equal.
28 CHAPTER 2. TUTORIALS

Figure 2.17: The wave field at the inner boundary of the body wall z=d.
Chapter 3

Function Reference

This chapter is a reference chapter for the main functions of Abersim. The functions
may be divided into categories related to the preparation and running of a simulation,
propagation core routines, material library and aberration functions.

3.1 The Propcontrol Struct

The Propcontrol is a struct consisting of several variables controlling the simulations in


Abersim. Propcontrol is passed on to functions as an argument, and will be updated
throughout the simulation and stored together with exported pulses and profiles. The
latter is to ensure that when a pulse is loaded, the Propcontrol stored together with it
will provide information about the position, sampling etc. of the pulse. The Propcontrol
has several fields described below. All field varaible names will be given in italic fonts.

3.1.1 The Fields of ’Propcontrol’

A description of all fields of Propcontrol and their effects is provided below.

simname The name of the simulation. The simname is used as a root for all
storage to disk. Depending on the specific export, some additional ex-
tenisions will be added, but the root of the filename is allways simname.

ndims The number of dimensions for the calculation domain. A 3D axis-


symmetric simulation has a 2D computational domain, and ndims is
therefore set to 2 in this case.

29
30 CHAPTER 3. FUNCTION REFERENCE

nx, ny, nt The number of points along each dimension. This is also the length of
the Fourier transforms used. The first dimension (azimuth) is x, the
second (elevation) is y, and t is the temporal dimension. The number
of points are calculated automatically by initpropcontrol to yield a
sufficiently large calculation domain, and is adjusted upward to yield
number consisting of low factors to make the Fourier transform more
efficient. Because Abersim integrates in the depth coordinate z, there is
no need for a variable for nz. For 2D simulations ny is set to 1. Please
note that the wave field itself is stored using Matlab column major
ordering, making the temporal dimension to be the first, the elevation
the second and the azimuth the third. For 2D grids, azimuth will be
the second dimension.

PMLwidth The width of the absorbing boundary layer. Abersim has a Perfectly
Matched Layer (PML) implemented, but this is more or less phased out
and replaced by a regular window function to ensure better periodicity
of the wave field and reduce wrap around effects introduced by the FFT.

diffrflag Flag determining the type of diffraction solver. The table below de-
scribes the different possibilities:
0 No diffraction.
1 Diffraction using the Angular Spectrum Method, or the
pseudo-diferential model, described by Varslot and Taraldsen
in Ref. [10] or Varslot and Måsøy in Ref. [9]. This solves the
diffraction term exactly, but requires periodic boundary con-
ditions (because of the Fourier transform). The wave number
operator is fully contructed and enables the use of equidistant
steps.
2 The same as 1, but the wave number operator is not contructed
explicitly to save memory. Equidistant steps may not be used.
3 Not yet available.
4 Diffraction using a finite difference scheme presented by Varslot
and Taraldsen in Ref. [10]. Here, the parabolic approximation
is made, and the diffraction is not solved exactly.
5 The same as 4, but all matrices are made banded so that
banded BLAS may be utilized to speed up the computation.
nonlinflag Switch non-linearity on or off. The value 1 denotes on.

lossflag The lossflag switches on (1) or off (0) frequency dependent attenuation.
See Section 3.3.6 for more information about the attenuation itself.

abflag Flag for heterogeneities. The different types of heterogeneities are de-
scribed below:
0 No aberration and homogeneous medium.
1 Aberration from a delay screen body wall. The body wall is
contructed from a series of random numbers filtered to yield
the desired statistics. See Section 3.5.4 for more information.
3.1. THE PROPCONTROL STRUCT 31

annflag Flag for annular transducer. If the transducer surface is circular, the
annflag should be set to 1. This enables the use of a 2D computa-
tion domain if the medium is homogeneous. For arbitrary transducer
geometries annflag must be set to 0.

equidistflag This flag should be switched on (set to 1) if the stepsize throughout the
whole simulation is equal. When this flag is set, all steps are assumed
to be of equal length, and the computation may be performed faster.
See Section 3.3.2 for more information.

historyflag Flag for simulation export and history. Abersim may export profiles,
pulses or both dependent on this flag. For more information on profiles
and history, please see Section 3.2.3. The different options are:
0 No history. No profiles or wave fields are exported or stored to
disk except for the wave field at the endpoint.
1 Profile history. The temporal maximum pressure and temporal
RMS value for all harmonics up to harm (see further down in
this section) are calculated and collected for each step. The
on-axis pulse is also exported for each step. The profiles are
stored at the end of the simulation along with the pulse at the
endpoint, and is returned as output variables from beamsim.
2 Wave field history. The wave field is stored for each step of the
simulation. No filtering or calculation of profiles are performed.
stepsize The stepsize, ∆z, of the simulation. This should not be confused with
the substeppsing dz presented later on. The computation time per step
is for linear simulations constant. Because of this, the total computa-
tion time will descrease with increasing stepsize. An increase in stepsize
should, however, must be handled with care to avoid “reflections” from
the periodic boundary conditions. For non-linear simulations, an oper-
ator splitting is performed, and the substepsize dz is fixed. Because of
this, the number of substeps increases for increasing stepsize, but the
total computation time will be less dependent on the length of ∆z.

shockstep A factor used to avoid shock formation. The non-linear solver does not
have a shock-capturing routine, and if the distortion is too large, then
the stepsize is shortened. This factor influence the threshold of when to
sub-divide the original substep of the non-linear propagation.

endpoint The endpoint ze of the simulation. For simulation with no export, the
endpoint should be set to the point of interest, e.g., the focal point.

currentpos The current position in depth z of a wave field. Is updated for each step
and works as a position indicator for stored wave fields.

storepos The positions at which to store wave fields. This is set to be both the
azimuth and the elevation focal point as well as the inner boundary of
the body wall for heterogeneous simulations.
32 CHAPTER 3. FUNCTION REFERENCE

material The Material struct for the simulation. Each material has certain
properties, and this struct contains all these properties. For more infor-
mation on the material handling in Abersim, please consult Section 3.4.
The struct has the followin fields:
i The material indentifier. All materials are equipped wih an
indentifier.
temp The temperature of the material in Celcius.
eps A vector containing [n , a , B ].
c0 The background speed of sound c0 .
rho The mass density ρ.
kappa The compressibility κ∞ .
betan The coefficient of non-linearity βn .
a The attenuation constant a.
b The attenuation frequency exponent b.
d The thickness of the body wall (or aberrator). See Section 3.5 for more
information.

offset The offset of the transducer relative to a reference position. This is used
for heterogeneous mediums when adjacent beams are to be compared.
The aberrator should thus not change significantly, but be shifted a
small amount. See Section 3.5 for more information.

numscreens The number of screens used in the delay screen body wall model. See
Section 3.5.4 for more information.

abamp The amplitude of each delay screen. This may be tuned to construct
weak and strong aberrators. See Section 3.5.4 for more information.

ablength The length scales of each delay screen. The screen is constructed by fil-
tering random numbers using a spatial bandpass filter. The ablength de-
fines the shortest and longest length scale of the heterogeneities, i.e., the
filter band. See Section 3.5.4 for more information.

abfile The filename of the file where the aberrator is stored. For the delay
screen model, this is the file of random numbers. For the aberration
phantom it is the file containing the list of the coordinates and radii of
all the spheres. See Section 3.5 for more information.

Fs The sampling frequency. This is set to be the maximum of either 40


MHz or 10·fc .

dx, dy, dz, dt The resolution in space dx, dy and time dt. The spatial resolution is
given as λ2 where λ= cf0i where fi is the imaging frequency. Then the spa-
tial resolution is adjusted downward to yield an integer number of res-
olution points per element size e defined in the fields esizex and esizey.
The temporal resoltion is given as dt= F1s . The dz is the sub-cycling
step of the non-linear propagation and is given by the wave number
c0
dz=kt = 2πf c
where fc is the transmitted frequency. See Section 3.3 and
3.2.1 for more information.
3.1. THE PROPCONTROL STRUCT 33

fc The transmitted center frequency. Abersim generated pulses have a


Gaussian shape and a center frequency of fc . This frequency related to
the n’th harmonic imaging frequency by fi = nh fc where nh denotes
the n’th harmonic.

bandwidth The relative bandwidth of the transmitted pulse, not the transducer, and
is defined as a fraction, e.g., 0.5 equals 50% bandwidth. See Section 3.2.1
for more information.

Np The number of periods in the transmitted pulse. See Section 3.2.1 for
more information.

amplitude The pressure amplitude of the transmitted pulse in MPa. See Sec-
tion 3.2.1 for more information.

harmonic The harmonic frequency used for imaging, i.e., if harm is set to 2, then
second-harmonic imaging is performed. If harm is set to 3, then third-
harmonic and so forth. See Section 3.2.1 for more information.

filter A vector containing filter coefficients for each harmonic frequency. De-
fined as fractional bandwidth of the frequency of interest. See Sec-
tion 3.2.3 for more information.

Dx, Dy Aperture size in x (azimuth) and y (elevation) direction. See Sec-


tion 3.2.1 for more information.

Fx, Fy Focal depth in x (azimuth) and y (elevation) direction. See Section 3.2.1
for more information.

cchannel Center channel of transducer. Determines the positioning of the pulse


within the computational domain. See Section 3.2.1 for more informa-
tion.

Nex, Ney The number of transducer elements along each dimension. See Sec-
tion 3.2.1 for more information.

esizex, esizey The size of the transducer elements along each dimension. See Sec-
tion 3.2.1 for more information.

3.1.2 The Function ’initpropcontrol’

This function initiates the Propcontrol. The function takes several input arguments,
and the default values of all fields may be found in Tutorial 1 (Sec. 2.1). The help file for
the initpropcontrol is quite self-explainable.
34 CHAPTER 3. FUNCTION REFERENCE

3.2 The Simulation Itself

Abersim simulates forward propagation of acoustic pulses. By forward, we mean only


one direction. The solution of the wave equation has two waves propagating in opposite
directions, but Abersim chooses one of them, and forgets the other. This makes back
scattering simulations somewhat troublesome in Abersim as they have to be split up in
several simulations, but it is possible to perform this type of simulations.
Abersim integrates the wave field in the depth coordinate z, and this is possbile using the
concept of retarded time (see Section 3.3). This is equivalent to following the propagating
wave field. The wave field itself does not propagate in depth within the moving frame
of reference. Within this frame of reference, no approximations are made. The wave
equation in retarded time is then solved keeping only the forward component.
This section seek to present the most important functions involved in a full beam simu-
lation. These functions are:
• pulsegenerator
• beamsim
• pointsourcesim
• export_beamprofile
• plot_pulse
• plot_beamprofile
The simulation consist of three steps: Preparation, propagation and visualization. The
preparation part is covered by setting up Propcontrol and the wave field at the trans-
ducer. The latter may be done using pulsegenerator. For more complex wave fields,
pulsegenerator will be insufficient, and the user must specify the wave field manually.
The simulation itself is run using beamsim, and the export and visualization routines are
also decribed in this section.

3.2.1 The Function ’pulsegenerator’

This function will generate initial wave fields in Abersim. Both pulse shape and transducer
geometry may be arbitrary. One important physical interpretation is that the transducer
surface is plane. All focusing is assumed to be either delay or lens focusing.

The Computational Domain

The computational domain in Abersim is a moving reference frame, or a retarded time


frame. The retarded time frame consist of a plane and an interval in time. The plane
extends into the (x, y)- or (r, θ)-plane, and is positioned at depth z, or in retarded time as
τ =t− zc =0. The extension in time may be described as a recording of all wave passing this
plane over a time interval τ =[− n2t dt, n2t dt]. The reference frame is thus a domain with
dimensions (x, t) or (r, t) for 2D simulations and (x, y, t) for 3D. The extensions of the
spatial dimensions are either [− n2x dx, n2x dx] (and similar for y) for 2D and 3D simulations
with no symmetry, and [0, nx dx] for 3D circular symmetric simulations.
3.2. THE SIMULATION ITSELF 35

The center channel relates to the computational domain, and determines where the trans-
ducer should be placed in the retarded time frame. The center channel is given as a matrix
index and not as a pysical position in space. The center channel is thus for regular 2D and
n
3D x/y2 + 1 and 1 for both x and y for 3D circular symmetric simulations. This ensure
the zero to be placed at the center of the computational domain, see the next paragraph
for more information on transducer coordinates.

Coordinates of the Transducer

The coordinate system of the transducer is important when it comes to defining the
transmitted wave field. As for all numerical purposes a discretization must be made, and
the nodal value represents the measure of interest in a neighborhood around its position.
Figure 3.1 shows how the nodal values are defined and their region of validity.
For a rectangular transducer the number of resolution points dx per element e may be
arbitrary. For an annular transducer, however, the center element must have an odd
number of resolution points to ensure symmetry. The other elements may consist of an
arbitrary number of points. The bandwidth of the transducers used in Abersim is assumed
to be infinite, and the sensitivity is assumed to be 1 for all frequencies. All bandwidths
used in Abersim relates to the pulses, not the transducer.

Pulse Shape

The default pulse shape produced by Abersim is a cosine signal of frequency fc with a
half-period cosine envelope of length equal to Np (specified in field Np) periods of the
form:  
fc Np Np
p = cos (2πfc t) cos π t , t ∈ [− Tp , Tp ],
Np 2 2
where Tp = f1c is the period of the signal. The length Np does not have to be an integer.
The pulse is then filtered in the frequency domain with a Gaussian filter of the form
“ ”4
||f |−fc |
2a
H(f ) = e Bfc

6
where a= log10 10 20 , fc the center frequency of the pulse, f the frequencies covered by
the filter and B the -6 dB fractional bandwidth of the signal given by the Propcontrol
field bandwidth. The amplitude of the pulse is then scaled so that the maximum of the
envelope equals P0 , the amplitude field specifed in Propcontrol.
An arbitrary pulse shape provided by the user is possible. This must be specified as a
vector of length shorter or equal to nt . The vector should be tapered to zeros at the
endpoints. If the vector is shorter than nt , it is zero-padded to length nt .

Transducer Geometry and Apodization

The transducer geometry is either rectangular or circular by default. The aperture size,
D (field Dx and Dy), of the transducer is given as:

Dx = Nx nx dx, Dy = Ny ny dy,
36 CHAPTER 3. FUNCTION REFERENCE

N =8 n=1 N =9 n=1

D = N ndx D = N ndx

e = ndx e = ndx
s s s s
s s s s s s
s s s s dx s s s dx
- -
-5 -4 -3 -2 -1 0 1 2 3 4 -5 -4 -3 -2 -1 0 1 2 3 4
(a) (b)

N =4 n=2 N =5 n=2
D = N ndx D = N ndx

e = ndx e = ndx
s s s s s s s s
s s s s dx s s s s s s dx
- -
-5 -4 -3 -2 -1 0 1 2 3 4 -5 -4 -3 -2 -1 0 1 2 3 4
(c) (d)

N =5 n=1 N =2 n=3
2N −1 2N −1
R= 2 ndx R= 2 ndx

e = ndx s e = ndx
c s s c c s s s
c s s dx c s s dx
- -
-3 -2 -1 0 1 2 3 4 5 6 -3 -2 -1 0 1 2 3 4 5 6
(e) (f)

Figure 3.1: Definition of transducer coordinates. The filled circles indicate pressure nodes and
their location. N denotes the number of elements, n the number of resolution points per element
and e the size of one element. Subfigure (a)-(d) describes rectangular transducers and (e)-(f)
annular transducers. For the annular transducers, the dashed line indicates symmetry, and the
nodes marked with an empty circle is a mirror node of the filled node at the opposite, or symmetric,
position.

where x denotes azimuth, y elevation, N is the number of elements (field Nex and Ney),
n if the number of resolution points per element and dx and dy is the spatial resolution.
For annular transducers Dx and Dy must be equal. The focal depths Fx and Fy are also
required to be equal for annular transducers.
Apodization is set by the input argument apod. Default apodization is rectangular, which
is equivalent to a matrix of ones over all active transducer elements. This corresponds
to setting apod to 0. The default transducer is assumed to have no kerfs and transmits
on adjacent elements, i.e., no sparse apertures. Annular transducers return a circular
shaped apodization of value one for full 3D simulations. The focusing bowl is calculated
independent of the apodization, and this is why it is possible to have different focusing in
azimuth and elevation direction for annular transducers. This is something to be aware
of.
3.2. THE SIMULATION ITSELF 37

Another implemented feature is the cosine apodization. This is called when apod is set
to an integer s indicating an apodization of the form:

1  √  
A= cos π x2s + 1 , x ∈ [−1, 1],
2
where x is either a scaled length measure across one of the transducer dimensions or the
radius for annular transducer.
If the input apodization is specified as a matrix, the geometric shape of the transducer
may be completely arbitrary. This is the way to generate wave fields from transducers
with complex shapes. This apodization matrix will redefine the size of the tranducer
according to what is specified in Propcontrol. To maintain the the desired size of the
transducer, the apodization matrix should then be of proper size according to the aperture
D, the element size and number of elements. The midpoint in x and y of the apodization
is the point that will collocate with the specific center channel (cchannel ) in Propcontrol.
When using heterogeneous mediums, small shifts may be produced by adjusting the center
channel. Larger shifts should be introduced through the offset field. This is to make sure
that the transducer does not come too close to the boundaries of the computational
domain.

3.2.2 The function ’beamsim’

The function beamsim is the main simulation script. This function will start up a simu-
lation and propagate a (possibly given) wave field to a desired endpoint. The functions
input arguments are Propcontrol, a wave field, a correction screen and a domain win-
dow. If the wave field is not given as input, it is generated using pulsegenerator. The
screen input is used for aberration correction, and if this argument is empty or omitted,
no correction is performed. The window input argument is the window used for tapering
the wave field to zero at the boundaries to reduce wrap-around effects.
The pseudo code for beamsim is as follows:
1. Generate wave field (if not specified)
2. Calculate number of steps needed for simulation
3. Introduce aberration correction (if screen is specified)
4. Generate wave number operator for propagation (if diffrflag is 1, 2 or 3)
5. Generate window used to taper wave field to zero at the boundaries (if not specified)
6. Export start profile
7. Run bodywall (Sec. 3.5.1) if the medium is heterogeneous
8. Run nsteps of propagation using
(a) Propagation
(b) Windowing of solution
(c) Export of history
9. Save profiles and wave field
38 CHAPTER 3. FUNCTION REFERENCE

The function beamsim should cover most beam simulations performed with Abersim. It
is not recommended to do changes in beamsim since everything that deals with the wave
field, correction and windowing may be specified as input arguments. When it comes to
export, modifications should be done in export_beamprofile rather than in beamsim.

3.2.3 The function ’export beamprofile’

This function governs the calculation and export of beam profiles and wave fields. Wave
fields are allways stored in raw format, that is: No filtering has been performed prior to
storage.

Filtering of Harmonic Components

The harmonic components of a wave field are obtained through filtering. The filter rou-
tines are far from optimal, and the user is encouraged to find and use own filters. The
field filter in Propcontrol is a vector containing a set of fractions used for filtering out
harmonic components. The vector has length nh , where nh is the highest desired harmonic
frequency.

The filter used by default is a frequency domain Gaussian bandpass filter of the kind
“ ”4
||f |−hn ft |
2a
H(f ) = e Bn hn ft

6
where a= log10 10 20 , ft the transmit frequency, f the frequencies covered by the filter, hn
is the integer denoting the n’th harmonic, and Bn is the -6 dB fractional bandwidth of
the signal specified as the n’th component of the filter vector.

Calculation of profiles

The maximum temporal pressure profile is found as the maximum of the envelope of the
filtered signal. The envelope of the filtered signal is found using:

pe (t) = |p(t) + H {p(t)}|

where H {·} denotes the Hilbert transform.

The maximum pressure is then found as

pmax = max pe (ti ),


i

where ti are the temporal nodal points and i=1, . . . , nt .

The temporal RMS value is calculated from the signal itself and not the envelope as:
v
u nt
u1 X
prms = t |p(ti )|2 .
nt
i=1
3.3. PROPAGATION 39

Storage of Wave Fields

The wave fields are stored in separate files with a name specified by simname and an
extension specifying the position of the wave field. This extension is given as a underscore
and a five digit number. The number is the position given in units of 10−5 m, or the right
digit is 1/100 of a mm. The position _99999 denotes 99.999 cm, or just below one meter.

3.2.4 The Function ’plot pulse’

The plot_pulse function visualize wave fields in Abersim. The function recognizes
whether the pulse is a 2D or 3D wave field. Wave fields are visualized in the (x, t)
(or (y, t) or (r, t)) retarded time frame, i.e., the computational domain, using a two-sided
logarithmic scale. The dynamic range is given as the input argument dyn, and the de-
fault is 40 dB. A two-sided logarithmic scale with X dB dynamic range means that the
visual parts of the wave field will range from +X dB to −X dB, where the peak positive
pressure will be at +X dB and the maximum negative pressure at −X dB. All wave field
visualizations in the (x/y/r, t)-frame is plotted in a two-sided logarithmic scale unless dyn
is set to zero, then the scale is linear. See the tutorials in Chapter 2 and the help file for
more information.
For 2D wave fields, the wave field itself is plotted as a one-panel figure. For 3D wave fields,
the figure will have four panels. The top left panel shows the wave field over the (x, t)-
frame (azimuth direction) at the elevation center channel given by the second element of
the center channel position (cchannel(2)). The bottom left panel shows the (y, t)-frame
(elevation direction) at the azimuth center channel (cchannel(1)). The top right panel
shows the center channel pulse as a function of time in a linear scale. The bottom right
panel show the RMS profile of the wave field over the azimuth and elevation direction.
This is the RMS intensity over the cross-section of the beam at position z, and is the
same as the beamprofile of the unfiltered wave field at this depth.

3.2.5 The Function ’plot beamprofile’

The plot_beamprofile function visualizes beam profiles from Abersim. The beam pro-
files are 4D arrays of dimensions (nx , ny , nz , nh ) where nz are the number of depths the
profiles are taken from, and nh the number of harmonic profiles. The beam profiles
solemnly consist of positive numbers, and the visualization is performed using a one-sided
logarithmic scale with dynamic range defined by dyn. If dyn is 0, a linear scale i used.
A full 4D beam profile will be plotted in a figure with nh × 2 panels. The left column is
the azimuth profiles of the harmonic components, and the right is the elevation. If the
size nz =1, a cross-sectional profile is visualized. If both nz and nx or ny are 1, 1D profiles
are plotted. See the tutorials in Chapter 2 and the help file for more information.

3.3 Propagation

The propagation of wave fields is the main part of Abersim. The propagation is the most
time consuming part of the code, and the one that benefits the most from optimization.
The five main functions related to propagation are:
40 CHAPTER 3. FUNCTION REFERENCE

• propagate
• get_wavenumbers
• nonlinearpropagate
• burgerssolve
• attenuationsolve

3.3.1 Short Mathematical Description

The underlying differential equation for wave propagation is the Westervelt equation

1 ∂2p βn κ ∂ 2 p2 1 ∂ 2 Lp 1
∇2 p − 2 2
=− 2 2
− 2 , c= √ ,
c ∂t c ∂t c ∂t2 ρκ

where p is the acoustic pressure, c the speed of sound, βn the coefficient of nonlinearity
and L the kernel of a convolution operator accounting for attenuation.
According to Varslot and Taraldsen in Ref. [10], the Westervelt equation may be trans-
formed into a directional wave equation through the introduction of retarded time coor-
dinate τ =t−z/c. The resulting directional Westervelt equation is then:

∂2p 1 ∂ 2 p n ∂ 2 p2 ∂ 2 Lp
∇2 − g p − t 2 +

= +  .
∂τ ∂z 2 ∂τ 2 ∂τ 2 ∂τ 2
where t , n and  are scaling constants. Integrating this with respect to the retarded
time coordinate τ we get:

1 τ ∂ 2 Lp
Z
∂p ∂p
∇2 − g p dτ0 + (n p − t )

= + .
∂z 2 −∞ ∂τ ∂τ 2

∂2p
Please note that an introduction of the parabolic approximation through ∂z 2
≈0 will result
in the classic KZK equation as:

1 τ ∂ 2 Lp
Z
∂p ∂p
∇2⊥ − g p dτ0 + (n p − t )

= + .
∂z 2 −∞ ∂τ ∂τ 2

The only difference between the directional Westervelt equation and the KZK equation is
in the diffraction term where we have not neglected diffraction in the z direction for the
Westervelt case.
Operator splitting enables the use of separate solutions for each of the three terms of both
the directional Wastervelt equation and the KZK equation. The solution of these terms
will be treated separately in the following sections (Secs. 3.3.2-3.3.6).

3.3.2 Linear Propagation and Diffraction

Focusing on the diffraction term in the Westervelt equation in retarded time, it is obvious
that this is the diffraction for a linear wave equation in a lossless medium. The linear
wave equation, or the diffraction term is:

∂2p 1
∇2 − g p,

=
∂τ ∂z 2
3.3. PROPAGATION 41

∂2 ∂2 ∂2
where ∇2⊥ = ∂x2
+ ∂y 2
+ ∂z 2
and g accounts for heterogeneities.
Abersim introduces heterogeneities using a delay screen body wall, så all propagation is
in fact homogeneous. The heterogeneous effects are introduced as phase shifts between
propagation steps (see Section 3.5). This way, g will be zero for propagation between two
screens. The diffraction term then simplifies to:

∂2p 1
= ∇2 p,
∂τ ∂z 2
All these arguments are also valid for the approximative KZK equation. Expanding the
operators and rearranging this we find the following differential equation:

∂2p 2 ∂2p
− + ∇2⊥ p = 0.
∂z 2 c ∂τ ∂z
which is a second-order partial differential equation with coupling in both x, y and τ .
Applying the Fourier transform in time (τ ) to this equation we obtain:

∂ 2 p̂ ∂ p̂ ω
− 2ikt + ∇2⊥ p̂ = 0, kt = ,
∂z 2 ∂z c
where p̂ denotes the temporal Fourier transform of p, and kt the wavenumber in time.
This equation is a linear stationary Helmholtz equation and is decoupled in time, but still
coupled in space.
A decoupling in space may be performed using a spatial Fourier transform, and this will
result in a fully decoupled second-order ordinary differential equations (ODE) as:

∂ 2 p̃ ∂ p̃
− kx2 + ky2 p̃.

2
− 2ikt
∂z ∂z
where p̃ denotes the Fourier transform in time and all spatial dimensions except the spatial
integration varaible z, and kx and ky the wavenumbers in x and y respectively. For the
discretized equation, we will have a system of ODEs, one for each combination of kx , ky
and kt , that needs to be solved.
This differential equation has a solution of the form
“√ ” “√ ”
i kt2 −kx2 −ky2 −kt h −i kt2 −kx2 −ky2 −kt h
p(z0 + h) = Ae + Be ,

where h is the stepsize.


Choosing only the solution propagating in the positive direction (within the retarded time
frame), we may find the solution to be:
q
p̃(z0 + h) = p̃(z0 )eiKz h , Kz = kt2 − kx2 − ky2 − kt ,

where Kz is a wave-number (scalar) operator. The solution at point z0 + h is thus found


throught the inverse Fourier transforms in x, y and τ of p̃. This approach is referred to
as the pseudo-differential model in Ref. [10] and [9]. Using this approach, the forward
component of the propagating wave is solved exactly in retarded time coordinates. The
KZK equation may now be modified according to this, and the parabolic approximation
may be omitted.
The algorithm for solving the diffraction (or in fact the linear wave equation) is:
42 CHAPTER 3. FUNCTION REFERENCE

1. Perform Fourier transform in space


2. Perform Fourier transform in time
3. Do multiplication with Kz for all wave numbers
4. Perform inverse Fourier transform in time
5. Perform inverse Fourier transform in space
The Propcontrol field equidistflag enables the pre-calculation of eiKz h for a constant h.
This way, the multiplication step will be a single complex multiplication for all points in
space and time instead of one complex multiplication and one complex function evaluation.
The function propagate will recognize whether the propagation is linear or non-linear
based on the Propcontrol field nonlinflag. If the propagation is linear, the algorithm
above is performed, and if the propagation is non-linear the function nonlinearpropagate
is called to perform operator splitting and sub-cycling.

3.3.3 The Wave-Number Operator

The wave-number operator Kz from the pseudo-differential model plays an important


role in the diffraction of the pulse. For linear propagation, the attenuation is baked into
the wave number operator. This is not desirable to do for non-linear propagation. The
splitting scheme for diffraction and non-linearity/attenuation uses a fixed substepsize
based on dz, but the second splitting between non-linearity and attenuation may do
even further sub-cycling to avoid shock formation by introducing attenuation more often.
This is why the attenuation is kept outside the wave number operator for non-linear
propagation.
Decoupling of the differential equation for regular 2D and 3D is performed using the
Fourier transform in the Angular Spectrum Method. The wave-number operator is stored
as an array of the same size as the wave field. The wave-number operator has the general
form: q
Kz = kt2 − kx2 − ky2 − kt .

The expression within the root may become negative and thus imaginary. These wave-
numbers must be treated with special care because the function e−iKz h will be e|Kz |h and
amplify the solution. This effect is called evanescent waves. To avoid evanescent waves,
the wave number operator is modified to be:
q
 k 2 − k 2 − k 2 − kt
t x y for kt2 − kx2 − ky2 > 0
Kz = q
−i k 2 + k 2 − k 2 − kt for k 2 − k 2 − k 2 < 0
x y t t x y

This way, evanescent waves will be suppressed and dampened out.


Using the Angular Spectrum Method without a fully constructed wave numer operator
may be advantageous when there is a need for saving memory. This is for diffrflag equal
to 2. Then the wave-number vectors kt , kx , ky and the eventual attenuation are returned.
When the parabolic approximation and the KZK equation is solved, the wave number op-
erator will be a long vector containing the difference matrices used by the finite difference
scheme in propagate.
3.3. PROPAGATION 43

3.3.4 Non-Linear Propagation and Operator Splitting

The function nonlinearpropagate governs the second operator splitting scheme used in
solving the directional Westervelt or KZK equation. The operator splitting for the full
propagation is divided into two parts. First the diffraction and the non-linearity/attenuation
are split using a first order Gudonov splitting [10]. To do this, with a sufficiently low split-
ting error, several substeps are taken. This substepsize is determined by the field dz in
Propcontrol. Then, the non-linearity and attenuation are split using a second Strang
splitting scheme of second-order. Here, another possible substepping is performed based
on estimates of the shock formation of the pulse. If the temporal gradient at some point
is higher than a certain limit, the substep is divided into even smaller steps. This is to
avoid shock formation.

The diffraction is solved by calling propagate as if the propagation was linear. Then
one step is performed, and nonlinearpropagate is not called recursively. This way,
equidistant steps may be utilized with the substepsize as h instead of the full stepsize.
The substepsize is fixed through the whole simulation, and if each regular stepsize is an
integer number of substepsize, equidistflag may be used without further concern.

Non-linearity and attenuation are two phenomena with opposite effect. The non-linearity
generates higher harmonic frequencies through forward distortion of the pulse. The at-
tenuation tend to attenuate higher frequncies more than lower, and will make sure that a
perfect mathematical shock never is formed. Beause of this, sub-cycling is performed to
introduce attenuation as often as necessary.

3.3.5 Non-Linearity and Burgers’ Equation

The term accounting for non-linearity in the directional Westervelt and KZK equation
originally has the form:
∂p ∂p
= (n p − t )
∂z ∂τ

where p is a function of x, y, z and t. Assuming plane wave propagation in the z direction,


p will only be a function of z and t, and the above equation may be rearranged to form
a modified Burgers equation on the standard form through a change of variables:

∂p ∂p ∂2p
= n p +  2.
∂z ∂τ ∂τ

Because if the plane wave approximation, the nonlinearity is only accounted for parallel
to the z-axis.

The non-linear steepening of the pulse is solved using the method of characteristics. For
small steps, a perturbation in the temporal grid points proportional to the pressure at
each point is introduced, causing them to not longer be equidistant. This is a distortion
of the 1D pulse causing the wave peaks to move faster than the throughs. The pressure is
then resampled at equidistant time points, a process that introduces a small interpolation
error, but for a sufficiently high sampling frequency, this error is neglible.
44 CHAPTER 3. FUNCTION REFERENCE

3.3.6 Frequency Dependent Attenuation

The attenuation term may be integrated in the same way as the non-lineaorty term to
form:
∂p ∂Lp
= .
∂z ∂τ
The application of the convolution operator L follows a frequency dependent power law
attenuation of the form:
α(f ) = af b ,
and is defined through its Fourier transform as:
 
∂Lp
Fτ = − |ω|b Fτ {p} .
∂τ

The constant  is given as:


ln 10 a
=
20 (2π)b
where a and b are the constants of the power law. This model in itself does not obey
causailty, and is modified according to the Kramers-Kronig relations to form:
  
∂Lp n o
Fτ = − |ω|b + iH |ω|b Fτ {p} ,
∂τ

where H {·} denotes the Hilbert transform [9, 10]. This model is implemented in Aber-
sim.

3.4 Implementation of Materials

Abersim handles a wide range of materials. Almost all of the implemented materials
are soft tissue models. The materials are tuned according to Duck and Hamilton and
Blackstock (Refs. [4,7]. The material is brought into the simulation through the Material
struct, and this struct contains the parameters used by Abersim. The struct will get its
parameter values from material files corresponding to specific materials.
Some important functions are:
• Material
• MUSCLE, LIVER, FAT, BLOOD, etc.
• list_material
• get_matparam

3.4.1 The Material Struct

The Material struct has several fields presented below:


3.4. IMPLEMENTATION OF MATERIALS 45

i This is a material indentifier and is unique for all materials. The mate-
rial indentifier 0 denotes water, indentifiers 1-10 indicates soft tissues,
11-20 tissue mimicking phantoms etc, 21-30 liquids, 31-40 gases and
41-50 solids. The function list_material displays the different imple-
mented or reserved identifiers. The user is encouraged to implement
own materials and to add ranges of material indentifiers.

temp The temperature of the material in Celcius degrees. For tissues 37


degree Celcius is the default.

eps A vector containing the  values [n , a , b ]. These constants are scaled
quantities used in the propagation and information about how they are
calculated may be found in Ref. [10].

c0 The background speed of sound.

rho The mass density of the material at rest.

kappa The compressibility of the material at rest.

betan The coefficient of non-linearity. The βn constant relates to the common


B B
A -parameter as βn =1+ 2A .

a Abersim uses a power law absorption model of the form af b (see Sec-
tion 3.3.6). This parameter is the a in the constant, or not frequency
dependent, part of the attenuation.

b This is the exponent b in the power law attenuation.

3.4.2 The Material File ’MUSCLE’

Material files are files containing measurements of different material parameters. The
measureable parameters are such as speed of sound, mass density, coefficient of non-
linearity and the two attenuation coefficients. The files are implemented with a selector
that returns a specific parameter based on the input param. The input value param may be
either of the following: MATERIALID, WAVESPEED, DENSITY, BETAN, ATTCONST and ATTEXP.
The measurements are implemented as arrays named temps and meas corresponding to
a measurement of one parameter at one specific temperature. The return parameter
of the function at the desired temperature temp, specified at input, is found through
interpolation.
To add new materials, a material file must be created and the function list_material
must be updated. The function list_material contains arrays of material names and
corresponding identifiers. The name of the new material must be added to this list, and
the material file must have the exact same name in all upper-case letters. The extension
.m has to be added at the end.
An example material function, MUSCLE, is included below:
46 CHAPTER 3. FUNCTION REFERENCE

function v a l u e = MUSCLE( param , temp )

%
% v a l u e = MUSCLE( param , temp )
%
% The f u n c t i o n r e t u r n s t h e v a l u e o f a g i v e n parameter f o r ’MUSCLE’
% For no i n p u t arguments t h e m a t e r i a l i n d e x i s r e t u r n e d ( e q u i v a l e n t t o
% c a l l i n g f u n c t i o n with param=MATIDX) .
%
%
% Variables in :
% param The d e s i r e d parameter . May be one o f t h e f o l l o w i n g
% measureable material parameters :
% MATIDX Material i d e n t i f i e r
% WAVESPEED Speed o f sound
% DENSITY Mass d e n s i t y
% BETAN C o e f f i c i e n t o f non−l i n e a r i t y
% ATTCONST Constant o f f r e q . dep . a t t e n u a t i o n ( a ∗ f ˆb )
% ATTEXP Exponent o f f r e q . dep . a t t e n u a t i o n ( a∗ f ˆb )
%
% temp O p t i o n a l . The t e m p e r a t u r e .
%
%
% V a r i a b l e s out :
% value The v a l u e o f t h e d e s i r e d parameter .
%

%
% Copyright (C) 2 0 0 4 , 2008 The Abersim group
% Copyright (C) 2 0 0 4 , 2008 Department o f C i r c u l a t i o n and Medical Imaging
% Copyright (C) 2 0 0 4 , 2008 Norwegian U n i v e r s i t y o f S c i e n c e and Technology
%
% This f i l e i s a p a r t o f t h e Abersim computer package
%
% This Abersim computer package i s f r e e s o f t w a r e ; you can r e d i s t r i b u t e i t
% and/ o r modify i t under t h e terms o f t h e GNU G e n e r a l P u b l i c L i c e n s e a s
% p u b l i s h e d by t h e Free S o f t w a r e Foundation ; e i t h e r v e r s i o n 2 o f t h e
% L i c e n s e , o r ( a t your o p t i o n ) any l a t e r v e r s i o n .
%
% This Abersim computer package i s d i s t r i b u t e d i n t h e hope t h a t i t w i l l be
% u s e f u l , but WITHOUT ANY WARRANTY; w i t h o u t even t h e i m p l i e d warranty o f
% MERCHANTABILITY o r FITNESS FOR A PARTICULAR PURPOSE. See t h e
% GNU G e n e r a l P u b l i c L i c e n s e f o r more d e t a i l s .
%
% You s h o u l d have r e c e i v e d a copy o f t h e GNU G e n e r a l P u b l i c L i c e n s e
% a l o n g with t h i s program ; i f not , p l e a s e download i t from
% <h t t p : / /www. gnu . o r g / l i c e n s e s >
%

%
% Created J u l y 2008 by Halvard Kaupang , ISB
% Based on e a r l i e r works by Gunnar T a r a l d s e n
%

% Material i d e n t i f i e r ( c a l l l i s t m a t e r i a l for avail . i d e n t i f i e r s )


i f nargin==0
value = 1;
3.4. IMPLEMENTATION OF MATERIALS 47

return ;
end
i f nargin<2
temp = 3 7 ;
end

s w i t c h param
c a s e MATIDX
v a l u e = MUSCLE;
return ;

c a s e WAVESPEED
% Duck ’ 9 0 , p . 7 6 .
c0 = 1 5 2 9 ; % 18 C e l s i u s , c a r d i a c
scale = 1.1; % p.86
temps = [ 1 8 , 4 0 ] ’ ; %Ext . a c c . t o Mast ( p a r t I I s i m u l a t i o n s ) .
meas = [ c0 ; c0 + s c a l e ∗ ( 4 0 − 1 8 ) ] ;

c a s e DENSITY
% Duck ’ 9 0 , p . 1 3 8 and p . 1 4 1
rho0 = 1 0 6 0 ; % 37 C e l s i u s
temp0 = 3 7 ;
a l p h a 0 = 3 . 7 5 e −4; % Volume e x p a n s i o n cow
temps = ( 3 5 : 4 0 ) ’ ;
meas = rho0 ∗ exp ( a l p h a 0 ∗ ( temp0 − temps ) ) ;

c a s e BETAN
% Hamilton ’ 9 8 p . 3 6 . Duck ’ 9 0 C a r d i a c p . 9 8
temps = [ 3 6 , 3 7 ] ’ ;
meas = 1 + 0 . 5 ∗ [ 5 . 8 ; 5 . 8 ] ;

c a s e ATTCONST
% Duck , tab . 4 . 1 6
temps = [ 3 6 ; 3 7 ] ;
meas = [ . 5 2 ; . 5 2 ] ; % dB / cm

c a s e ATTEXP
% Duck , t a b l e 4 . 1 6
%aTM = [ 2 0 ; 3 0 ] ;
temps = [ 2 0 , 4 0 ] ;%This i s not c o r r e c t !
meas = [ 1 . 1 ; 1 . 1 ] ;

end
i f length ( meas ) > 2
method = ’ s p l i n e ’ ;
else
method = ’ l i n e a r ’ ;
end

v a l u e = interp1 ( temps , meas , temp , method , ’ e x t r a p ’ ) ;


48 CHAPTER 3. FUNCTION REFERENCE

3.4.3 The Function ’list material’

This function will list all material names and identifiers when run without input argu-
ments. If a string is presented as the input, and if the string corresponds to a material
name, the identifier for this material is returned. If an integer is presented as an input,
the material name for this identifier (if any) will be returned.

3.4.4 The Function ’get matparam’

The function get_matparam returns parameters directly from the material files. All other
functions regarding material parameters will call this function. The function itself is very
simple, and should not be altered.

3.4.5 Other Material Functions

A list of material functions are provided below. The top five functions return standard
measureable quantities, the rest return quantities calculated from measured ones.
• get_wavespeed
• get_density
• get_betan
• get_attconst
• get_attexp
• get_compressibility
• get_epsn
• get_epsa
• get_epsb

3.5 Aberration and heterogeneities

Abersim was from the very beginning contructed to simulate forward distortion caused
by heterogeneities, i.e., phase front aberrations, or phase aberrations or just aberrations.
This is an important part of the program, and more information about the theory of
acoustics in heterogeneous media may be found in the book of Angelsen [1].
The heterogeneities are in Abersim assumed to be located withtin the body wall. Once
the pulse has passed the body wall, the medium is assumed to be homogeneous. The body
wall, however, may be of arbitrary thickness, allowing for simulation in fully heterogeneous
media. The aberrator may also be of arbitrary strength.
Heterogeneities are incorporated in Abersim as a delay screen body wall. This is further
described in Section 3.5.4.
The main functions related to aberration and heterogeneous media are:
• bodywall
3.5. ABERRATION AND HETEROGENEITIES 49

• timeshift
• aberrator

3.5.1 The Function ’bodywall’

The function bodywall is a simulation script equivalent to beamsim. The function will
plan and perform a simulation up to the endpoint specified by the field d in Propcontrol,
which is the thickness of the body wall. The number of screens will determine the spacing
between the screens. The screens are equally spaced over the thickness d, and there is
never a screen at the transducer surface, and allways a screen at the inner boundary
of the body wall at position d. The function has an input argument dir specifying a
direction, and this is 1 for regular transmit beam simulation (beamsim) and -1 for point
source simulations (pointsourcesim). If dir is 1, then the phase shifts are introduced
after propagation of one or more steps, and if it is -1, the phase shifts are introduced
prior to stepping.
The stepsize is adjusted to be equidistant within the body wall. Given a distance between
two screens of 1.5 times the original stepsize, two steps are need to propagate from one
screen to another. To enable the use of equidistant steps, the stepsize within the body wall
will be adjusted such that the wave field will be propagated between screens using two
equidistant stepsizes. By varying the thickness of the body wall and number of screens,
this stepsize adjustment may be avoided such that the regular stepsize may be utilized
for the whole simulation.
The return arguments are the wave field at position d or at the endpoint if the simulation
is performed in a fully heterogeneous medium. The beam profiles (if any) will be returned
as well, and incorporated in eventual beamprofiles from beamsim.

3.5.2 The Function ’timeshift’

The function timeshift introduces the phase shifts in the wave field. This is also used
for delay focusing and is called by pulsegenerator. The phase shifts are introduced in
the frequency domain according to the formula:
n o
pshifted = Ft−1 Ft {p} e−iπδ

where δ is the phase shift in samples. To make shifts in the frequency domain allows for
shift of sub-sample resolution.

3.5.3 The Function ’aberrator’

This function aberrator will calculate the phase shifts for the whole simulation. The
function has Propcontrol as input argument.

3.5.4 Delay screen body wall

The delay screen body wall is contructed from a sequnce of random numbers. This
sequence may be downloaded from the Abersim website. The random number may be
generated using a random number generator, but this should have the ability to return the
50 CHAPTER 3. FUNCTION REFERENCE

same numbers for a given seed or input. The numbers are bandpass filtered using a 2D
spatial annular filter. The cut-off frequencies of the filter are defined in the Propcontrol
field ablength. Examples of delay screens may be found in Figure 3.2.
The shortest length scale defining the upper cut-off frequency is set to be the smallest
heterogeneous structure present, and is usually around the size of a few wavelengths. The
shortest length scale is the most crucial as seen in Fig. 3.2. The longest length scale
should be set to quite much larger, and is usually about the size of an organ or larger for
soft tissue purposes.
An increase in sampling rate in space should not affect the physical size of the hetero-
geneities. For panel a and b in Figure 3.2 we see that the heterogeneities have different
patterns. This is because a longer Fourier transform, and thus filter, is used. To be
able to use the very same aberrator for different samplings, the one with the finest sam-
pling will have to be generated, and then the coarser delayscreen should be resampled or
interpolated from this screen.
3.5. ABERRATION AND HETEROGENEITIES 51

(a) 256×192 points, dx=dy=ds, ablength of 4 to (b) 512×384 points, dx=dy=ds/2, ablength of 4
200 mm to 200 mm

(c) 256×192 points, dx=dy=ds, ablength of 1 to (d) 256×192 points, dx=dy=ds, ablength of 20 to
200 mm 200 mm

(e) 256×192 points, dx=dsx , dy=dsy , ablength of (f) 256×384 points, dx=dsx , dy=dsy /2, ablength
4 to 2000 mm, offset of (-10,-8) mm of 3.9 to 4.1 mm

Figure 3.2: Six different delay screens with different sizes, sampling and length scales. A marker
is set to mark the origin of the delay screen to show the effects of the Propcontrol field offset.
The delay screen are visualized using a logarithmic compression to enhance contrast.
52 CHAPTER 3. FUNCTION REFERENCE
Chapter 4

Version and Installation Guide

4.1 Abersim 2.0 - Matlab version

Abersim 2.0 is a new, enhanced version of the old Matlab code used for version 1.X.
Some functions are written in C, but they do not require linking to other libraries outside
Matlab on UNIX based systems. Abersim and Matlab uses the same library “the Fastest
Fourier Transform in the West” (FFTW) for FFTs. On UNIX systems, this is easily linked
up to Abersim from the Matlab path. On Windows systems, this FFT library must be
downloaded. For some newer Matlab implementations, errors have occurred when linking
to FFTW through Matlab. If this happen, either fix the error or install FFTW on your
machine.
To install Abersim 2.0 to your computer, please follow the intructions below.
If the computer does not have a C compiler at all, a fully Matlab implemented ver-
sion is possible to use. For this option, unpack the files and start up Abersim with
startup_abersim. If you do have a C compiler, please follow the instructions below.

4.1.1 Installation of FFTW

• Download the latest stable version of the FFTW library from http://www.fftw.org.
• On UNIX: Install this library using configure and make.
• On Windows: Download the latest dll-file and follow installation procedure as de-
scribed at http://www.fftw.org/install/windows.html.
• Make sure the library files (.so/.a or .dll) are in the path of your computer.

4.1.2 Installation on UNIX systems

1. Unpack the files in the tar ball at the desired location


2. Start up Matlab
3. Run mex -setup if you want to specify a certain compiler or haven’t done this
before
4. Go to the Abersim 2.0 directory

53
54 CHAPTER 4. VERSION AND INSTALLATION GUIDE

5. Run the script install_abersim. As input arguments, the path of the FFTW
library and mexfile may be specified. If the FFTW is installed somewhere else than
in /usr/local/ this path must be specified as the first input argument. If you plan to
use another specific mexopts file, another than the standard one setup up using mex
-setup, the full filename of this may be specified as the second input argument.

4.1.3 Installation on Windows systems

If you do not have a C compiler you may download Visual Studio Express from the
internet. The use of Matlab’s lcc is strongly not recommended and should be avoided.
1. Unpack the files in the Abersim zip file at the desired location
2. Start up Matlab
3. Run mex -setup and specify the compiler you want to use
4. Open the newly created mexopts.bat and locate the variable LINKFLAGS
5. Add /LIBPATH:"<fftw-lib-path>" and libfftw3-3.lib to the end of the line
6. Go to the Abersim 2.0 directory
7. Run the script install_abersim. As input arguments, the path of the FFTW
library and mexfile may be specified. The path to FFTW is ignored on Windows
systems. If you plan to use another specific mexopts file, another than the standard
one setup up using mex -setup, the full filename of this may be specified as the
second input argument.
Abersim 2.0 should now be installed to you computer. When using Abersim 2.0 for
simulations, please run the script startup_abersim. This will make sure that the folders
of Abersim are in the Matlab path.

4.2 Abersim 2.0 - C version

The stand-alone C version is somewhat more troublesome to install, and requires some
pre-installed libraries [3, 6, 8]. The C version is not dependent on Matlab in any way, but
uses the Matlab file format .mat for everything that is stored to disk. This requires an
own library. Make sure you have a C compiler installed on your computer. This guide
is only for UNIX type systems, and there are no plans at the time of writing of making
Windows installation guides for the stand-alone C version of Abersim 2.0. The required
libraries needed by Abersim 2.0 are:
• CBLAS, LAPACK (ATLAS, http://math-atlas.sourceforge.net/ )
• FFTW (http://www.fftw.org/ )
• MATIO (http://sourceforge.net/projects/matio)
Install the above libraries following the procedure presented in their respective manuals
and documentation. Abersim is compiled and built using Makefiles. The main Makefile
will include a Makefile specific for your machine (Makefile.in) that contains information
on where to find the libraries specified above etc.
4.2. ABERSIM 2.0 - C VERSION 55

4.2.1 Installation on UNIX systems

Make sure the Abersim 2.0 tar ball is unpacked. This is the case if have already installed
the Matlab version. The source files for the C version is included in the subdirectory
cfiles/.
The wrapper library locblas must be installed before building Abersim. This is installed
through the following procedure:
1. Go to the abersim-2.0/cfiles/locblas/ directory.
2. Modify Makefile.YOURMACHINE.
• For Mac: Add -D_USE_VECLIB to the LOCFLAGS variable.
• For Linux with Intel MKL: Add -D_USE_MKL_CBLAS to the LOCFLAGS variable.
• For Linux with ATLAS: Add -D_USE_ATLAS to the LOCFLAGS variable.
• Set the LOCINCLS, LOCLDINCLS to the include and lib folder of the BLAS
distribution and LOCLIBS to the libraries that need to be linked in.
• Set the LOCDIR variable to the path where the locblas library is to be installed.
3. Make a link from Makefile.YOURMACHINE to Makefile.in
4. Run make and make install
When the locblas library is built, the main program is built in a similar fashion. Make
sure that all the libraries are in the run time path of your machine. This is specified in
the shell variable $LD_LIBRARY_PATH.
Abersim 2.0 is installed throught the following procedure:
1. Go to the abersim-2.0/cfiles/ directory.
2. Modify Makefile.YOURMACHINE.
• For Mac: Add -D_USE_VECLIB to the LOCALDEFINES variable.
• For Linux with Intel MKL: Add -D_USE_MKL_CBLAS to the LOCALDEFINES vari-
able.
• For Linux with ATLAS: Add -D_USE_ATLAS to the LOCALDEFINES variable.
• Set the MATIODIR, LOCBLASDIR and FFTWDIR to the paths of the different li-
braries. The variable MATLABDIR may be specified if wanted
• Set the LOCALLIBS variable to the proper libraries.
3. Make a link from Makefile.YOURMACHINE to Makefile.in
4. Run make
the C version of Abersim 2.0 should now be installed to you computer. When using this
version, the simulations are run using initial data. These data should be exported from
the Matlab version of Abersim 2.0 using export_simulation.
56 CHAPTER 4. VERSION AND INSTALLATION GUIDE
Chapter 5

License Agreement

Abersim is released under the GNU General Pulic License, version 3. The full license may
be found below or downloaded from http://www.gnu.org/copyleft/gpl (Ref. [5]).
GNU GENERAL PUBLIC LICENSE
V e r s i o n 3 , 29 June 2007

C o p y r i ght (C) 2007 Free S o f t w a r e Foundation , I n c . <h t t p : / / f s f . o r g/>


Everyone i s p e r m i t t e d t o copy and d i s t r i b u t e ver batim c o p i e s
o f t h i s l i c e n s e document , but c h a n g i n g i t i s not a l l o w e d .

Preamble

The GNU G e n e r a l P u b l i c L i c e n s e i s a f r e e , c o p y l e f t l i c e n s e f o r
s o f t w a r e and o t h e r k i n d s o f works .

The l i c e n s e s f o r most s o f t w a r e and o t h e r p r a c t i c a l works a r e d e s i g n e d


t o t a k e away your freedom t o s h a r e and change t h e works . By contrast ,
t h e GNU G e n e r a l P u b l i c L i c e n s e i s i n t e n d e d t o g u a r a n t e e your freedom t o
s h a r e and change a l l v e r s i o n s o f a program−−t o make s u r e i t r e m a i n s f r e e
s o f t w a r e f o r a l l i t s u s e r s . We, t h e Free S o f t w a r e Foundation , u s e t h e
GNU G e n e r a l P u b l i c L i c e n s e f o r most o f our s o f t w a r e ; i t a p p l i e s a l s o t o
any o t h e r work r e l e a s e d t h i s way by i t s a u t h o r s . You can apply i t t o
your programs , t o o .

When we speak o f f r e e s o f t w a r e , we a r e r e f e r r i n g t o freedom , not


p r i c e . Our G e n e r a l P u b l i c L i c e n s e s a r e d e s i g n e d t o make s u r e t h a t you
have t h e freedom t o d i s t r i b u t e c o p i e s o f f r e e s o f t w a r e ( and c h a r g e f o r
them i f you wish ) , t h a t you r e c e i v e s o u r c e code o r can get i t i f you
want i t , t h a t you can change t h e s o f t w a r e o r u s e p i e c e s o f i t i n new
f r e e programs , and t h a t you know you can do t h e s e t h i n g s .

To p r o t e c t your r i g h t s , we need t o p r e v e n t o t h e r s from denyi ng you


t h e s e r i g h t s o r a s k i n g you t o s u r r e n d e r t h e r i g h t s . T h e r e f o r e , you have
c e r t a i n r e s p o n s i b i l i t i e s i f you d i s t r i b u t e c o p i e s o f t h e s o f t w a r e , o r i f
you modify i t : r e s p o n s i b i l i t i e s t o r e s p e c t t h e freedom o f o t h e r s .

For example , i f you d i s t r i b u t e c o p i e s o f such a program , whether


g r a t i s o r f o r a f e e , you must p a s s on t o t h e r e c i p i e n t s t h e same
f r e e d o m s t h a t you r e c e i v e d . You must make s u r e t h a t they , too , r e c e i v e
o r can get t h e s o u r c e code . And you must show them t h e s e terms s o they
know t h e i r r i g h t s .

D e v e l o p e r s t h a t u s e t h e GNU GPL p r o t e c t your r i g h t s with two s t e p s :


( 1 ) a s s e r t c o p y r i g h t on t h e s o f t w a r e , and ( 2 ) o f f e r you t h i s L i c e n s e
g i v i n g you l e g a l p e r m i s s i o n t o copy , d i s t r i b u t e and/ o r modify i t .

57
58 CHAPTER 5. LICENSE AGREEMENT

For t h e d e v e l o p e r s ’ and a u t h o r s ’ p r o t e c t i o n , t h e GPL clearly explains


t h a t t h e r e i s no warranty f o r t h i s f r e e s o f t w a r e . For both u s e r s ’ and
a u t h o r s ’ sake , t h e GPL r e q u i r e s t h a t m o d i f i e d v e r s i o n s be marked a s
changed , s o t h a t t h e i r problems w i l l not be a t t r i b u t e d e r r o ne o us l y to
authors of previous versions .

Some d e v i c e s a r e d e s i g n e d t o deny u s e r s a c c e s s t o i n s t a l l o r run


m o d i f i e d v e r s i o n s o f t h e s o f t w a r e i n s i d e them , a l t h o u g h t h e m a n u f a c t u r e r
can do s o . This i s f u n d a m e n t a l l y i n c o m p a t i b l e with t h e aim o f
p r o t e c t i n g u s e r s ’ freedom t o change t h e s o f t w a r e . The s y s t e m a t i c
p a t t e r n o f such abuse o c c u r s i n t h e a r e a o f p r o d u c t s f o r i n d i v i d u a l s t o
use , which i s p r e c i s e l y where i t i s most u n a c c e p t a b l e . T h e r e f o r e , we
have d e s i g n e d t h i s version o f t h e GPL t o p r o h i b i t t h e p r a c t i c e f o r t h o s e
products . I f such problems a r i s e s u b s t a n t i a l l y i n o t h e r domains , we
s t a n d ready t o extend t h i s p r o v i s i o n t o t h o s e domains i n f u t u r e v e r s i o n s
o f t h e GPL, a s needed t o p r o t e c t t h e freedom o f u s e r s .

F i n a l l y , e v e r y program i s t h r e a t e n e d c o n s t a n t l y by s o f t w a r e p a t e n t s .
S t a t e s s h o u l d not a l l o w p a t e n t s t o r e s t r i c t development and u s e o f
s o f t w a r e on g e n e r a l −p u r p o s e computers , but i n t h o s e t h a t do , we wish t o
a v o i d t h e s p e c i a l danger t h a t p a t e n t s a p p l i e d t o a f r e e program c o u l d
make i t e f f e c t i v e l y p r o p r i e t a r y . To p r e v e n t t h i s , t h e GPL a s s u r e s t h a t
p a t e n t s cannot be used t o r e n d e r t h e program non−f r e e .

The p r e c i s e terms and c o n d i t i o n s f o r copying , d i s t r i b u t i o n and


modification follow .

TERMS AND CONDITIONS

0. Definitions .

”This L i c e n s e ” r e f e r s t o version 3 o f t h e GNU G e n e r a l P u b l i c L i c e n s e .

”C o p y r i ght ” a l s o means c o p y r i g h t −l i k e l a w s t h a t apply t o o t h e r k i n d s o f


works , such a s s e m i c o n d u c t o r masks .

”The Program ” r e f e r s t o any c o p y r i g h t a b l e work l i c e n s e d under t h i s


L i c e n s e . Each l i c e n s e e i s a d d r e s s e d a s ”you ”. ” L i c e n s e e s ” and
” r e c i p i e n t s ” may be i n d i v i d u a l s o r o r g a n i z a t i o n s .

To ”modify ” a work means t o copy from o r adapt a l l o r p a r t o f t h e work


i n a f a s h i o n r e q u i r i n g c o p y r i g h t p e r m i s s i o n , o t h e r than t h e making o f an
e x a c t copy . The r e s u l t i n g work i s c a l l e d a ” m o d i f i e d version ” o f t h e
e a r l i e r work o r a work ”based on ” t h e e a r l i e r work .

A ” c o v e r e d work ” means e i t h e r t h e u n m o d i f i e d Program o r a work based


on t h e Program .

To ”p r o p a g a t e ” a work means t o do a n y t h i n g with i t that , w i t h o u t


p e r m i s s i o n , would make you d i r e c t l y o r s e c o n d a r i l y l i a b l e f o r
i n f r i n g e m e n t under a p p l i c a b l e c o p y r i g h t law , e x c e p t e x e c u t i n g i t on a
computer o r m o d i f y i n g a p r i v a t e copy . P r o p a g a t i o n i n c l u d e s copying ,
d i s t r i b u t i o n ( with o r w i t h o u t m o d i f i c a t i o n ) , making a v a i l a b l e t o t h e
p u b l i c , and i n some c o u n t r i e s o t h e r a c t i v i t i e s a s w e l l .

To ”convey ” a work means any kind o f p r o p a g a t i o n t h a t e n a b l e s o t h e r


p a r t i e s t o make o r r e c e i v e c o p i e s . Mere i n t e r a c t i o n with a u s e r through
a computer network , with no t r a n s f e r o f a copy , i s not c o n v e y i n g .

An i n t e r a c t i v e u s e r i n t e r f a c e d i s p l a y s ”A p p r o p r i a t e L e g a l N o t i c e s ”
t o t h e e x t e n t t h a t i t i n c l u d e s a c o n v e n i e n t and p r o m i n e n t l y v i s i b l e
59

f e a t u r e t h a t ( 1 ) d i s p l a y s an a p p r o p r i a t e c o p y r i g h t n o t i c e , and ( 2 )
t e l l s t h e u s e r t h a t t h e r e i s no warranty f o r t h e work ( e x c e p t t o t h e
e x t e n t t h a t w a r r a n t i e s a r e p r o v i d e d ) , t h a t l i c e n s e e s may convey t h e
work under t h i s L i c e n s e , and how t o view a copy o f t h i s L i c e n s e . If
t h e i n t e r f a c e p r e s e n t s a l i s t o f u s e r commands o r o p t i o n s , such a s a
menu, a prominent item i n t h e l i s t meets t h i s c r i t e r i o n .

1 . S o u r c e Code .

The ” s o u r c e code ” f o r a work means t h e p r e f e r r e d form o f t h e work


f o r making m o d i f i c a t i o n s t o i t . ”Object code ” means any non−s o u r c e
form o f a work .

A ”Standard I n t e r f a c e ” means an i n t e r f a c e t h a t e i t h e r i s an o f f i c i a l
s t a n d a r d d e f i n e d by a r e c o g n i z e d s t a n d a r d s body , or , i n t h e c a s e o f
i n t e r f a c e s s p e c i f i e d f o r a p a r t i c u l a r programming language , one t h a t
i s w i d e l y used among d e v e l o p e r s working i n t h a t l a n g u a g e .

The ”System L i b r a r i e s ” o f an e x e c u t a b l e work i n c l u d e anything , o t h e r


than t h e work a s a whole , t h a t ( a ) i s i n c l u d e d i n t h e normal form o f
p a c k a g i n g a Major Component , but which i s not p a r t o f t h a t Major
Component , and ( b ) s e r v e s o n l y t o e n a b l e u s e o f t h e work with t h a t
Major Component , o r t o implement a Standard I n t e r f a c e f o r which an
i m p l e m e n t a t i o n i s a v a i l a b l e t o t h e p u b l i c i n s o u r c e code form . A
”Major Component ” , i n t h i s c o n t e x t , means a major e s s e n t i a l component
( k e r n e l , window system , and s o on ) o f t h e s p e c i f i c o p e r a t i n g system
( i f any ) on which t h e e x e c u t a b l e work runs , o r a c o m p i l e r used t o
produce t h e work , o r an o b j e c t code i n t e r p r e t e r used t o run i t .

The ”C o r r e s p o n d i n g S o u r c e ” f o r a work i n o b j e c t code form means a l l


t h e s o u r c e code needed t o g e n e r a t e , i n s t a l l , and ( f o r an e x e c u t a b l e
work ) run t h e o b j e c t code and t o modify t h e work , i n c l u d i n g s c r i p t s t o
c o n t r o l t h o s e a c t i v i t i e s . However , i t d o e s not i n c l u d e t h e work ’ s
System L i b r a r i e s , o r g e n e r a l −p u r p o s e t o o l s o r g e n e r a l l y a v a i l a b l e f r e e
programs which a r e used u n m o d i f i e d i n p e r f o r m i n g t h o s e a c t i v i t i e s but
which a r e not p a r t o f t h e work . For example , C o r r e s p o n d i n g S o u r c e
i n c l u d e s i n t e r f a c e d e f i n i t i o n f i l e s a s s o c i a t e d with s o u r c e f i l e s f o r
t h e work , and t h e s o u r c e code f o r s h a r e d l i b r a r i e s and d y n a m i c a l l y
l i n k e d subprograms t h a t t h e work i s s p e c i f i c a l l y d e s i g n e d t o r e q u i r e ,
such a s by i n t i m a t e data communication o r c o n t r o l f l o w between t h o s e
subprograms and o t h e r p a r t s o f t h e work .

The C o r r e s p o n d i n g S o u r c e need not i n c l u d e a n y t h i n g t h a t u s e r s


can r e g e n e r a t e a u t o m a t i c a l l y from o t h e r p a r t s o f t h e C o r r e s p o n d i n g
Source .

The C o r r e s p o n d i n g S o u r c e f o r a work i n s o u r c e code form i s t h a t


same work .

2. Basic Permissions .

A l l r i g h t s g r a n t e d under t h i s L i c e n s e a r e g r a n t e d f o r t h e term o f
c o p y r i g h t on t h e Program , and a r e i r r e v o c a b l e p r o v i d e d t h e s t a t e d
c o n d i t i o n s a r e met . This L i c e n s e e x p l i c i t l y a f f i r m s your u n l i m i t e d
p e r m i s s i o n t o run t h e u n m o d i f i e d Program . The output from r u n n i n g a
c o v e r e d work i s c o v e r e d by t h i s L i c e n s e o n l y i f t h e output , g i v e n i t s
c o n t e n t , c o n s t i t u t e s a c o v e r e d work . This L i c e n s e a c k n o w l e d g e s your
r i g h t s o f f a i r u s e o r o t h e r e q u i v a l e n t , a s p r o v i d e d by c o p y r i g h t law .

You may make , run and p r o p a g a t e c o v e r e d works t h a t you do not


convey , w i t h o u t c o n d i t i o n s s o l o n g a s your l i c e n s e o t h e r w i s e r e m a i n s
i n f o r c e . You may convey c o v e r e d works t o o t h e r s f o r t h e s o l e p u r p o s e
60 CHAPTER 5. LICENSE AGREEMENT

o f h av i ng them make m o d i f i c a t i o n s e x c l u s i v e l y f o r you , o r p r o v i d e you


with f a c i l i t i e s f o r r u n n i n g t h o s e works , p r o v i d e d t h a t you comply with
t h e terms o f t h i s L i c e n s e i n c o n v e y i n g a l l m a t e r i a l f o r which you do
not c o n t r o l c o p y r i g h t . Those t h u s making o r r u n n i n g t h e c o v e r e d works
f o r you must do s o e x c l u s i v e l y on your b e h a l f , under your d i r e c t i o n
and c o n t r o l , on terms t h a t p r o h i b i t them from making any c o p i e s o f
your c o p y r i g h t e d m a t e r i a l o u t s i d e t h e i r r e l a t i o n s h i p with you .

Conveying under any o t h e r c i r c u m s t a n c e s i s p e r m i t t e d s o l e l y under


t h e c o n d i t i o n s s t a t e d below . S u b l i c e n s i n g i s not a l l o w e d ; s e c t i o n 10
makes i t u n n e c e s s a r y .

3 . P r o t e c t i n g Users ’ L e g a l R i g h t s From Anti−Circumvention Law .

No c o v e r e d work s h a l l be deemed p a r t o f an e f f e c t i v e t e c h n o l o g i c a l
measure under any a p p l i c a b l e law f u l f i l l i n g o b l i g a t i o n s under a r t i c l e
11 o f t h e WIPO c o p y r i g h t t r e a t y adopted on 20 December 1 9 9 6 , o r
s i m i l a r l a w s p r o h i b i t i n g o r r e s t r i c t i n g c i r c u m v e n t i o n o f such
measures .

When you convey a c o v e r e d work , you waive any l e g a l power t o f o r b i d


c i r c u m v e n t i o n o f t e c h n o l o g i c a l measures t o t h e e x t e n t such c i r c u m v e n t i o n
i s e f f e c t e d by e x e r c i s i n g r i g h t s under t h i s L i c e n s e with r e s p e c t t o
t h e c o v e r e d work , and you d i s c l a i m any i n t e n t i o n t o l i m i t o p e r a t i o n o r
m o d i f i c a t i o n o f t h e work a s a means o f e n f o r c i n g , a g a i n s t t h e work ’ s
u s e r s , your o r t h i r d p a r t i e s ’ l e g a l r i g h t s t o f o r b i d c i r c u m v e n t i o n o f
t e c h n o l o g i c a l measures .

4 . Conveying Verbatim C o p i e s .

You may convey ver batim c o p i e s o f t h e Program ’ s s o u r c e code a s you


r e c e i v e i t , i n any medium , p r o v i d e d t h a t you c o n s p i c u o u s l y and
a p p r o p r i a t e l y p u b l i s h on each copy an a p p r o p r i a t e c o p y r i g h t n o t i c e ;
keep i n t a c t a l l n o t i c e s s t a t i n g t h a t t h i s L i c e n s e and any
non−p e r m i s s i v e terms added i n a c c o r d with s e c t i o n 7 apply t o t h e code ;
keep i n t a c t a l l n o t i c e s o f t h e a b s e n c e o f any warranty ; and g i v e a l l
r e c i p i e n t s a copy o f t h i s L i c e n s e a l o n g with t h e Program .

You may c h a r g e any p r i c e o r no p r i c e f o r each copy t h a t you convey ,


and you may o f f e r s u p p o r t o r warranty p r o t e c t i o n f o r a f e e .

5 . Conveying M o d i f i e d S o u r c e V e r s i o n s .

You may convey a work based on t h e Program , o r t h e m o d i f i c a t i o n s t o


produce i t from t h e Program , i n t h e form o f s o u r c e code under t h e
terms o f s e c t i o n 4 , p r o v i d e d t h a t you a l s o meet a l l o f t h e s e c o n d i t i o n s :

a ) The work must c a r r y prominent n o t i c e s s t a t i n g t h a t you m o d i f i e d


i t , and g i v i n g a r e l e v a n t date .

b ) The work must c a r r y prominent n o t i c e s s t a t i n g t h a t i t i s


r e l e a s e d under t h i s L i c e n s e and any c o n d i t i o n s added under s e c t i o n
7 . This r e q u i r e m e n t m o d i f i e s t h e r e q u i r e m e n t i n s e c t i o n 4 t o
”keep i n t a c t a l l n o t i c e s ”.

c ) You must l i c e n s e t h e e n t i r e work , a s a whole , under t h i s


L i c e n s e t o anyone who comes i n t o p o s s e s s i o n o f a copy . This
L i c e n s e w i l l t h e r e f o r e apply , a l o n g with any a p p l i c a b l e s e c t i o n 7
a d d i t i o n a l terms , t o t h e whole o f t h e work , and a l l i t s p a r t s ,
r e g a r d l e s s o f how they a r e packaged . This L i c e n s e g i v e s no
p e r m i s s i o n t o l i c e n s e t h e work i n any o t h e r way , but i t d o e s not
i n v a l i d a t e such p e r m i s s i o n i f you have s e p a r a t e l y r e c e i v e d i t .
61

d ) I f t h e work has i n t e r a c t i v e u s e r i n t e r f a c e s , each must d i s p l a y


A p p r o p r i a t e L e g a l N o t i c e s ; however , i f t h e Program has i n t e r a c t i v e
i n t e r f a c e s t h a t do not d i s p l a y A p p r o p r i a t e L e g a l N o t i c e s , your
work need not make them do s o .

A c o m p i l a t i o n o f a c o v e r e d work with o t h e r s e p a r a t e and i n d e p e n d e n t


works , which a r e not by t h e i r n a t u r e e x t e n s i o n s o f t h e c o v e r e d work ,
and which a r e not combined with i t such a s t o form a l a r g e r program ,
i n o r on a volume o f a s t o r a g e o r d i s t r i b u t i o n medium , i s c a l l e d an
” a g g r e g a t e ” i f t h e c o m p i l a t i o n and i t s r e s u l t i n g c o p y r i g h t a r e not
used t o l i m i t t h e a c c e s s o r l e g a l r i g h t s o f t h e c o m p i l a t i o n ’ s u s e r s
beyond what t h e i n d i v i d u a l works p e r m i t . I n c l u s i o n o f a c o v e r e d work
i n an a g g r e g a t e d o e s not c a u s e t h i s L i c e n s e t o apply t o t h e o t h e r
parts of the aggregate .

6 . Conveying Non−S o u r c e Forms .

You may convey a c o v e r e d work i n o b j e c t code form under t h e terms


o f s e c t i o n s 4 and 5 , p r o v i d e d t h a t you a l s o convey t h e
machine−r e a d a b l e C o r r e s p o n d i n g S o u r c e under t h e terms o f t h i s L i c e n s e ,
i n one o f t h e s e ways :

a ) Convey t h e o b j e c t code in , o r embodied in , a p h y s i c a l p r o d u c t


( i n c l u d i n g a p h y s i c a l d i s t r i b u t i o n medium ) , accompanied by t h e
C o r r e s p o n d i n g S o u r c e f i x e d on a d u r a b l e p h y s i c a l medium
c u s t o m a r i l y used f o r s o f t w a r e i n t e r c h a n g e .

b ) Convey t h e o b j e c t code in , o r embodied in , a p h y s i c a l p r o d u c t


( i n c l u d i n g a p h y s i c a l d i s t r i b u t i o n medium ) , accompanied by a
w r i t t e n o f f e r , v a l i d f o r a t l e a s t t h r e e y e a r s and v a l i d f o r a s
l o n g a s you o f f e r s p a r e p a r t s o r customer s u p p o r t f o r t h a t p r o d u c t
model , t o g i v e anyone who p o s s e s s e s t h e o b j e c t code e i t h e r ( 1 ) a
copy o f t h e C o r r e s p o n d i n g S o u r c e f o r a l l t h e s o f t w a r e i n t h e
p r o d u c t t h a t i s c o v e r e d by t h i s L i c e n s e , on a d u r a b l e p h y s i c a l
medium c u s t o m a r i l y used f o r s o f t w a r e i n t e r c h a n g e , f o r a p r i c e no
more than your r e a s o n a b l e c o s t o f p h y s i c a l l y p e r f o r m i n g t h i s
c o n v e y i n g o f s o u r c e , o r ( 2 ) a c c e s s t o copy t h e
C o r r e s p o n d i n g S o u r c e from a network s e r v e r a t no c h a r g e .

c ) Convey i n d i v i d u a l c o p i e s o f t h e o b j e c t code with a copy o f t h e


w r i t t e n o f f e r t o p r o v i d e t h e C o r r e s p o n d i n g S o u r c e . This
a l t e r n a t i v e i s a l l o w e d o n l y o c c a s i o n a l l y and noncommercially , and
o n l y i f you r e c e i v e d t h e o b j e c t code with such an o f f e r , i n a c c o r d
with s u b s e c t i o n 6b .

d ) Convey t h e o b j e c t code by o f f e r i n g a c c e s s from a d e s i g n a t e d


p l a c e ( g r a t i s o r f o r a c h a r g e ) , and o f f e r e q u i v a l e n t a c c e s s t o t h e
C o r r e s p o n d i n g S o u r c e i n t h e same way through t h e same p l a c e a t no
f u r t h e r c h a r g e . You need not r e q u i r e r e c i p i e n t s t o copy t h e
C o r r e s p o n d i n g S o u r c e a l o n g with t h e o b j e c t code . I f the place to
copy t h e o b j e c t code i s a network s e r v e r , t h e C o r r e s p o n d i n g S o u r c e
may be on a d i f f e r e n t s e r v e r ( o p e r a t e d by you o r a t h i r d p a r t y )
t h a t s u p p o r t s e q u i v a l e n t c o p y i n g f a c i l i t i e s , p r o v i d e d you m a i n t a i n
c l e a r d i r e c t i o n s next t o t h e o b j e c t code s a y i n g where t o find t h e
Corresponding Source . R e g a r d l e s s o f what s e r v e r h o s t s t h e
C o r r e s p o n d i n g Source , you remain o b l i g a t e d t o e n s u r e t h a t i t i s
a v a i l a b l e f o r a s l o n g a s needed t o s a t i s f y t h e s e r e q u i r e m e n t s .

e ) Convey t h e o b j e c t code u s i n g peer −to−p e e r t r a n s m i s s i o n , p r o v i d e d


you i n f o r m o t h e r p e e r s where t h e o b j e c t code and C o r r e s p o n d i n g
S o u r c e o f t h e work a r e b e i n g o f f e r e d t o t h e g e n e r a l p u b l i c a t no
62 CHAPTER 5. LICENSE AGREEMENT

c h a r g e under s u b s e c t i o n 6d .

A s e p a r a b l e p o r t i o n o f t h e o b j e c t code , whose s o u r c e code i s e x c l u d e d


from t h e C o r r e s p o n d i n g S o u r c e a s a System L i b r a r y , need not be
i n c l u d e d i n c o n v e y i n g t h e o b j e c t code work .

A ”User Product ” i s e i t h e r ( 1 ) a ”consumer p r o d u c t ” , which means any


t a n g i b l e p e r s o n a l p r o p e r t y which i s n o r m a l l y used f o r p e r s o n a l , f a m i l y ,
or household purposes , or ( 2 ) anything designed or s o l d for i n c o r p o r a t i o n
i n t o a d w e l l i n g . In d e t e r m i n i n g whether a p r o d u c t i s a consumer product ,
d o u b t f u l c a s e s s h a l l be r e s o l v e d i n f a v o r o f c o v e r a g e . For a p a r t i c u l a r
p r o d u c t r e c e i v e d by a p a r t i c u l a r u s e r , ”n o r m a l l y used ” r e f e r s t o a
t y p i c a l o r common u s e o f t h a t c l a s s o f product , r e g a r d l e s s o f t h e s t a t u s
o f t h e p a r t i c u l a r u s e r o r o f t h e way i n which t h e p a r t i c u l a r u s e r
a c t u a l l y u s e s , o r e x p e c t s o r i s e x p e c t e d t o use , t h e p r o d u c t . A p r o d u c t
i s a consumer p r o d u c t r e g a r d l e s s o f whether t h e p r o d u c t has s u b s t a n t i a l
commercial , i n d u s t r i a l o r non−consumer u s e s , u n l e s s such u s e s r e p r e s e n t
t h e o n l y s i g n i f i c a n t mode o f u s e o f t h e p r o d u c t .

” I n s t a l l a t i o n I n f o r m a t i o n ” f o r a User Product means any methods ,


p r o c e d u r e s , a u t h o r i z a t i o n keys , o r o t h e r i n f o r m a t i o n r e q u i r e d t o i n s t a l l
and e x e c u t e m o d i f i e d v e r s i o n s o f a c o v e r e d work i n t h a t User Product from
a m o d i f i e d version o f i t s C o r r e s p o n d i n g S o u r c e . The i n f o r m a t i o n must
s u f f i c e to ensure that the continued f u n c t i o n i n g of the modified o b j e c t
code i s i n no c a s e p r e v e n t e d o r i n t e r f e r e d with s o l e l y b e c a u s e
m o d i f i c a t i o n has been made .

I f you convey an o b j e c t code work under t h i s s e c t i o n in , o r with , o r


s p e c i f i c a l l y f o r u s e in , a User Product , and t h e c o n v e y i n g o c c u r s a s
p a r t o f a t r a n s a c t i o n i n which t h e r i g h t o f p o s s e s s i o n and u s e o f t h e
User Product i s t r a n s f e r r e d t o t h e r e c i p i e n t i n p e r p e t u i t y o r f o r a
f i x e d term ( r e g a r d l e s s o f how t h e t r a n s a c t i o n i s c h a r a c t e r i z e d ) , t h e
C o r r e s p o n d i n g S o u r c e conveyed under t h i s s e c t i o n must be accompanied
by t h e I n s t a l l a t i o n I n f o r m a t i o n . But t h i s r e q u i r e m e n t d o e s not apply
i f n e i t h e r you nor any t h i r d p a r t y r e t a i n s t h e a b i l i t y t o i n s t a l l
m o d i f i e d o b j e c t code on t h e User Product ( f o r example , t h e work has
been i n s t a l l e d i n ROM) .

The r e q u i r e m e n t t o p r o v i d e I n s t a l l a t i o n I n f o r m a t i o n d o e s not i n c l u d e a
r e q u i r e m e n t t o c o n t i n u e t o p r o v i d e s u p p o r t s e r v i c e , warranty , o r u p d a t e s
f o r a work t h a t has been m o d i f i e d o r i n s t a l l e d by t h e r e c i p i e n t , o r f o r
t h e User Product i n which i t has been m o d i f i e d o r i n s t a l l e d . Access to a
network may be d e n i e d when t h e m o d i f i c a t i o n i t s e l f m a t e r i a l l y and
a d v e r s e l y a f f e c t s t h e o p e r a t i o n o f t h e network o r v i o l a t e s t h e r u l e s and
p r o t o c o l s f o r communication a c r o s s t h e network .

C o r r e s p o n d i n g S o u r c e conveyed , and I n s t a l l a t i o n I n f o r m a t i o n p r o v i d e d ,
i n a c c o r d with t h i s s e c t i o n must be i n a format t h a t i s p u b l i c l y
documented ( and with an i m p l e m e n t a t i o n a v a i l a b l e t o t h e p u b l i c i n
s o u r c e code form ) , and must r e q u i r e no s p e c i a l password o r key f o r
unpacking , r e a d i n g o r c o p y i n g .

7 . A d d i t i o n a l Terms .

” A d d i t i o n a l p e r m i s s i o n s ” a r e terms t h a t supplement t h e terms o f t h i s


L i c e n s e by making e x c e p t i o n s from one o r more o f i t s c o n d i t i o n s .
A d d i t i o n a l p e r m i s s i o n s t h a t a r e a p p l i c a b l e t o t h e e n t i r e Program s h a l l
be t r e a t e d a s though they were i n c l u d e d i n t h i s L i c e n s e , t o t h e e x t e n t
t h a t they a r e v a l i d under a p p l i c a b l e law . I f additional permissions
app ly o n l y t o p a r t o f t h e Program , t h a t p a r t may be used s e p a r a t e l y
under t h o s e p e r m i s s i o n s , but t h e e n t i r e Program r e m a i n s gover ned by
t h i s License without regard to the a d d i t i o n a l p e r m i s s i o n s .
63

When you convey a copy o f a c o v e r e d work , you may a t your o p t i o n


remove any a d d i t i o n a l p e r m i s s i o n s from t h a t copy , o r from any p a r t o f
it . ( A d d i t i o n a l p e r m i s s i o n s may be w r i t t e n t o r e q u i r e t h e i r own
removal i n c e r t a i n c a s e s when you modify t h e work . ) You may p l a c e
a d d i t i o n a l p e r m i s s i o n s on m a t e r i a l , added by you t o a c o v e r e d work ,
f o r which you have o r can g i v e a p p r o p r i a t e c o p y r i g h t p e r m i s s i o n .

N o t w i t h s t a n d i n g any o t h e r p r o v i s i o n o f t h i s L i c e n s e , f o r m a t e r i a l you
add t o a c o v e r e d work , you may ( i f a u t h o r i z e d by t h e c o p y r i g h t h o l d e r s o f
t h a t m a t e r i a l ) supplement t h e terms o f t h i s L i c e n s e with terms :

a ) D i s c l a i m i n g warranty o r l i m i t i n g l i a b i l i t y d i f f e r e n t l y from t h e
terms o f s e c t i o n s 15 and 16 o f t h i s L i c e n s e ; o r

b) Requiring p r e s e r v a t i o n of s p e c i f i e d reasonable l e g a l n o t i c e s or
author a t t r i b u t i o n s in that m a t e r i a l or in the Appropriate Legal
N o t i c e s d i s p l a y e d by works c o n t a i n i n g i t ; o r

c ) P r o h i b i t i n g m i s r e p r e s e n t a t i o n of the o r i g i n of that material , or


r e q u i r i n g t h a t m o d i f i e d v e r s i o n s o f such m a t e r i a l be marked i n
r e a s o n a b l e ways a s d i f f e r e n t from t h e o r i g i n a l version ; o r

d ) L i m i t i n g t h e u s e f o r p u b l i c i t y p u r p o s e s o f names o f l i c e n s o r s o r
authors of the material ; or

e ) D e c l i n i n g t o g r a n t r i g h t s under trademark law f o r u s e o f some


t r a d e names , trademarks , o r s e r v i c e marks ; o r

f ) R e q u i r i n g i n d e m n i f i c a t i o n o f l i c e n s o r s and a u t h o r s o f t h a t
m a t e r i a l by anyone who c o n v e y s t h e m a t e r i a l ( o r m o d i f i e d v e r s i o n s o f
i t ) with c o n t r a c t u a l a s s u m p t i o n s o f l i a b i l i t y t o t h e r e c i p i e n t , f o r
any l i a b i l i t y t h a t t h e s e c o n t r a c t u a l a s s u m p t i o n s d i r e c t l y impose on
t h o s e l i c e n s o r s and a u t h o r s .

A l l o t h e r non−p e r m i s s i v e a d d i t i o n a l terms a r e c o n s i d e r e d ” f u r t h e r
r e s t r i c t i o n s ” w i t h i n t h e meaning o f s e c t i o n 1 0 . I f t h e Program a s you
r e c e i v e d i t , o r any p a r t o f i t , c o n t a i n s a n o t i c e s t a t i n g t h a t i t i s
g ov e r ne d by t h i s L i c e n s e a l o n g with a term t h a t i s a f u r t h e r
r e s t r i c t i o n , you may remove t h a t term . I f a l i c e n s e document c o n t a i n s
a f u r t h e r r e s t r i c t i o n but p e r m i t s r e l i c e n s i n g o r c o n v e y i n g under t h i s
L i c e n s e , you may add t o a c o v e r e d work m a t e r i a l gove rned by t h e terms
o f t h a t l i c e n s e document , p r o v i d e d t h a t t h e f u r t h e r r e s t r i c t i o n d o e s
not s u r v i v e such r e l i c e n s i n g o r c o n v e y i n g .

I f you add terms t o a c o v e r e d work i n a c c o r d with t h i s s e c t i o n , you


must p l a c e , i n t h e r e l e v a n t s o u r c e f i l e s , a s t a t e m e n t o f t h e
a d d i t i o n a l terms t h a t apply t o t h o s e f i l e s , o r a n o t i c e i n d i c a t i n g
where t o find t h e a p p l i c a b l e terms .

A d d i t i o n a l terms , p e r m i s s i v e o r non−p e r m i s s i v e , may be s t a t e d i n t h e


form o f a s e p a r a t e l y w r i t t e n l i c e n s e , o r s t a t e d a s e x c e p t i o n s ;
t h e above r e q u i r e m e n t s apply e i t h e r way .

8 . Termination .

You may not p r o p a g a t e o r modify a c o v e r e d work e x c e p t a s e x p r e s s l y


p r o v i d e d under t h i s L i c e n s e . Any attempt o t h e r w i s e t o p r o p a g a t e o r
modify i t i s void , and w i l l a u t o m a t i c a l l y t e r m i n a t e your r i g h t s under
t h i s L i c e n s e ( i n c l u d i n g any p a t e n t l i c e n s e s g r a n t e d under t h e t h i r d
paragraph o f s e c t i o n 1 1 ) .
64 CHAPTER 5. LICENSE AGREEMENT

However , i f you c e a s e a l l v i o l a t i o n o f t h i s L i c e n s e , then your


l i c e n s e from a p a r t i c u l a r c o p y r i g h t h o l d e r i s r e i n s t a t e d ( a )
p r o v i s i o n a l l y , u n l e s s and u n t i l t h e c o p y r i g h t h o l d e r e x p l i c i t l y and
f i n a l l y t e r m i n a t e s your l i c e n s e , and ( b ) permanently , i f t h e c o p y r i g h t
h o l d e r f a i l s t o n o t i f y you o f t h e v i o l a t i o n by some r e a s o n a b l e means
p r i o r t o 60 days a f t e r t h e c e s s a t i o n .

Moreover , your l i c e n s e from a p a r t i c u l a r c o p y r i g h t h o l d e r i s


r e i n s t a t e d permanently i f t h e c o p y r i g h t h o l d e r n o t i f i e s you o f t h e
v i o l a t i o n by some r e a s o n a b l e means , t h i s i s t h e f i r s t time you have
r e c e i v e d n o t i c e o f v i o l a t i o n o f t h i s L i c e n s e ( f o r any work ) from t h a t
c o p y r i g h t h o l d e r , and you c u r e t h e v i o l a t i o n p r i o r t o 30 days a f t e r
your r e c e i p t o f t h e n o t i c e .

Termination o f your r i g h t s under t h i s s e c t i o n d o e s not t e r m i n a t e t h e


l i c e n s e s o f p a r t i e s who have r e c e i v e d c o p i e s o r r i g h t s from you under
this License . I f your r i g h t s have been t e r m i n a t e d and not permanently
r e i n s t a t e d , you do not q u a l i f y t o r e c e i v e new l i c e n s e s f o r t h e same
m a t e r i a l under s e c t i o n 1 0 .

9 . Acceptance Not Required f o r Having C o p i e s .

You a r e not r e q u i r e d t o a c c e p t t h i s L i c e n s e i n o r d e r t o r e c e i v e o r
run a copy o f t h e Program . A n c i l l a r y p r o p a g a t i o n o f a c o v e r e d work
o c c u r r i n g s o l e l y a s a c o n s e q u e n c e o f u s i n g peer −to−p e e r t r a n s m i s s i o n
t o r e c e i v e a copy l i k e w i s e d o e s not r e q u i r e a c c e p t a n c e . However ,
n o t h i n g o t h e r than t h i s L i c e n s e g r a n t s you p e r m i s s i o n t o p r o p a g a t e o r
modify any c o v e r e d work . These a c t i o n s i n f r i n g e c o p y r i g h t i f you do
not a c c e p t t h i s L i c e n s e . T h e r e f o r e , by m o d i f y i n g o r p r o p a g a t i n g a
c o v e r e d work , you i n d i c a t e your a c c e p t a n c e o f t h i s L i c e n s e t o do s o .

1 0 . Automatic L i c e n s i n g o f Downstream R e c i p i e n t s .

Each time you convey a c o v e r e d work , t h e r e c i p i e n t a u t o m a t i c a l l y


r e c e i v e s a l i c e n s e from t h e o r i g i n a l l i c e n s o r s , t o run , modify and
p r o p a g a t e t h a t work , s u b j e c t t o t h i s L i c e n s e . You a r e not r e s p o n s i b l e
f o r e n f o r c i n g c o m p l i a n c e by t h i r d p a r t i e s with t h i s L i c e n s e .

An ” e n t i t y t r a n s a c t i o n ” i s a t r a n s a c t i o n t r a n s f e r r i n g c o n t r o l o f an
o r g a n i z a t i o n , o r s u b s t a n t i a l l y a l l a s s e t s o f one , o r s u b d i v i d i n g an
o r g a n i z a t i o n , o r merging o r g a n i z a t i o n s . I f propagation of a covered
work r e s u l t s from an e n t i t y t r a n s a c t i o n , each p a r t y t o t h a t
t r a n s a c t i o n who r e c e i v e s a copy o f t h e work a l s o r e c e i v e s whatever
l i c e n s e s t o t h e work t h e party ’ s p r e d e c e s s o r i n i n t e r e s t had o r c o u l d
g i v e under t h e p r e v i o u s paragraph , p l u s a r i g h t t o p o s s e s s i o n o f t h e
C o r r e s p o n d i n g S o u r c e o f t h e work from t h e p r e d e c e s s o r i n i n t e r e s t , i f
t h e p r e d e c e s s o r has i t o r can get i t with r e a s o n a b l e e f f o r t s .

You may not impose any f u r t h e r r e s t r i c t i o n s on t h e e x e r c i s e o f t h e


r i g h t s g r a n t e d o r a f f i r m e d under t h i s L i c e n s e . For example , you may
not impose a l i c e n s e f e e , r o y a l t y , o r o t h e r c h a r g e f o r e x e r c i s e o f
r i g h t s g r a n t e d under t h i s L i c e n s e , and you may not i n i t i a t e l i t i g a t i o n
( i n c l u d i n g a cross−c l a i m o r c o u n t e r c l a i m i n a l a w s u i t ) a l l e g i n g t h a t
any p a t e n t c l a i m i s i n f r i n g e d by making , u s i n g , s e l l i n g , o f f e r i n g f o r
s a l e , o r i m p o r t i n g t h e Program o r any p o r t i o n o f i t .

11. Patents .

A ” c o n t r i b u t o r ” i s a c o p y r i g h t h o l d e r who a u t h o r i z e s u s e under t h i s
L i c e n s e o f t h e Program o r a work on which t h e Program i s based . The
work t h u s l i c e n s e d i s c a l l e d t h e c o n t r i b u t o r ’ s ” c o n t r i b u t o r version ”.
65

A contributor ’ s ” e s s e n t i a l patent claims ” are a l l patent claims


owned o r c o n t r o l l e d by t h e c o n t r i b u t o r , whether a l r e a d y a c q u i r e d o r
h e r e a f t e r a c q u i r e d , t h a t would be i n f r i n g e d by some manner , p e r m i t t e d
by t h i s L i c e n s e , o f making , u s i n g , o r s e l l i n g i t s c o n t r i b u t o r version ,
but do not i n c l u d e c l a i m s t h a t would be i n f r i n g e d o n l y a s a
c o n s e q u e n c e o f f u r t h e r m o d i f i c a t i o n o f t h e c o n t r i b u t o r version . For
purposes of t h i s d e f i n i t i o n , ”c o n t r o l ” i n c l u d e s the r i g h t to grant
p a t e n t s u b l i c e n s e s i n a manner c o n s i s t e n t with t h e r e q u i r e m e n t s o f
this License .

Each c o n t r i b u t o r g r a n t s you a non−e x c l u s i v e , worldwide , r o y a l t y −f r e e


p a t e n t l i c e n s e under t h e c o n t r i b u t o r ’ s e s s e n t i a l p a t e n t c l a i m s , t o
make , use , s e l l , o f f e r f o r s a l e , import and o t h e r w i s e run , modify and
p r o p a g a t e t h e c o n t e n t s o f i t s c o n t r i b u t o r version .

In t h e f o l l o w i n g t h r e e paragraphs , a ” p a t e n t l i c e n s e ” i s any e x p r e s s
agreement o r commitment , however denominated , not t o e n f o r c e a p a t e n t
( such a s an e x p r e s s p e r m i s s i o n t o p r a c t i c e a p a t e n t o r c ov ena nt not t o
s u e f o r p a t e n t i n f r i n g e m e n t ) . To ” g r a n t ” such a p a t e n t l i c e n s e t o a
p a r t y means t o make such an agreement o r commitment not t o e n f o r c e a
patent a g a i n s t the party .

I f you convey a c o v e r e d work , knowingly r e l y i n g on a p a t e n t l i c e n s e ,


and t h e C o r r e s p o n d i n g S o u r c e o f t h e work i s not a v a i l a b l e f o r anyone
t o copy , f r e e o f c h a r g e and under t h e terms o f t h i s L i c e n s e , through a
p u b l i c l y a v a i l a b l e network s e r v e r o r o t h e r r e a d i l y a c c e s s i b l e means ,
then you must e i t h e r ( 1 ) c a u s e t h e C o r r e s p o n d i n g S o u r c e t o be s o
a v a i l a b l e , or (2) arrange to deprive y o u r s e l f of the b e n e f i t of the
p a t e n t l i c e n s e f o r t h i s p a r t i c u l a r work , o r ( 3 ) a r r a n g e , i n a manner
c o n s i s t e n t with t h e r e q u i r e m e n t s o f t h i s L i c e n s e , t o extend t h e p a t e n t
l i c e n s e t o downstream r e c i p i e n t s . ”Knowingly r e l y i n g ” means you have
a c t u a l knowledge that , but f o r t h e p a t e n t l i c e n s e , your c o n v e y i n g t h e
c o v e r e d work i n a country , o r your r e c i p i e n t ’ s u s e o f t h e c o v e r e d work
i n a country , would i n f r i n g e one o r more i d e n t i f i a b l e p a t e n t s i n t h a t
c o u n t r y t h a t you have r e a s o n t o b e l i e v e a r e v a l i d .

I f , p u r s u a n t t o o r i n c o n n e c t i o n with a s i n g l e t r a n s a c t i o n o r
arrangement , you convey , o r p r o p a g a t e by p r o c u r i n g conveyance o f , a
c o v e r e d work , and g r a n t a p a t e n t l i c e n s e t o some o f t h e p a r t i e s
r e c e i v i n g t h e c o v e r e d work a u t h o r i z i n g them t o use , propagate , modify
o r convey a s p e c i f i c copy o f t h e c o v e r e d work , then t h e p a t e n t l i c e n s e
you g r a n t i s a u t o m a t i c a l l y e x tende d t o a l l r e c i p i e n t s o f t h e c o v e r e d
work and works based on i t .

A p a t e n t l i c e n s e i s ” d i s c r i m i n a t o r y ” i f i t d o e s not i n c l u d e w i t h i n
t h e s c o p e o f i t s c o v e r a g e , p r o h i b i t s t h e e x e r c i s e of , o r i s
c o n d i t i o n e d on t h e non−e x e r c i s e o f one o r more o f t h e r i g h t s t h a t a r e
s p e c i f i c a l l y g r a n t e d under t h i s L i c e n s e . You may not convey a c o v e r e d
work i f you a r e a p a r t y t o an arrangement with a t h i r d p a r t y t h a t i s
i n t h e b u s i n e s s o f d i s t r i b u t i n g s o f t w a r e , under which you make payment
t o t h e t h i r d p a r t y based on t h e e x t e n t o f your a c t i v i t y o f c o n v e y i n g
t h e work , and under which t h e t h i r d p a r t y g r a n t s , t o any o f t h e
p a r t i e s who would r e c e i v e t h e c o v e r e d work from you , a d i s c r i m i n a t o r y
p a t e n t l i c e n s e ( a ) i n c o n n e c t i o n with c o p i e s o f t h e c o v e r e d work
conveyed by you ( o r c o p i e s made from t h o s e c o p i e s ) , o r ( b ) p r i m a r i l y
f o r and i n c o n n e c t i o n with s p e c i f i c p r o d u c t s o r c o m p i l a t i o n s t h a t
c o n t a i n t h e c o v e r e d work , u n l e s s you e n t e r e d i n t o t h a t arrangement ,
o r t h a t p a t e n t l i c e n s e was granted , p r i o r t o 28 March 2 0 0 7 .

Nothing i n t h i s L i c e n s e s h a l l be c o n s t r u e d a s e x c l u d i n g o r l i m i t i n g
any i m p l i e d l i c e n s e o r o t h e r d e f e n s e s t o i n f r i n g e m e n t t h a t may
o t h e r w i s e be a v a i l a b l e t o you under a p p l i c a b l e p a t e n t law .
66 CHAPTER 5. LICENSE AGREEMENT

1 2 . No S u r r e n d e r o f Others ’ Freedom .

I f c o n d i t i o n s a r e imposed on you ( whether by c o u r t o r d e r , agreement o r


o t h e r w i s e ) t h a t c o n t r a d i c t t h e c o n d i t i o n s o f t h i s L i c e n s e , they do not
e x c u s e you from t h e c o n d i t i o n s o f t h i s L i c e n s e . I f you cannot convey a
c o v e r e d work s o a s t o s a t i s f y s i m u l t a n e o u s l y your o b l i g a t i o n s under t h i s
L i c e n s e and any o t h e r p e r t i n e n t o b l i g a t i o n s , then a s a c o n s e q u e n c e you may
not convey i t a t a l l . For example , i f you a g r e e t o terms t h a t o b l i g a t e you
t o c o l l e c t a r o y a l t y f o r f u r t h e r c o n v e y i n g from t h o s e t o whom you convey
t h e Program , t h e o n l y way you c o u l d s a t i s f y both t h o s e terms and t h i s
L i c e n s e would be t o r e f r a i n e n t i r e l y from c o n v e y i n g t h e Program .

1 3 . Use with t h e GNU A f f e r o G e n e r a l P u b l i c L i c e n s e .

N o t w i t h s t a n d i n g any o t h e r p r o v i s i o n o f t h i s L i c e n s e , you have


p e r m i s s i o n t o l i n k o r combine any c o v e r e d work with a work l i c e n s e d
under version 3 o f t h e GNU A f f e r o G e n e r a l P u b l i c L i c e n s e i n t o a s i n g l e
combined work , and t o convey t h e r e s u l t i n g work . The terms o f t h i s
L i c e n s e w i l l c o n t i n u e t o apply t o t h e p a r t which i s t h e c o v e r e d work ,
but t h e s p e c i a l r e q u i r e m e n t s o f t h e GNU A f f e r o G e n e r a l P u b l i c L i c e n s e ,
s e c t i o n 1 3 , c o n c e r n i n g i n t e r a c t i o n through a network w i l l apply t o t h e
c o m b i n a t i o n a s such .

14. Revised Versions of t h i s License .

The Free S o f t w a r e Foundation may p u b l i s h r e v i s e d and/ o r new v e r s i o n s o f


t h e GNU G e n e r a l P u b l i c L i c e n s e from time t o time . Such new v e r s i o n s w i l l
be s i m i l a r i n s p i r i t t o t h e p r e s e n t version , but may d i f f e r i n d e t a i l t o
a d d r e s s new problems o r c o n c e r n s .

Each version i s g i v e n a d i s t i n g u i s h i n g version number . I f the


Program s p e c i f i e s t h a t a c e r t a i n numbered version o f t h e GNU G e n e r a l
P u b l i c L i c e n s e ”o r any l a t e r version ” a p p l i e s t o i t , you have t h e
o p t i o n o f f o l l o w i n g t h e terms and c o n d i t i o n s e i t h e r o f t h a t numbered
version o r o f any l a t e r version p u b l i s h e d by t h e Free S o f t w a r e
Foundation . I f t h e Program d o e s not s p e c i f y a version number o f t h e
GNU G e n e r a l P u b l i c L i c e n s e , you may c h o o s e any version e v e r p u b l i s h e d
by t h e Free S o f t w a r e Foundation .

I f t h e Program s p e c i f i e s t h a t a proxy can d e c i d e which f u t u r e


v e r s i o n s o f t h e GNU G e n e r a l P u b l i c L i c e n s e can be used , t h a t proxy ’ s
p u b l i c s t a t e m e n t o f a c c e p t a n c e o f a version permanently a u t h o r i z e s you
t o c h o o s e t h a t version f o r t h e Program .

L a t e r l i c e n s e v e r s i o n s may g i v e you a d d i t i o n a l o r d i f f e r e n t
p e r m i s s i o n s . However , no a d d i t i o n a l o b l i g a t i o n s a r e imposed on any
a u t h o r o r c o p y r i g h t h o l d e r a s a r e s u l t o f your c h o o s i n g t o f o l l o w a
l a t e r version .

1 5 . D i s c l a i m e r o f Warranty .

THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY


APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM ”AS IS ” WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED , INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING , REPAIR OR CORRECTION.

16. Limitation of L i a b i l i t y .
67

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING


WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL , INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS) ,
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.

1 7 . I n t e r p r e t a t i o n o f S e c t i o n s 15 and 1 6 .

I f t h e d i s c l a i m e r o f warranty and l i m i t a t i o n o f l i a b i l i t y p r o v i d e d
above cannot be g i v e n l o c a l l e g a l e f f e c t a c c o r d i n g t o t h e i r terms ,
r e v i e w i n g c o u r t s s h a l l apply l o c a l law t h a t most c l o s e l y a p p r o x i m a t e s
an a b s o l u t e w a i v e r o f a l l c i v i l l i a b i l i t y i n c o n n e c t i o n with t h e
Program , u n l e s s a warranty o r assumption o f l i a b i l i t y accompanies a
copy o f t h e Program i n return f o r a f e e .

END OF TERMS AND CONDITIONS

How t o Apply These Terms t o Your New Programs

I f you d e v e l o p a new program , and you want i t t o be o f t h e g r e a t e s t


p o s s i b l e u s e t o t h e p u b l i c , t h e b e s t way t o a c h i e v e t h i s i s t o make i t
f r e e s o f t w a r e which e v e r y o n e can r e d i s t r i b u t e and change under t h e s e terms .

To do so , a t t a c h t h e f o l l o w i n g n o t i c e s t o t h e program . It is safest
t o a t t a c h them t o t h e s t a r t o f each s o u r c e f i l e t o most e f f e c t i v e l y
s t a t e t h e e x c l u s i o n o f warranty ; and each f i l e s h o u l d have a t l e a s t
t h e ” c o p y r i g h t ” l i n e and a p o i n t e r t o where t h e f u l l n o t i c e i s found .

<one l i n e t o g i v e t h e program ’ s name and a b r i e f i d e a o f what i t d o e s .>


C opyr i ght (C) <year> <name o f author>

This program i s f r e e s o f t w a r e : you can r e d i s t r i b u t e i t and/ o r modify


i t under t h e terms o f t h e GNU G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d by
t h e Free S o f t w a r e Foundation , e i t h e r version 3 o f t h e L i c e n s e , o r
( a t your o p t i o n ) any l a t e r version .

This program i s d i s t r i b u t e d i n t h e hope t h a t i t w i l l be u s e f u l ,


but WITHOUT ANY WARRANTY; w i t h o u t even t h e i m p l i e d warranty o f
MERCHANTABILITY o r FITNESS FOR A PARTICULAR PURPOSE. See t h e
GNU G e n e r a l P u b l i c L i c e n s e f o r more d e t a i l s .

You s h o u l d have r e c e i v e d a copy o f t h e GNU G e n e r a l P u b l i c L i c e n s e


a l o n g with t h i s program . I f not , s e e <h t t p : / /www. gnu . o r g / l i c e n s e s />.

Also add i n f o r m a t i o n on how t o c o n t a c t you by e l e c t r o n i c and paper m a i l .

I f t h e program d o e s terminal i n t e r a c t i o n , make i t output a s h o r t


n o t i c e l i k e t h i s when i t s t a r t s i n an i n t e r a c t i v e mode :

<program> C opyr i ght (C) <year> <name o f author>


This program comes with ABSOLUTELY NO WARRANTY; f o r d e t a i l s type ‘ show w ’ .
This i s f r e e s o f t w a r e , and you a r e welcome t o r e d i s t r i b u t e i t
under c e r t a i n c o n d i t i o n s ; type ‘ show c ’ f o r d e t a i l s .

The h y p o t h e t i c a l commands ‘ show w’ and ‘ show c ’ s h o u l d show t h e a p p r o p r i a t e


p a r t s o f t h e G e n e r a l P u b l i c L i c e n s e . Of c o u r s e , your program ’ s commands
might be d i f f e r e n t ; f o r a GUI i n t e r f a c e , you would u s e an ”about box ”.
68 CHAPTER 5. LICENSE AGREEMENT

You s h o u l d a l s o get your employer ( i f you work a s a programmer ) o r s c h o o l ,


i f any , t o sign a ” c o p y r i g h t d i s c l a i m e r ” f o r t h e program , i f n e c e s s a r y .
For more i n f o r m a t i o n on t h i s , and how t o apply and f o l l o w t h e GNU GPL, s e e
<h t t p : / /www. gnu . o r g / l i c e n s e s />.

The GNU G e n e r a l P u b l i c L i c e n s e d o e s not p e r m i t i n c o r p o r a t i n g your program


i n t o p r o p r i e t a r y programs . I f your program i s a s u b r o u t i n e l i b r a r y , you
may c o n s i d e r i t more u s e f u l t o p e r m i t l i n k i n g p r o p r i e t a r y a p p l i c a t i o n s with
the l i b r a r y . I f t h i s i s what you want t o do , u s e t h e GNU L e s s e r G e n e r a l
P u b l i c L i c e n s e i n s t e a d o f t h i s L i c e n s e . But f i r s t , p l e a s e r e a d
<h t t p : / /www. gnu . o r g / p h i l o s o p h y /why−not−l g p l . html >.
Bibliography

[1] Bjørn A. J. Angelsen. Ultrasound Imaging, volume 1. Emantec, Trondheim, Norway,


2000.
[2] Bjørn A. J. Angelsen. Ultrasound Imaging, volume 2. Emantec, Trondheim, Norway,
2000.
[3] Christopher Hulbert. MAT File I/O Library. SourceForge,
http://sourceforge.net/projects/matio.
[4] Francis A. Duck. Physical Properties of Tissue. Academic Press, London, 1990.
[5] Free Software Foundation, http://www.gnu.org/copyleft/gpl. GNU General Public
License.
[6] Matteo Frigo and Steven G. Johnson. FFTW 3.1.3. Massachussetts Institute of
Technology, www.fftw.org, 2003.
[7] Mark F. Hamilton and David T. Blackstock. Nonlinear Acoustics. Academic Press,
San Diego, 1997.
[8] University of Tennessee, Knoxville, Tennessee, http://math-atlas.sourceforge.net/.
Automatically Tuned Linear Algebra Software, 2008.
[9] Trond Varslot and Svein-Erik Måsøy. Forward Propagation of Acoustic Pressure
Pulses in 3D Soft Biological Tissue. Modeling, Identification and Control, 27(3):181–
200, 2006.
[10] Trond Varslot and Gunnar Taraldsen. Computer Simulation of Forward Propagation
in Soft Tissue. IEEE Transactions on Ultrasonics, Ferroelectrics, and Frequency
Control, 52:1473–82, 2005.

69

You might also like