A photon transport simulation is initiated with

solution = ValoMC(mesh, medium, boundary, options);

solution = ValoMC(mesh, medium, boundary);

Documentation for each input structure and the output structure is provided here. Most of the fields in the input structures are arrays. For convenience, it is also possible to give the fields as scalars or as incomplete arrays. ValoMC will fill the arrays with the scalar value or complete them with the default values.

Input structures

1: mesh

The mesh structure defines the geometry of the problem.

Field name Description Unit Element type [array size]
r grid point coordinates mm double [Nr = number of coordinates in the system x 3]
H indices to the grid points (tetrahedrons), i.e element topology
int64 [Ne = number of elements in the system x 4]
BH indices to the boundary grid points (edges)
int64 [Nb = number of edges in the system x 2]
Optional fields
HN neighborhood topology
int64 [Ne = number of elements in the system x 4]



Geometry description

A single volume element is a tetrahedron.

For example, a simple cuboidal region that consists of six tetrahedrons can be built with the coordinate matrix

\begin{equation*} r = \left(\begin{array}{cc}1 & 1 & 1\\1 & 2 & 1\\2 & 1 & 1\\2 & 2 & 1\\1 & 1 & 2\\1 & 2 & 2\\2 & 1 & 2\\2 & 2 & 2\end{array}\right) \end{equation*}

and network topology matrices

\begin{equation*} H = \left(\begin{array}{ccc}5 & 1 & 2 & 3\\6 & 5 & 2 & 3\\6 & 7 & 5 & 3\\6 & 4 & 7 & 3\\6 & 2 & 4 & 3\\6 & 8 & 7 & 4\\\end{array}\right) BH = \left(\begin{array}{cc}3 & 1 & 5\\3 & 7 & 5\\3 & 4 & 7\\3 & 7 & 8\\4 & 8 & 6\\4 & 2 & 6\\2 & 1 & 5\\5 & 6 & 2\\7 & 5 & 8\\5 & 6 & 8\\4 &3 &1\\8 & 2 & 4\\\end{array}\right) \end{equation*}

The elements in H and BH refer to the rows in r. Each row in H refers to a single tetrahedron and each row in BH refers to a single boundary element (triangle). As the box boundary consists of 6 faces (12 triangles) and six tetrahedrons, there are 12 rows in BH and six rows in H. The first row of matrix H is illustrated in the figure below

mesh3d.png





2: medium

This structure is used to set the properties of the the medium. Ne is the number elements in the mesh. If a scalar value is given, it is applied to all elements.

Field name Description Unit Element type [array size]
refractive_index \(n\)
double [Ne] or double [Ne x 3]
absorption_coefficient \(\mu_a\) 1/mm double [Ne] or double [Ne x 3]
scattering_coefficient \(\mu_s\) 1/mm double [Ne] or double [Ne x 3]
scattering_anisotropy \(g\) (Henye-Greenstein phase function)
double [Ne] or double [Ne x 3]



For detailed description of the coefficients, see e.g. the books by [Ihshimaru] and [Wang]

[Ishimaru] Wave Propagation and Scattering in Random Media, IEEE Press and Oxford University Press, 1997 [Wang] Biomedical Optics Principles and Imaging, Wiley, 2007

When three dimensional arrays are used, it is assumed that the mesh has been created with createGridMesh. The values then represent the values in each in grid point.



3: boundary

This structure is used to set the properties of the boundary surrounding the medium. Nb refers to the number of elements in the boundary. If a scalar value is given, it is applied to all elements.

Field name Description Unit Element type [array size]
lightsource
Sets the light source type for each boundary element
'none': (default) no light source
'direct': direct light
'cosinic': the directivity follows a cosine pattern
'isotropic': photon packets will be launched at equal propability to all directions
'pencil': pencil beam traveling perpendicular to the face normal
double [Nb]
Optional fields
exterior_refractive_index Sets the refractive index outside of the simulation geometry. This affects how the photon packets reflect when they encounter a boundary element.
double [Nb ]
Optional fields (lightsource="direct, cosinic, isotropic")
lightsource_direction Used to give a custom direction for a light source
double [Nb x 3 ]
lightsource_direction_type
Used to set the coordinate system in which the light direction is given
'relative': (default) light direction is given relative to the surface normal, i.e. (0,1) is the same as inward pointing surface normal and (1,0) is directed along the edge line.
'absolute': light direction is given in the position coordinate system
cell [Nb]
lightsource_irradiance Sets the relative irradiance of the light source at each boundary element. (default=1)
Optional fields (lightsource='pencil')
lightsource_position The coordinate where to place the pencil beam to. Must be located within the boundary element.
cell [Nb]





4: options

All fields are optional.

Field name Description Unit Type
frequency (default=0) Frequency of intensity modulation [1/s] double
phase0 (default=0) Phase at the lightsource for frequency modulation
double
seed Random number generator seed (default={}) take seed from time
int64
photon_count (default=1e6) Total number of photon packets
int64
disable_progressbar (default=false) Set to true to disable progress bar
logical





Output structure

1: solution

Field name Description Unit Element type [array size]
boundary_exitance Exitance at the edge of each boundary element W/mm double [Nb = number of boundary elements in the system ]
element_fluence Fluence at each element
double [Ne = number of area elements in the system]
simulation_time Total simulation time seconds
Optional fields (options.seed=0)
seed_used The random number seed that was used
double
Optional fields (multidimensional optical parameters)
grid_fluence Fluence for three dimensional optical parameters W/mm double

Output description

The fluence is normalized so that that the integral of the exitance over the boundary 1 W when no photons are absorbed in the medium (i.e. \(\mu_a=0\)). This means the total power of a all light sources is in a single simulation is 1 W.