. (4.31)
Based on the scattering angle, the new photon direction is obtained by
µ0x= cos(θ2D)µx+ sin(θ2D)µz (4.32)
µ0z= cos(θ2D)µz− sin(θ2D)µx. (4.33)
RMC was only implemented in 2D meaning it was this scheme that was used.
4.2 Implementation of MC
There are a variety of implementational aspects of the basic MC algorithm for light transport, including spatial discretisation, source implementation, boundary conditions as well as parallelisation. These are discussed below.
4.3 Spatial discretisation and basis
The quantity of interest, whether it be the fluence or the absorbed energy density, must be scored in a particular region or subdomain. This is achieved by splitting the domain into subdomains uj, where Ω = ∪Jjuj, over which there are distributed basis functions governing the energy deposited in a set of subdomains. Given that Np photons traverse a subdomain, the fractions of weight they deposit ∆Wnpmust be summed over the number
of photons, PNp
np=1∆Wnp, and then integrated over the basis function. In the case of a piecewise constant basis, the integral is performed over the subdomain to form the total weight deposited: Wtot, j =R
uj
PNp
np=1∆WnpdVj where dVjis the volume of the jth subdomain, uj, (in 2D, the integral is performed over an area). This is consistent with definitions provided by Boas et al. [166] excluding normalisation, which is addressed in the next section.
A simple model of tissue is to consider it being composed of a number of stacked semi-infinite slabs with different optical properties. MCML [167] models the tissue using multiple homogeneous layers in the xy-directions. As such, this geometry has cylindrical symmetry and, using a piecewise constant basis, scored quantities are obtained by inte-grating over the radius and z-axis between znto zn+ ∆z, for layer thickness ∆z and the nth slab. This way of simplifying tissue geometry is not applicable to most geometries imaged using PAT; for this reason, this model has recently been extended to include inclusions, first, of spherical tissues [168] and later spheroidal and cylindrical inclusions [169], which may be suitable for modelling light transport for lymph node or tumour imaging.
In order to model light transport in arbitrarily complex geometries, a voxelised grid or mesh is required. Grids offer the advantage that they are simple to navigate computation-ally for weight deposition, achieved through simple truncation of the photon’s physical coordinates. A mesh requires the photon’s coordinates to be mapped to the barycentric coordinates associated with the mesh element, which is more computationally expen-sive. However, a grid composed of cuboid elements cannot accurately – or at least not straightforwardly – account for internal index of refraction mismatch [170] (unless these occur between cuboid objects), and can only model mismatch at the domain boundaries [132, 162]; on the other hand, the use of tetrahedral or higher order polyhedral ele-ments can be used in such a way that surfaces are accurately modelled, thus allowing regions where there is a refractive index change (e.g. between CSF and the cortex) to be accurately modelled using ray-polyhedra intersections [133].
The intersection tests required for the refraction of light via index mismatch are also use-ful for updating the step length of Eq. (4.16) due to changes in the scattering coefficient
[162]
S ← (S − d)µs,1
µs,2, (4.34)
where the arrow is used to indicate replacement, d is the distance from the photon’s cur-rent position to the nearest polyhedron face that it crossed that has a value of µs,26= µs,1, where µs,1is the scattering coefficient in the current element (note that with alternative weight deposition schemes µt= µa+ µsis used instead of just µs[161]). It is desirable to avoid the computationally expensive ray-polyhedra tests, which was achieved by Fang et al. [132] by propagating the photon in increments, typically less than a voxel edge length dS, and updating the total step length S according to Eq. (4.34) except with d = nSdS where nS is the number of voxel edges traversed. Of course, this is likely to yield a small error, ∆S, in the updated step length as it has travelled this distance in µs,2rather than µs,1as illustrated in Fig. 4.5; the erroneous portion of the expression,
∆µSµµs,2
s,1, is very small for changes in media where the scattering coefficient is similar in magnitude (true for many biological tissues) and the error will also tend to zero as dS → 0, i.e. as the photon is then stepped in small fractions along the trajectory. RMC uses the stepping scheme for benefits in terms of speed.
FI G U R E 4 . 5 : Diagram of photon trajectory traversing multiple voxels, illustrating error in path length, ∆S, when there is a change in the scattering coefficient µs,2in the
grey region.
This stepping approach is extendable to unstructured grids such as an octree geometry.
Discretisation in an octree consists of a grid with a maxmimum voxel edge length Lmax
and all other voxels are either this size or are the result of subdivision of a parent voxel nv times, yielding a family of voxels with edge length Lmax/2nv. This offers a great deal
of flexibility in terms of coarseness of discretisation and has significant benefits in terms of memory storage of the medium properties and scored quantities; however, in order for the error in S to remain small, the photon would have to step the minimum Lmax/2nv associated with each parent voxel, which is compute intensive.
4.3.1 Normalisation and sources
Quantities output by MC simulations require normalisation so that they are representa-tive of the energy input and are not scaled by the number of photons simulated. The latter can be removed by simply dividing the result by the number of photons, while the former requires the data to be multiplied by the total energy input; e.g. for a 20mJ pulse of energy, the fluence output from MC must just be multiplied by this number to have the correct units [171].
Source implementation in grid geometry is straightforward as it simply involves launch-ing photons from a particular position with a given direction. An isotropic point source, either inside the domain or on the boundary, simply involves launching photons from the same starting position and distributing their direction randomly over 4π Steradians:
θin= 2πU ([0, 1]) (4.35)
ψin= arccos(2U ([0, 1]) − 1), (4.36)
where θin and ψin are the polar and azimuthal angles, respectively (in 2D only Eq.
(4.35) is required for an isotropic source). A pencil beam is achieved by launching all the photons in the same direction, whereas a collimated broadbeam can be achieved by launching all photons in the direction of collimation and adding uniformly distributed values in the x- or xy-directions about the central position. Similarly a Gaussian beam can be used by shifting the launching positions of photons about their central position using normally distributed random variables and in homogeneous media this can be realised using convolution with a Gaussian kernel [171].
4.3.2 Boundary conditions
Treatment of photons exiting the domain often involves ray-polyhedra intersections, except when the internal and external indices of refraction, ni and ne, are matched giving a reflection coefficient of zero. This can be generalised to the situation where there is a non-zero reflection coefficient at the boundary and photons are reflected specularly: θi = θr i.e. the angle of incidence to the normal is equal to the reflected angle and the new photon direction is given by ˆs ← 2(ˆn · ˆs)ˆn − ˆs, where ˆnis the normal to the reflecting surface. Under these conditions the reflected photon weight is scaled by Rwhere
R = ni− ne ni+ ne
2
, (4.37)
which may be representative of many situations in both in vivo and ex vivo PAT imaging, as the target is often immersed in water or acoustically coupled to the detector using ultrasound gel. Thus, in the case where ni = ne, the boundary is index matched and R = 0, meaning no light travels inward from the boundary (except from sources on the boundary).
4.3.3 Photon termination and variance reduction
Photons that escape the domain are terminated, but those that remain in the domain must be terminated using a threshold condition as their weight approaches zero asymp-totically and can survive indefinitely without the application of a threshold, WT. It is typical to propagate a photon as long as its weight is greater than WT. However, this is often coupled with a variance reduction scheme called ‘roulette’. Roulette prevents the propagation of a large number of low-weight photons which do not contribute sig-nificantly to the result and instead performs unbiased selection of a single photon to propagate the weight of others; this is achieved by allowing the survival of 1/CT photons whose weight is below WT, if a uniform random variable U ([0, 1]) < CT; the surviving photon’s weight is then scaled to be CTW [52]; a typical choice for CT is 1/10.
Certain variance reduction techniques involve importance sampling which encourages photon trajectories that are more likely to interact with a light detector to be sampled more frequently than those that do not yield a detection event [172]. Of course, in PAT, the optical detector is effectively distributed over the entire domain as light absorption anywhere in the tissue will yield a PA signal. Domain splitting techniques [173] can also help reduce variance in fluence estimates, but given that this would involve compromis-ing resolution in PAT, this is unattractive; nevertheless, this is akin to the octree method of spatial discretisation described in Section 4.3 and may be useful in variance reduction away from regions of interest in the inverse problem. A number of other variance reduc-tion methods exist [174, 175] but are not either applicable to photon transport using the RTE for a single wavelength/time gate or when optical detection is distributed over the illuminated volume and isotropic as in PAT.
4.3.4 Parallelisation and hardware
Photons in MC simulations are propagated completely independently, meaning each photon can be treated using an independent thread with minimal cross-talk between threads. This has long been an area of reserach [176] in biomedical applications of MC light transport simulations; however, recent advances in computing hardware have facilitated highly parallelised MC implementations. The availability of multicore CPU processors have allowed multithreading of C/C++ MC codes providing approximately an order of magntidue increase in speed compared with serial implementations, while the accessibility of high memory (several GB) GPGPUs [177] have allowed the development of high-speed MC codes such as MCX [132], MMC [133] and a GPU-accelerated version of MCML, CUDAMCML [178], which provide two to three orders of magnitude speed up over their serial counterparts. RMC was implemented in ‘Julia’ [179], a high-level language, which allowed straightforward parallelisation over multiple CPU cores on a single node.