Abstract
Accurate and efficient forward models of photon migration in heterogeneous geometries are important for many applications of light in medicine because many biological tissues exhibit a layered structure of independent optical properties and thickness. However, closed form analytical solutions are not readily available for layered tissue-models, and often are modeled using computationally expensive numerical techniques or theoretical approximations that limit accuracy and real-time analysis. Here, we develop an open-source accurate, efficient, and stable numerical routine to solve the diffusion equation in the steady-state and time-domain for a layered cylinder tissue model with an arbitrary number of layers and specified thickness and optical coefficients. We show that the steady-state ( ms) and time-domain ( ms) fluence (for an 8-layer medium) can be calculated with absolute numerical errors approaching machine precision. The numerical implementation increased computation speed by 3 to 4 orders of magnitude compared to previously reported theoretical solutions in layered media. We verify our solutions asymptotically to homogeneous tissue geometries using closed form analytical solutions to assess convergence and numerical accuracy. Approximate solutions to compute the reflected intensity are presented which can decrease the computation time by an additional 2–3 orders of magnitude. We also compare our solutions for 2, 3, and 5 layered media to gold-standard Monte Carlo simulations in layered tissue models of high interest in biomedical optics (e.g. skin/fat/muscle and brain). The presented routine could enable more robust real-time data analysis tools in heterogeneous tissues that are important in many clinical applications such as functional brain imaging and diffuse optical spectroscopy.
Subject terms: Software, Optical spectroscopy
Introduction
Optical properties can be used as indicators of pathological and physiological conditions of biological tissue1,2. Accurate quantitation of these properties from experimental measurements depend on analytical models that need to account for the structural complexity of the tissue system. Therefore, it is important to consider the optical heterogeneity of biological tissues, which are usually approximated as optically homogeneous to facilitate data analysis3,4. Experimentally, light propagation measurements are made by illuminating the tissue surface with either a continuous, frequency modulated, or pulsed light source and collecting measurements of the scattered light after it has propagated through the tissue medium5,6. Measured optical signals are translated into absorption and scattering properties of the medium by utilizing an appropriate forward model of light transport that best represents the measured data7,8.
Light propagation in random media such as biological tissues is theoretically modeled using the Radiative Transfer Equation (RTE)9–11. Due to the highly scattering nature of these media, the RTE can be reduced to the diffusion equation, which gives analytical solutions in homogeneous, semi-infinite, or infinite slab geometries12,13. The RTE can also be solved by the Monte Carlo method which remains the gold-standard approach to calculate light transport in media with complex geometries14 but is computationally expensive15. Although parallel implementations have significantly decreased the computational time of forward Monte Carlo simulations down to several seconds16–19, they still broadly remain non-viable as inverse solvers to obtain optical properties from experimental measurements in real-time (< 1 s) which require thousands of forward simulations at different modelling parameters16,18.
Theoretical approaches that account for structural complexity in tissues provide improved reconstruction of optical properties using diffuse optical measurements when studying brain hemodynamics20. Although Monte Carlo methods can simulate light propagation in realistic head geometries derived from magnetic resonance imaging (MRI) data16, modeling the head as layered homogeneous slabs, each with their own set of optical properties, provided similar accuracy in reconstruction of optical properties3. Further, diffuse optical measurements are applicable to various parts of the body that exhibit a layered structure (e.g. skin over top muscle, scalp and skull surrounding brain tissue). Therefore, an accurate, versatile and efficient analytical approach to model spatially and/or temporally resolved diffuse reflectance in layered media would enhance optical property reconstructions from diffuse optical measurements obtained in such layered media in vivo3.
Several methods to solve the diffusion equation for layered media have been reported in literature by using integral transforms21–24, method of images25, eigenfunctions26,27, or finite differences28. These methods do not give closed-form expressions directly in the spatial or time-domains for the photon fluence. Instead, the fluence in real-space is computed using numerical transforms24 or root-finding techniques26 which tend to increase numerical errors and computational costs29. For example, the integral transform approach24 solves the diffusion equation in the spatial-frequency domain which then must be inverse space-transformed (e.g. 2-D inverse Fourier) for real-space calculations. An additional inverse time Fourier transform is required for computation in the time-domain24. Both of these transforms make calculations of the steady-state and time-domain solutions difficult to compute for a wide range of optical and geometrical inputs21,24. Other approaches have been developed to compute geometries with large layer thicknesses and high scattering coefficients and/or spatial frequencies but rely on approximations21,30–32. Given these challenges, the fastest reported computational times for time-domain fluence in multi-layered media range between 0.5–5 s, depending on the number of layers and numerical accuracy required23,26,30,33. Such computational performance would preclude direct use of such layered analytical solutions for real-time analysis as optimization of multiple parameters in layered media would take several minutes34.
In this report, we present an accurate and efficient procedure for computing the photon fluence in a layered cylinder using solutions to the diffusion equation23. Our code is open-source and well documented for ease of use. We overcome the computational difficulties noted above by modifying the solutions23 in the spatial-frequency domain for numerical stability, which allows for computation of arbitrarily sized inputs without approximations. Lastly, we use an inverse Laplace transform for better convergence in the time-domain which improved the numerical accuracy while decreasing the computational cost by several orders of magnitude35,36. Below we describe: (a) implementation of the numerical solutions in the steady-state and time-domain for diffuse optical reflectance and transmittance measurements in N-layered media, (b) verification of the numerical accuracy and stability of the approach in calculating photon fluence for several source-detector configurations and tissue models, and (c) validation by direct comparisons to Monte Carlo simulations of fluence in multi-layered tissue models.
Methods
Theory
In highly scattering turbid media such as biological tissue, the steady-state diffusion equation37
1 |
can be used to approximate light propagation in random turbid media where , , , and denote the fluence rate, the diffusion coefficient, the absorption coefficient, and the reduced scattering coefficient, respectively37. The fluence can be used to calculate the diffusely reflected or transmitted intensity which are the quantities usually experimentally measured13. We assume an incident beam can be approximated by an isotropic point source located at a distance of from the incident surface. Using an integral transform, Eq. (1) can be solved in the spatial-frequency domain under extrapolated boundary conditions considering stacked layers of distinct absorption and scattering properties of arbitrary thickness as shown in Fig. 123,37. For the special case of a point source incident onto the center top of the cylinder, the fluence in the th layer can be expressed in real space after applying an inverse finite Hankel transform23,37 by
2 |
where is the Bessel function of first kind and order m and is determined from the roots of such that where n is the th root of . z is the detector depth within the medium in cylindrical coordinates such that is used for reflection calculations and where L is the sum of all the layer thicknesses is used for transmission. The extrapolated boundary is determined with where a is the radius of the cylinder and where A is proportional to the fraction of photons that are internally reflected at the boundary12. represents the Green’s function in the th layer which must be solved separately for each layer. Derivations of Eq. (2) are given in Appendix A of the Supplementary material along with the explicit expressions of in the topmost and bottommost layers. Applying inverse transforms directly to as previously given23,37 can lead to numerical overflow for large layer thicknesses, scattering coefficients, and frequencies. To overcome these issues, we give expressions for in terms of exponentially decaying terms that will not cause numerical overflow for large arguments and do not require any approximations.
Time-domain solutions are often computed using the inverse Fourier transform by using the substitution and computing the real and imaginary parts of the fluence in the frequency domain at many frequencies (400–4000)23,35. As these Fourier integrals are slow to converge and can rapidly oscillate, the number of nodes needed for Gaussian integration methods are highly dependent on input parameters which makes the Fourier integral difficult to accurately and efficiently compute35. Instead, an inverse Laplace transform with can be used and numerically integrated along a complex contour35,36. Utilizing a contour that begins and ends in the left hand plane Re forces a rapid decay of the integrand making for easier and faster numerical integration by using trapezoidal rules36. The corresponding solution for the time-domain fluence is then
3 |
where B denotes the Bromwich path with being a complex number along the contour. A single contour is considered for rapid evaluation of the fluence at many time points for 35,36. The full derivation of the time-domain solution shown in Eq. (3) along with details of the numerical Laplace transform are provided in Appendix B of the supplementary material.
Numerical algorithm and verification
To calculate the steady-state fluence in real space, a finite inverse Hankel transform (Eq. (2)) must be numerically computed. While calculation of solutions in the time-domain requires Eq. (2) to be evaluated at N complex valued absorption terms during the numerical inversion of the Laplace transform in Eq. (3). The numerical accuracy and efficiency of the procedure depend on the convergence and difficulty of computing the two sums. Since both the computation of the steady-state and time-domain fluence depends on Eq. (2), the accuracy and computational speed depend primarily on how many terms n of the infinite sum are retained in Eq. (2). To allow for computation over an arbitrary number of terms we have expanded the hyperbolic functions given previously23 in terms of exponential functions which also reduces the computational time by simplifying the expressions. Additionally, we have precomputed the roots of and developed a custom procedure for calculation of which reduces the computational time substantially.
As exact, closed-form solutions for the photon fluence in layered media are not available, we validate our solutions in layered media to closed-form homogeneous solutions for semi-infinite media13. In these validations, each layer in our tissue-model was set to have the same optical properties as the homogeneous medium along with large lateral boundaries. This allows us to precisely quantify numerical errors and determine convergence of our solutions in terms of the number of terms retained in the sum in Eq. (2). We first compare Eq. (2) evaluated with 2 and 8 layers of similar optical properties to the semi-infinite solution13 and to Monte Carlo simulations in a semi-infinite medium. Next, we compare the accuracy of Eq. (2) as a function of the number of terms n considered in the summation for different input parameters , , , , z, and a. The accuracy is compared to the computation when using terms in quadruple precision.
Solutions in the time-domain require computing both the infinite sum in Eq. (2) as well as numerically performing the inverse Laplace transform in Eq. (3). Strategies to invert the Laplace transform could allow for significantly faster convergence compared to the Fourier transform35,38, however the obtention of the inverse Laplace transform is not always an easy or even possible task to perform38. Therefore, the accuracy of the numerical approach to invert the Laplace transform must be rigorously tested. We focus on two attributes in performing the numerical integration in Eq. (3) that affect both the convergence and numerical accuracy: (a) the number of Laplace space evaluations N used to evaluate the Laplace integral in Eq. (3) and (b) the contour width determined from where . The effect of both of these parameters on the convergence and numerical accuracy are again examined by comparison to closed-form homogeneous analytical solutions. We show the reconstruction of the time-domain signal for high scattering and high absorbing media at short and long distances and times where the numerical reconstruction has been difficult to perform32,35. We have included in Appendix A extended discussion on how to efficiently compute Eq. (2), which also directly affect the computation of Eq. (3), and the advantages compared to other routines21. Additionally, we give approximations for reflectance simulations () that are accurate for double precision arithmetic (see Supplementary Fig. S3) which can decrease the computational time by 2–3 orders of magnitude.
All the numerical routines and figures presented here were developed using the Julia programming language (v1.7.0)39. Numerical simulations were performed on a MacBook Pro with an Apple M1 chip (MacOS version 11.1) and 16 GB of memory. Simulations in the steady-state utilized a single core while the inverse Laplace transform in the time-domain used multi-threaded parallelism. Here, the Laplace space evaluations were evenly distributed across the 4 cores and 8 threads of the M1 chip. All benchmarks are done in double precision arithmetic using v0.8.0 of LightPropagation.jl.
Validation with Monte Carlo
To validate the derived analytical solutions, the fluence is compared with results obtained from Monte Carlo simulations. The Monte Carlo method simulates the propagation of photons through the scattering medium using appropriate probability functions and random number generation15,16. In the limit of an infinitely large number of photons used in the simulations, the Monte Carlo method is an exact solution of the RTE15. We utilized an independent open-source Monte Carlo code provided by the Virtual Photonics Technology Initiative40 to validate the layered diffusion theory model. The optical properties used were taken from literature using three biologically relevant tissue models with an isotropic emitting source at a depth of and a Henyey-Greenstein phase function. The anisotropic factor was assumed to be g = 0.8 for all layers. The Monte Carlo simulations used photons for each simulation which visually reduced the effect of stochastic noise for all bin widths in the spatial and time domain. For all comparisons the refractive index of the medium is assumed to be where the external medium is assumed to be air . The fluence as a function of t and/or and z was recorded in discrete bin widths of ns, mm, and mm.
Results
Numerical accuracy of the layered diffusion equation
In Fig. 2, the fluence on the top boundary () in a semi-infinite medium with optical coefficients , , , is simulated using Monte Carlo methods in the steady-state and time-domain. We compare the results to solutions of the diffusion equation in a semi-infinite medium13 and to Eqs. (2) and (3) when solved for a 2 and 8 layered medium with the same optical coefficients in each layer. Here, we used a cylinder radius of cm and a total cylinder length L of 10 cm (i.e., the thickness of each layer in the 2 and 8 layered model was 5 and 1.25 cm, respectively) to approximate a semi-infinite medium. As previously shown13, diffusion theory exhibits excellent agreement with relative errors ( compared to Monte Carlo simulations given enough scattering events. Equation (2) also shows excellent agreement to the closed-form semi-infinite solution13 in both the steady-state and time-domain giving similar relative errors to the Monte Carlo results.
In contrast to the semi-infinite solution13, the numerical accuracy of Eq. (2) is affected by the termination of an infinite sum after n terms. For example, given a large amount of terms (), the layered simulations shown in Fig. 2 can approximate the closed-form semi-infinite solution close to the limits of the numerical precision (detailed below). In practice, the sum should be terminated once a desired precision is reached. For example, to achieve similar relative tolerances to the Monte Carlo results in Fig. 2a, the steady-state fluence used for cm, for cm, and for cm whereas in Fig. 2b we use just for both the 2 and 8 layer simulations in the time-domain for cm. In general, to simulate lower fluence values a larger number of roots in Eq. (2) will be required to achieve similar relative errors. Consequently, the number of terms n required in Eq. (2) will be dependent to varying degrees on the input optical properties and cylinder dimensions considered.
In Fig. 3, we investigated the convergence properties of Eq. (2) as a function of the number of terms n used in the summation. We considered an example 2-layer medium with baseline optical properties of , , , cm, cm, and cm. The fluence was calculated as a function of summation terms for varying ranges of 6 input parameters () while keeping all other variables constant. The absolute difference between this calculation which was done in double precision and a calculation done in quadruple precision with is shown in Fig. 3. The convergence of Eq. (2) is highly dependent on the scattering coefficient in the first layer as seen in Fig. 3a. Increasing severely diminishes the convergence of Eq. (2) when (see Supplementary material in Appendix A for extended discussion). On the other hand, for the range of values shown here, , and had a negligible effect on the convergence. There is a close relationship between and z as shown in Fig. 3a,e and their effect on the convergence of Eq. (2). When with , Eq. (2) requires a high number of terms to converge. This is also the primary reason why increasing the scattering coefficient also requires significantly more terms when as . Additionally, increasing a results in slower convergence due to smaller values of during the sum. The routine can be made accurate down to absolute errors of the machine precision used in the calculation. For example, Fig. 3 was calculated using double precision arithmetic with machine precision . The loss of precision in calculating in Eq. (2) is the primary limitation of the routine. For typical found in biological tissue (), is usually sufficient. For example, only 50 terms were used in Fig. 2b resulting in similar relative errors compared to Monte Carlo simulations when using 5000 terms. However, the numerical procedure should check for convergence during the summation of Eq. (2) so that n can be dynamically determined during the routine.
The accuracy of the time-domain solution given in Eq. (3) is affected by both the termination of the sum in Eq. (2) as previously discussed and the numerical inversion of the Laplace integral in Eq. (3). We focus on two main attributes for the convergence of the inverse Laplace transform: (a) the hyperbola contour size (proportional to ) and (b) the number of Laplace space evaluations N used to evaluate the Laplace integral in Eq. (3) by comparing the time-resolved fluence simulated with Eq. (3) to the semi-infinite solution13. The fluence is simulated at cm on the top boundary () using a 4-layer model with layer thicknesses of cm, and with a radius of 15 cm to approximate a semi-infinite geometry. Typically, the time-domain signal is required at many values in some range where it becomes significantly more efficient to use a single contour for all time points35.
In Fig. 4a, we show the absolute (top) and relative (bottom) errors between Eq. (3) and the semi-infinite solution13 at a single instant of time ns as a function of N, for four different values of . Variable values of are achieved by using different values of 1.0, 0.1, 0.01, and 0.001 ns such that ns is fixed and ns is within the bounds of . The absolute errors were similar for any t value within while the relative error was dependent on the value of t (i.e. larger relative errors are observed at long times when the fluence is lowest). Less than 20 Laplace evaluations were needed to give absolute errors even for large values of . We can also see that the sum exponentially converges allowing it to be accurately computed with the midpoint rule41. The main limitation is that the function must be evaluated at very small and large values along the contour which leads to floating point errors limiting the procedure to absolute errors approaching the machine precision. Additionally, the evaluation points along the contour depend on N which can not be reused for different values of N. Therefore, for the best computational performance N must be determined before the computation.
In Fig. 4b, we considered a single contour to reconstruct 600 time points in and we show these for four different values of N. A larger N improved the overall accuracy and was relatively independent of the time point for a given N. For larger contours a higher number of N are needed to reconstruct the time-domain signal over the whole time window for a given absolute error. For example, Fig. 4b shows the same but reconstructs the time-domain signal for different values of N. However, smaller values of N are not able to reconstruct accurately over the entire time window due to the lower fluence values at later times. A given N reconstructs the time-domain signal over the entire window at a relatively fixed absolute error. Therefore, larger relative errors will be observed at later times when the fluence is lowest.
We note that calculations in Fig. 4b are only shown up to the point where the time-domain signal is not accurately reconstructed. Therefore, it is recommended to use a as late as possible and choose N based on the dynamic range of time-domain signal required. For example, 12 Laplace evaluations were typically required to reconstruct the time-domain signal with a dynamic range of 3 orders of magnitude where 24 evaluations can provide roughly 6 orders of magnitude which represent typical dynamic ranges of time-domain systems8,42. Increasing the number of evaluations does not decrease absolute errors once the errors reach the machine precision. Coincidentally, we have found that the numerical inversion of the Laplace transform is also limited by absolute errors approaching the machine precision, similar to the numerical computation in the spatial domain.
The previous examples have focused on modest values of , and layer thicknesses. In Fig. 5, we reconstruct the time-domain signal for high scattering media and large layer thicknesses over a wide range of times which has previously been previously difficult due to numerical overflow29–31. In Fig. 5a, the time-domain signal on the top boundary () for a high scattering medium and at = 0.2 and = 3.5 cm is shown. We considered a 4-layered medium with the same optical properties in each layer with layer thicknesses cm and a cylinder radius of 15 cm for comparison to a semi-infinite model13. We used roots in Eq. (2) with Laplace evaluations at = 3.5 cm and evaluations at = 0.2 cm. Although the fluence at = 0.2 cm is significantly larger, we considered resulting in a whereas at = 3.5 we considered giving . This again highlights that the number of Laplace space evaluations is highly dependent on . Even considering a very large layer thickness cm and large reduced scattering coefficient , the time-resolved fluence can be easily simulated in double precision arithmetic, very close to the source, and at both early and late times.
In Fig. 5b we show calculation of the time-domain fluence at the surface () for very low fluence values from a high absorption medium ( and cm) at two detector locations of = 3.0 cm and 6.0 cm and for . These calculations were performed in octuple precision using Laplace evaluations and only roots in Eq. (2) which reconstructed the time-domain signal over 50 orders of magnitude in dynamic range with high numerical accuracy. The absolute error is relatively constant for which leads to a higher relative error at lower fluence values. An increase in amount of Laplace evaluations is needed for very low fluence values and can also be observed by extrapolating the asymptote of convergence in Fig. 4 to very low absolute errors. Lastly, the roots of must be calculated in higher precision to achieve the shown absolute errors.
Comparison to Monte Carlo simulations
Next, we compared the solutions obtained from Eqs. (2) and (3) to Monte Carlo simulations for both the steady-state and time-domain. We consider three different tissue geometries that are of high clinical interest and have been extensively used to model light propagation in different organ systems previously: a 2-layer model24, a 3-layer model representing a skin/fat/muscle layer32, and a 5-layer brain model43 representing a scalp, skull, cerebrospinal fluid (CSF), and a gray and white matter layer.
The optical properties considered in the 2-layer model are , , , and with layer thicknesses of mm and mm. We report the optical properties of the 3-layer muscle and 5-layer brain model in Table 1. For all tissue models, we consider the index of refraction for each layer to be with the external index of refraction being air (). The anisotropy was consistent for all layers in the Monte Carlo simulations. In all cases we compare the fluence on the top boundary () as a function of for the steady-state calculations and as a function of t in the time-domain for and 3.05 cm.
Table 1.
Skin, fat, muscle model32 | Brain model43 | ||||||
---|---|---|---|---|---|---|---|
l (cm) | l (cm) | ||||||
Skin | 0.15 | 15 | 0.12 | Scalp | 0.18 | 19 | 0.5 |
Fat | 0.02 | 12 | 0.38 | Skull | 0.16 | 16 | 0.8 |
Muscle | 0.2 | 5 | 10.0 | CSF | 0.04 | 0.25 | 0.2 |
– | – | – | – | Gray | 0.36 | 22 | 0.5 |
– | – | – | – | White | 0.14 | 9.1 | 4 |
The diffusion model utilized the same parameters except a was used in the CSF layer44.
In Fig. 6, we compare the steady-state and time-domain fluence when simulated using the Monte Carlo method and diffusion theory. The left column shows the steady-state fluence for cm simulated using Eq. (2). Excellent agreement (relative errors ) is observed for all three tissue models, however the agreement is not uniform. The 2-layer model showed the best agreement for all values of where the results asymptotically agreed with the Monte Carlo method. The 3-layer muscle model showed good agreement for cm, but did not asymptotically agree. These results are consistent with recent reports45 that showed a breakdown in diffusion theory when the mean free path approaches the thickness of the top layer. Here, a top layer thickness of 1.2 mm was used. Although the significance of these errors were not studied on the reconstruction of optical properties, the relative errors between Monte Carlo solutions are less than 0.1 for cm. Diffuse optical measurements are not usually collected at such large distances due to low signal to noise. A similar effect is observed in the brain model Fig. 6e where agreement (relative error ) is observed for cm, however longer distances show higher errors. These errors can be mostly attributed to the limitations of diffusion theory to accurately model the low scattering CSF layer44. Our analytical solutions utilized to most accurately model the low scattering CSF layer with diffusion theory as previously suggested44, though the choice of significantly affects the resulting fluence calculated with diffusion theory for cm. If is less than 4 , a severe overestimation of the fluence is seen. Practically, for cm it may become unrealistic to consider the CSF and other brain layers as parallel planes. We note that all models had similar disagreements for cm which is a known limitation of diffusion theory13.
In the right column of Fig. 6, we show the time-domain fluence for cm simulated using Eq. (3) and compare to Monte Carlo results. The 2-layer model is well approximated by diffusion theory in the time-domain for each value of given enough scattering events illustrated by the uniform agreement across a wide range of time values. As in the spatial domain, the time domain results for the 3-layered model do not asymptotically converge to Monte Carlo simulations due to the small top layer thickness. The agreement is not uniform for each value of as shorter distances are better approximated until much later arrival times. This is in contrast to the 5-layer model where the errors are relatively flat at all times and distances. This could be attributed to only presenting results in the time-domain for cm, whereas the effect of the low scattering CSF layer is more significant for cm. We note that the precise choice of in the CSF layer for the distances and times shown do not significantly affect the time-domain simulations compared to the steady-state results. Additionally, decreasing the discretization of and z and simulating for more photons in the Monte Carlo method will reduce the noise, however, smaller discretization will not improve agreement between diffusion and Monte Carlo where they do not asymptotically agree.
Computational time
In Table 2, we show the amount of time in microseconds to compute the steady-state fluence in the top layer, , for a given number of terms n considered in the sum in Eq. (2) for 2, 4, 8 and 16 layers. Different values of optical properties do not significantly affect the computation time (when n is fixed), which is instead dependent on the number of roots n used in the sum. Though, increasing n does not linearly increase the computational time as shown in Table 2 because it is faster to compute at large arguments with asymptotic expansions. This affects the total run time because the calculation of accounts for nearly 40 of the run time where the computation of takes most of the remaining time. For realistic applications where less than 1000 roots are needed, the fluence can be calculated in less than 100 μs for up to 8 layers.
Table 2.
Layers | n = 100 | n = 500 | n = 1000 | n = 5000 |
---|---|---|---|---|
2 | 8 | 33 | 64 | 268 |
4 | 9 | 38 | 75 | 341 |
8 | 13 | 60 | 118 | 469 |
16 | 19 | 93 | 184 | 850 |
The time-domain routine must compute the steady-state routine for N () complex absorption values. This procedure lends itself well to parallelism as each computation is independent and can be used at each time point needed. Therefore, performance is limited by the runtime listed in Table 2, however using a complex absorption term increases the runtime by 2.5×. In Table 3, we show the runtime in microseconds for the time-domain fluence as a function of the Laplace space evaluations N for 2 and 4 layered media considering roots in Eq. (2) and 1024 time points. We note that the time values do not have to be linearly spaced as when using the Fast Fourier Transform.
Table 3.
Layers | N = 8 | N = 16 | N = 32 | N = 64 |
---|---|---|---|---|
2 | 262 | 490 | 930 | 1860 |
4 | 298 | 558 | 1090 | 2130 |
If a dynamic range of 3 orders of magnitude is needed (), the fluence can be simulated in less than 300 μs. The performance in the time-domain is highly dependent on the CPU used and its multi-core performance. When using an Intel CPU 8700k with 6 cores and 12 threads the runtimes can be decreased by 30% compared to using a MacBook Pro M1 as shown in Tables 2 and 3. The number of Laplace evaluations used should be in multiples of the available number of threads. We note that the load times for multi-threaded applications represent a significant portion of the total runtime. For a low number of Laplace evaluations (< 16) these computational times can be reached within 2× using a single core. The advantage of these procedures is that rapid simulation can be performed on a personal laptop while allowing for time-domain runtimes to be significantly reduced with higher end CPUs.
Discussion and conclusion
Limitations of homogeneous tissue-models to describe light transport in layered biological media have been discussed previously4,46. Although analytical models that incorporate heterogeneous optical properties are becoming more frequent30,47,48, their use, particularly in inverse calculations, is limited by their numerical accuracy and efficiency29. Therefore, homogeneous models are typically used given their simplicity and efficiency in solving inverse problems that require 100–1000 evaluations of the forward model to reach convergence. Neural networks can also be used to quickly ( 50 ms) estimate tissue optical properties in inverse problems49. However, they require long training times and are roughly 1000× slower than the presented analytical model for forward calculations49,50. Several solutions for photon diffusion in layered media have been reported, but present technical difficulties for numerical computation. We have investigated a previously developed model23,37 that has received wide interest30,47,48,51. However, the model relies on numerical inverse transforms for obtaining the photon fluence for both steady-state and time-domain simulations which limits the numerical accuracy and speed. For example, the computation of the steady-state fluence requires the inversion of a Bessel-type 1-D inverse transform (Eq. 2) over the th root of the zeroth order Bessel function . The discrete version has several advantages compared to using Gaussian integration21,24 as the roots can be precomputed to improve the overall speed of the routine and can be implemented with strict convergence criteria for accurate computation over a wide range of input arguments using a variable number of roots. This is important because the convergence of Eq. (2) is highly dependent on the model inputs (Fig. 3), where different optical properties and tissue geometries require a different number of roots to be used. However, these expressions require numerical integration over hyperbolic functions that can numerically overflow for large input arguments or at large roots of .
In this work, we provide numerically stable expressions for the Green’s functions in terms of exponentially decaying functions, which facilitates accurate computation for large input arguments (e.g., scattering, layer thickness, spatial frequency) over any root of without approximations or loss of generality that are usually required to numerically compute Eq. (2)30,31. As shown in Fig. 3, the accuracy and speed of computed solutions is determined by the number n of roots used in the sum in Eq. (2) which is most dependent on , a, and z. In practice, the values used for the cylindrical radius of the tissue-model a (Fig. 3f) should be kept as small as possible to increase convergence but should be large enough to accurately represent lateral boundary conditions. Although the total number of n largely dictates the speed and accuracy of the routine, the algorithm is limited to simulating Eq. (2) with absolute errors up to the machine precision in the calculation. This is largely due to the finite precision used in the calculation of in Eq. (2) which is limited to absolute tolerances approaching the machine precision. For higher precision calculations, it is important to calculate the roots of in the desired precision to simulate fluence values down to the machine precision. For experimental measurements with background noise, fluence values below the epsilon value of double precision () are rarely needed. Additionally, computing accounts for the majority of the routine’s runtime especially when the fluence is required at multiple spatial locations, as is the case in many tomography52 or functional imaging53 applications. New numerical routines for the computation of were developed that decrease computational time by at least 3×54 compared to using standard routines55. An advantage of the routine presented is that computing the fluence at 10 arbitrarily specified spatial locations takes only 3× longer than the times reported in Table 2. Although it can be difficult to directly compare computational times of different routines, as they depend highly on the computational resources and effort put into them, we were able to simulate the steady-state fluence 500–1000× faster than previously reported21,51. We note that these times are achieved on a personal laptop using a single core.
Computation of the time-domain signal requires an additional inverse time transform which is usually performed with the Fourier Transform30. Here, we have used the inverse Laplace transform35,36 for faster and more accurate reconstructions of the time-domain signal. We have found that 12–24 terms in the Laplace integral are needed in Eq. (3) to reconstruct the time-domain signal with dynamic ranges of 3–6 orders of magnitude, which is the range of current experimental systems8,42. Due to the decreased number of evaluations needed in the inverse time transform, the computational times for time-domain simulations are 1000–10,000× faster than what is usually reported depending on the number of layers considered and accuracy required23,26,33. Most of the performance gain can be attributed to utilizing the faster converging Laplace transform instead of the Fourier transform35 while other improvements come from other numerical optimizations for the steady-state calculation and threaded parallelism as further discussed in Appendix A in the Supplementary material. The Laplace transform can also evaluate the time-domain fluence up to absolute errors approaching the machine precision as shown in Fig. 4. The number of terms needed in the Laplace transform for adequate convergence will depend highly on the contour size which is recommended to be kept as small as possible for faster reconstructions.
A primary limitation of the layered solutions presented here is that a large amount (500–5000×) of terms are required in the computation of Eq. (2) when which is required for reflectance calculations. As seen in Fig. 3, increasing the top layer scattering coefficient will significantly increase the number of terms required in Eq. (2), while the convergence is mostly independent of deeper layer optical properties. This can be explained by the slow convergence of the particular solution of the Green’s function when . When z is farther away from the source depth as seen in Fig. 3e, only a few terms are needed. However, if we approximate that , it becomes possible to sum the particular solution of the Green’s function exactly which improves convergence significantly. We present detailed derivations of this approximation in Appendix A in the Supplementary material and show that such an approximation when and can simulate the fluence with relative errors down to (Supplementary Fig. S3), which is as accurate as the exact forms in double precision arithmetic due to floating point errors. Therefore, it is highly recommended to use such an approximation in double precision arithmetic which can decrease computational times by 2–3 orders of magnitude depending on the input , allowing for computation of the steady-state fluence in less than a microsecond (Supplementary Fig. S4). This approximate form also allows for very accurate simulation for large scattering coefficients where it is difficult for the exact expressions to converge due to the slow exponential decay of the sum.
Finally, in addition to testing the numerical accuracy and efficiency, we have tested the physical approximation of diffusion theory compared to the Monte Carlo method by using three previously reported layered tissue models that approximate several different organ systems24,32,43. We note that solutions to the RTE in layered media have been presented which are more accurate than the diffusion approximation but, like Monte Carlo methods, come at increased computational cost45. Additionally, the situations presented in Fig. 6 represent the simplest forms of heterogeneous media consisting of layered slabs which may be a rather crude approximation of complex biological media. Though, the use of such a simple approximation has been shown to provide similar accuracy to more realistic tissue geometries in a brain model using atlas based meshes3. The primary disadvantages of diffusion theory are the inability to correctly predict photon fluence for short time scales and source-detector separations and the requirement that 10,11. A recent report also indicated that the diffusion approximation could increase inaccuracies far away from the source in layered models where layer thicknesses are small compared to the mean scattering length45. We found that for a top layer thickness of 1.2 mm, these predictions were in agreement with the results reported in Fig. 6, but we also find that such errors were only significant at distances of cm for steady-state calculations. These errors were not apparent in the time-domain for cm when ns (Fig. 6). We also find that our solutions from diffusion theory agree well with Monte Carlo simulations for a 5-layer model of the brain even when considering a thin CSF layer of low scattering (Fig. 6).
In conclusion, we have developed and verified an open-source, easy-to-use numerical algorithm to accurately and efficiently compute solutions of the diffusion equation in layered media. The absolute errors of the routine can be made arbitrarily accurate and can simulate both the steady-state and time-domain fluence 3 to 4 orders of magnitude faster than previously reported. Therefore, the routine could be used in inverse procedures to recover optical properties of measured data in real-time (1–10 Hz). It can also be employed for rapid generation of the intensity profile in layered media at multiple spatial locations and varying optical properties, as required in tomography and functional imaging applications. These solutions are also easily amendable to solve the correlation diffusion equation in layered media. An additional advantage of the routine is that the computational time marginally increases with the addition of a new layer, as a 4-layered medium can be computed within 10% of the time to compute 2-layers. This could allow for more accurate simulations in highly layered media such as the brain at little cost to total run times. Additionally, we showed good agreement between diffusion theory and Monte Carlo simulations in three separate tissue geometries of clinical interest.
Supplementary Information
Acknowledgements
The authors would like to thank Dr. Robert H. Wilson for helpful comments on earlier drafts of this manuscript. The authors are greatly appreciative of Dr. André Liemert for helpful discussions on the theoretical solutions and to Dr. Carole Hayakawa for help in setting up the Monte Carlo simulations used in this work.
Author contributions
M.H. developed the numerical code and theoretical solutions, M.H. and S.Z. conducted Monte Carlo analysis, M.H. and S.Z. analysed all data, M.H., K.V. and M-A.M. designed the studies, all authors reviewed and contributed to writing the manuscript. K.V. and M-A.M. supervised this work.
Code availability
All software used in this manuscript are freely available online with documentation at https://github.com/heltonmc/LightPropagation.jl. The code for the numerical inversion of the Laplace Transform is also available at https://github.com/heltonmc/Laplace.jl along with several other algorithms not shown in this manuscript to invert the Laplace transform. The code for calculating Bessel’s functions is available at https://github.com/JuliaMath/Bessels.jl.
Competing interests
The authors declare no competing interests.
Footnotes
Publisher's note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
These authors jointly supervised this work: Karthik Vishwanath and Mary-Ann Mycek.
Supplementary Information
The online version contains supplementary material available at 10.1038/s41598-022-22649-4.
References
- 1.Jacques SL. Optical properties of biological tissues: A review. Phys. Med. Biol. 2013;58:R37. doi: 10.1088/0031-9155/58/11/R37. [DOI] [PubMed] [Google Scholar]
- 2.Vishwanath K, Pogue B, Mycek M-A. Quantitative fluorescence lifetime spectroscopy in turbid media: Comparison of theoretical, experimental and computational methods. Phys. Med. Biol. 2002;47:3387. doi: 10.1088/0031-9155/47/18/308. [DOI] [PubMed] [Google Scholar]
- 3.Selb JJ, Ogden TM, Dubb J, Fang Q, Boas DA. Comparison of a layered slab and an atlas head model for Monte Carlo fitting of time-domain near-infrared spectroscopy data of the adult head. J. Biomed. Opt. 2014;19:016010. doi: 10.1117/1.JBO.19.1.016010. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 4.Farrell TJ, Patterson MS, Essenpreis M. Influence of layered tissue architecture on estimates of tissue optical properties obtained from spatially resolved diffuse reflectometry. Appl. Opt. 1998;37:1958–1972. doi: 10.1364/ao.37.001958. [DOI] [PubMed] [Google Scholar]
- 5.Martelli F. An ABC of near infrared photon migration in tissues: The diffusive regime of propagation. J. Near Infrared Spectrosc. 2012;20:29–42. [Google Scholar]
- 6.Helton M, Mycek M-A, Vishwanath K. Direct estimation of the reduced scattering coefficient from experimentally measured time-resolved reflectance via Monte Carlo based lookup tables. Biomed. Opt. Express. 2020;11:4366–4378. doi: 10.1364/BOE.398256. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 7.Wang LV, Wu H-I. Biomedical Optics: Principles and Imaging. Wiley; 2012. [Google Scholar]
- 8.Helton M, Mycek M-A, Vishwanath K. Reconstruction of optical coefficients in turbid media using time-resolved reflectance and calibration-free instrument response functions. Biomed. Opt. Express. 2022;13:1595–1608. doi: 10.1364/BOE.447685. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 9.Mishchenko MI, Travis LD, Lacis AA. Multiple Scattering of Light by Particles: Radiative Transfer and Coherent Backscattering. Cambridge University Press; 2006. [Google Scholar]
- 10.Arridge SR, Cope M, Delpy D. The theoretical basis for the determination of optical pathlengths in tissue: Temporal and frequency analysis. Phys. Med. Biol. 1992;37:1531. doi: 10.1088/0031-9155/37/7/005. [DOI] [PubMed] [Google Scholar]
- 11.Farrell TJ, Patterson MS, Wilson B. A diffusion theory model of spatially resolved, steady-state diffuse reflectance for the noninvasive determination of tissue optical properties in vivo. Med. Phys. 1992;19:879–888. doi: 10.1118/1.596777. [DOI] [PubMed] [Google Scholar]
- 12.Contini D, Martelli F, Zaccanti G. Photon migration through a turbid slab described by a model based on diffusion approximation. I. theory. Appl. Opt. 1997;36:4587–4599. doi: 10.1364/ao.36.004587. [DOI] [PubMed] [Google Scholar]
- 13.Kienle A, Patterson MS. Improved solutions of the steady-state and the time-resolved diffusion equations for reflectance from a semi-infinite turbid medium. JOSA A. 1997;14:246–254. doi: 10.1364/josaa.14.000246. [DOI] [PubMed] [Google Scholar]
- 14.Martelli F, Tommasi F, Sassaroli A, Fini L, Cavalieri S. Verification method of Monte Carlo codes for transport processes with arbitrary accuracy. Sci. Rep. 2021;11:1–12. doi: 10.1038/s41598-021-98429-3. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 15.Zhu C, Liu Q. Review of Monte Carlo modeling of light transport in tissues. J. Biomed. Opt. 2013;18:050902. doi: 10.1117/1.JBO.18.5.050902. [DOI] [PubMed] [Google Scholar]
- 16.Fang Q, Boas DA. Monte Carlo simulation of photon migration in 3D turbid media accelerated by graphics processing units. Opt. Express. 2009;17:20178–20190. doi: 10.1364/OE.17.020178. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 17.Fang Q. Mesh-based Monte Carlo method using fast ray-tracing in plücker coordinates. Biomed. Opt. Express. 2010;1:165–175. doi: 10.1364/BOE.1.000165. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 18.Young-Schultz T, Brown S, Lilge L, Betz V. FullMonteCUDA: A fast, flexible, and accurate GPU-accelerated Monte Carlo simulator for light propagation in turbid media. Biomed. Opt. Express. 2019;10:4711–4726. doi: 10.1364/BOE.10.004711. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 19.Wojtkiewicz S, Liebert A. Parallel, multi-purpose Monte Carlo code for simulation of light propagation in segmented tissues. Biocybern. Biomed. Eng. 2021;41:1303–1321. [Google Scholar]
- 20.Cooper RJ, et al. Validating atlas-guided dot: A comparison of diffuse optical tomography informed by atlas and subject-specific anatomies. NeuroImage. 2012;62:1999–2006. doi: 10.1016/j.neuroimage.2012.05.031. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 21.Liemert A, Kienle A. Light diffusion in n-layered turbid media: Steady-state domain. J. Biomed. Opt. 2010;15:025003. doi: 10.1117/1.3368685. [DOI] [PubMed] [Google Scholar]
- 22.Liemert A, Kienle A. Light diffusion in n-layered turbid media: Frequency and time domains. J. Biomed. Opt. 2010;15:025002. doi: 10.1117/1.3368682. [DOI] [PubMed] [Google Scholar]
- 23.Liemert A, Kienle A. Light diffusion in a turbid cylinder. II. Layered case. Opt. Express. 2010;18:9266–9279. doi: 10.1364/OE.18.009266. [DOI] [PubMed] [Google Scholar]
- 24.Kienle A, et al. Noninvasive determination of the optical properties of two-layered turbid media. Appl. Opt. 1998;37:779–791. doi: 10.1364/ao.37.000779. [DOI] [PubMed] [Google Scholar]
- 25.Tualle J-M, Prat J, Tinet E, Avrillier S. Real-space green’s function calculation for the solution of the diffusion equation in stratified turbid media. JOSA A. 2000;17:2046–2055. doi: 10.1364/josaa.17.002046. [DOI] [PubMed] [Google Scholar]
- 26.Martelli F, Sassaroli A, Del Bianco S, Yamada Y, Zaccanti G. Solution of the time-dependent diffusion equation for layered diffusive media by the eigenfunction method. Phys. Rev. E. 2003;67:056623. doi: 10.1103/PhysRevE.67.056623. [DOI] [PubMed] [Google Scholar]
- 27.Martelli F, Sassaroli A, Del Bianco S, Zaccanti G. Solution of the time-dependent diffusion equation for a three-layer medium: Application to study photon migration through a simplified adult head model. Phys. Med. Biol. 2007;52:2827. doi: 10.1088/0031-9155/52/10/013. [DOI] [PubMed] [Google Scholar]
- 28.Barnett AH. A fast numerical method for time-resolved photon diffusion in general stratified turbid media. J. Comput. Phys. 2004;201:771–797. [Google Scholar]
- 29.Wu MM, et al. Improved accuracy of cerebral blood flow quantification in the presence of systemic physiology cross-talk using multi-layer Monte Carlo modeling. Neurophotonics. 2021;8:015001. doi: 10.1117/1.NPh.8.1.015001. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 30.García HA, Iriarte DI, Pomarico JA, Grosenick D, Macdonald R. Retrieval of the optical properties of a semiinfinite compartment in a layered scattering medium by single-distance, time-resolved diffuse reflectance measurements. J. Quant. Spectrosc. Radiat. Transf. 2017;189:66–74. [Google Scholar]
- 31.Kienle A, Glanzmann T, Wagnieres G, van den Bergh H. Investigation of two-layered turbid media with time-resolved reflectance. Appl. Opt. 1998;37:6852–6862. doi: 10.1364/ao.37.006852. [DOI] [PubMed] [Google Scholar]
- 32.Kienle A, Glanzmann T. In vivo determination of the optical properties of muscle with time-resolved reflectance using a layered model. Phys. Med. Biol. 1999;44:2689. doi: 10.1088/0031-9155/44/11/301. [DOI] [PubMed] [Google Scholar]
- 33.Wang X, Wang S. Light transport model in an-layered mismatched tissue. Waves Random Complex Media. 2006;16:121–135. [Google Scholar]
- 34.Geiger S, Reitzle D, Liemert A, Kienle A. Determination of the optical properties of three-layered turbid media in the time domain using the p 3 approximation. OSA Continuum. 2019;2:1889–1899. [Google Scholar]
- 35.Liemert A, Kienle A. Application of the Laplace transform in time-domain optical spectroscopy and imaging. J. Biomed. Opt. 2015;20:110502. doi: 10.1117/1.JBO.20.11.110502. [DOI] [PubMed] [Google Scholar]
- 36.Weideman J, Trefethen L. Parabolic and hyperbolic contours for computing the Bromwich integral. Math. Comput. 2007;76:1341–1356. [Google Scholar]
- 37.Liemert A, Kienle A. Light diffusion in a turbid cylinder. I. Homogeneous case. Opt. Express. 2010;18:9456–9473. doi: 10.1364/OE.18.009456. [DOI] [PubMed] [Google Scholar]
- 38.Kuhlman KL. Review of inverse Laplace transform algorithms for Laplace-space numerical approaches. Numer. Algorithms. 2013;63:339–355. [Google Scholar]
- 39.Bezanson J, Edelman A, Karpinski S, Shah VB. Julia: A fresh approach to numerical computing. SIAM Rev. 2017;59:65–98. [Google Scholar]
- 40.Hayakawa CK, et al. MCCL: An open-source software application for Monte Carlo simulations of radiative transport. J. Biomed. Opt. 2022;27:083005. doi: 10.1117/1.JBO.27.8.083005. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 41.Trefethen LN, Weideman J. The exponentially convergent trapezoidal rule. SIAM Rev. 2014;56:385–458. [Google Scholar]
- 42.Giovannella M, et al. Babylux device: A diffuse optical system integrating diffuse correlation spectroscopy and time-resolved near-infrared spectroscopy for the neuromonitoring of the premature newborn brain. Neurophotonics. 2019;6:025007. doi: 10.1117/1.NPh.6.2.025007. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 43.Fukui Y, Ajichi Y, Okada E. Monte Carlo prediction of near-infrared light propagation in realistic adult and neonatal head models. Appl. Opt. 2003;42:2881–2887. doi: 10.1364/ao.42.002881. [DOI] [PubMed] [Google Scholar]
- 44.Custo A, Wells Iii WM, Barnett AH, Hillman EM, Boas DA. Effective scattering coefficient of the cerebral spinal fluid in adult head models for diffuse optical imaging. Appl. Opt. 2006;45:4747–4755. doi: 10.1364/ao.45.004747. [DOI] [PubMed] [Google Scholar]
- 45.Liemert A, Reitzle D, Kienle A. Analytical solutions of the radiative transport equation for turbid and fluorescent layered media. Sci. Rep. 2017;7:1–9. doi: 10.1038/s41598-017-02979-4. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 46.Franceschini MA, Fantini S, Paunescu LA, Maier JS, Gratton E. Influence of a superficial layer in the quantitative spectroscopic study of strongly scattering media. Appl. Opt. 1998;37:7447–7458. doi: 10.1364/ao.37.007447. [DOI] [PubMed] [Google Scholar]
- 47.Hallacoglu B, Sassaroli A, Fantini S. Optical characterization of two-layered turbid media for non-invasive, absolute oximetry in cerebral and extracerebral tissue. PLoS ONE. 2013;8:e64095. doi: 10.1371/journal.pone.0064095. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 48.Blaney G, Curtsmith P, Sassaroli A, Fernandez C, Fantini S. Broadband absorption spectroscopy of heterogeneous biological tissue. Appl. Opt. 2021;60:7552–7562. doi: 10.1364/AO.431013. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 49.Hokr BH, Bixler JN. Machine learning estimation of tissue optical properties. Sci. Rep. 2021;11:1–7. doi: 10.1038/s41598-021-85994-w. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 50.Geldof F, Dashtbozorg B, Hendriks BH, Sterenborg HJ, Ruers TJ. Layer thickness prediction and tissue classification in two-layered tissue structures using diffuse reflectance spectroscopy. Sci. Rep. 2022;12:1–12. doi: 10.1038/s41598-022-05751-5. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 51.García HA, et al. Theoretical investigation of photon partial pathlengths in multilayered turbid media. Biomed. Opt. Express. 2022;13:2516–2529. doi: 10.1364/BOE.449514. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 52.Eggebrecht AT, et al. Mapping distributed brain function and networks with diffuse optical tomography. Nat. Photonics. 2014;8:448–454. doi: 10.1038/nphoton.2014.107. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 53.Torricelli A, et al. Time domain functional NIRS imaging for human brain mapping. Neuroimage. 2014;85:28–50. doi: 10.1016/j.neuroimage.2013.05.106. [DOI] [PubMed] [Google Scholar]
- 54.Harrison, J. Fast and accurate bessel function computation. In 2009 19th IEEE Symposium on Computer Arithmetic, 104–113 (IEEE, 2009).
- 55.Amos D. Algorithm 644: A portable package for Bessel functions of a complex argument and nonnegative order. ACM Trans. Math. Softw. 1986;12:265–273. [Google Scholar]
Associated Data
This section collects any data citations, data availability statements, or supplementary materials included in this article.
Supplementary Materials
Data Availability Statement
All software used in this manuscript are freely available online with documentation at https://github.com/heltonmc/LightPropagation.jl. The code for the numerical inversion of the Laplace Transform is also available at https://github.com/heltonmc/Laplace.jl along with several other algorithms not shown in this manuscript to invert the Laplace transform. The code for calculating Bessel’s functions is available at https://github.com/JuliaMath/Bessels.jl.