Biomedical Optics II 生物医学光学II Monte Carlo Modeling of Photon Transport 2011/09/28
Radiative Transfer in Living Tissue How to solve the problem? Maxwell’s equations? Modeling based on scattering and absorption Monte Carlo simulation Radiative transfer equation College of Engineering, Peking University 生物医学光学II
Monte Carlo College of Engineering, Peking University 生物医学光学II
College of Engineering, Peking University 生物医学光学II
College of Engineering, Peking University 生物医学光学II
Monte Carlo Simulations The simulations treat photons as neutral particles rather than as a wave phenomenon. It is assumed that the photons are multiply scattered by tissues. Sometimes, phase and polarization are assumed to be randomized and can be ignored. College of Engineering, Peking University 生物医学光学II
Introduction Photon transport in biological tissue can be numerically simulated by the Monte Carlo method. The trajectory of a photon is modeled as a persistent random walk, with the direction of each step depending on that of the previous step. By contrast, the directions of all of the steps in a simple random walk are independent. By tracking a sufficient number of photons, we can estimate physical quantities such as diffuse reflectance. College of Engineering, Peking University 生物医学光学II
Monte Carlo The medium is random ⇒ Use “dice” to build it A system with known probability distributions (scattering and absorption) College of Engineering, Peking University 生物医学光学II
Definition of Monte Carlo Method From Lux and Koblinger: In all applications of the Monte Carlo method, a stochastic model is constructed in which the expected value of a certain random variable (or of a combination of several variables) is equivalent to the value of a physical quantity to be determined. This expected value is then estimated by the average of multiple independent samples representing the random variable introduced above. For the construction of the series of independent samples, random numbers following the distribution of the variable to be estimated are used. College of Engineering, Peking University 生物医学光学II
The photon propagation is random and determined by tissue optical properties: Distance to next scattering event? Apply "dice" with properties set by the mean free-path-length (determined by the scattering and absorption coefficients) to set the path length before a scattering or an absorption event occur. Direction after scattering? Apply "dice" with phase function + anisotropy of scattering to set the scattering angles. College of Engineering, Peking University 生物医学光学II
Main advantage No limitation concerning boundary conditions or spatial localisation of inhomogeneities in the tissue >> Flexiblility Main disadvantage Problem of getting good statistics, particularly if the point of interest is located far away from the point of entry of the light and the scattering and absorption coefficients are high >> long CPU time College of Engineering, Peking University 生物医学光学II
Ensemble Averaging It is important to realize that the Monte Carlo method estimates ensemble-averaged quantities. An ensemble of biological tissues is modeled for the average characteristics of photon transport; the ensemble consists of all instances of the tissues that are microscopically different but macroscopically identical. Rules are defined for photon propagation from the probability distributions of, for example, the angles of scattering and the step sizes. The statistical nature requires tracking a large number of photons, which is computationally time-consuming. Multiple physical quantities can be simultaneously estimated, however. College of Engineering, Peking University 生物医学光学II
Simplifications In this chapter, photons are treated as waves at each scattering site but as classical particles elsewhere. Coherence, polarization, and nonlinearity are neglected. Structural anisotropy--not to be confused with scattering angular anisotropy--in tissue components, such as muscle fibers or collagens, is neglected as well. College of Engineering, Peking University 生物医学光学II
Three Major Sampling Procedures Determine the spatial interval between two successive interaction events Determine the scattering angle Determine the survival of the photon College of Engineering, Peking University 生物医学光学II
The variables that govern Monte Carlo The mean free path for an absorption or scattering event Step size (function of µa and µs) The scattering angle Deflection angle, θ (function of anisotropy, g) Azimuthal angle, ψ Random number generators will be used for the selection of step size, deflection angle and azimuthal angle for sampling from known probability density functions College of Engineering, Peking University 生物医学光学II
Consider an experiment in which a laser beam strikes a target such as a cylindrical cuvette containing a dilute solution of scattering particles. The scattering pattern p() is measured by a detector that is moved in a circle around the target while always facing the target. Hence the detector collects light scattered at various deflection angles in a horizontal plane parallel to the table top on which the apparatus sits. The proper definition of anisotropy is the expectation value for cos(): It is common to express the definition of anisotropy in an equivalent way: College of Engineering, Peking University 生物医学光学II
Basis for the Monte Carlo method • The Monte Carlo method as its name implies (“throwing the dice”) relies on the random sampling of a probability density function based on a computer generated random number • Need to understand definitions for probability density functions and probability distributions College of Engineering, Peking University 生物医学光学II
Scattering and Absorption Probability I(d) Beer-Lambert law The probability of the photon passing through the medium without scattering or absorption is: Within any infinitesimal interval ds, the probability of being scattered or absorbed is: College of Engineering, Peking University 生物医学光学II
Henyey-Greenstein Phase Function Henyey and Greenstein (1941) devised an expression which mimics the angular dependence of light scattering by small particles, which they used to describe scattering of light by interstellar dust clouds. The Henyey-Greenstein scattering function has proven to be useful in approximating the angular scattering dependence of single scattering events in biological tissues. Which is approximately used by Henyey-Greenstein function College of Engineering, Peking University 生物医学光学II
Homework 1: reproduce this plot with Matlab. College of Engineering, Peking University 生物医学光学II
Definition of Problem The problem to be solved begins with an infinitely narrow photon beam, also referred to as a pencil beam, that is perpendicularly incident on a multi-layered scattering medium (Figure 3.1); various physical quantities are computed as responses. The pencil beam can be represented by an impulse (Dirac delta) function of space, direction, and time; thus, the responses are termed impulse responses or Green’s functions. Although never infinitely wide in reality, a layer can be so treated if it is much wider than the photon distribution. College of Engineering, Peking University 生物医学光学II
Optical Properties Each layer is described by the following parameters: thickness , refractive index , absorption coefficient , scattering coefficient , scattering anisotropy . The top and the bottom ambient media are each described by a refractive index. College of Engineering, Peking University 生物医学光学II
Coordinates College of Engineering, Peking University 生物医学光学II
How to sample random variables Consider a random variable x needed for a Monte Carlo simulation. Then there is a probability density function p(x) of x , which defines x over the interval such that: a ≤ x ≤ b College of Engineering, Peking University 生物医学光学II
Sample random variables The probability that x will fall in the interval [a, x1] is given by the distribution function F(x1), defined as: where x1 is a random variable. College of Engineering, Peking University 生物医学光学II
Sample random variables By using a computer random number generator, one can obtain a random number ξ in the range [0, 1]. The probability density function for this random number is 1 in the range [0, 1]. The corresponding probability distribution is where p(x)=1, a<x<b. College of Engineering, Peking University 生物医学光学II
This means that the random number picked gives the integrated value of p(x), that is : College of Engineering, Peking University 生物医学光学II
For generality, we replace the variables, ξ1 and x1 by the continuous variables, ξ and x: This is the basic equation for sampling x from p(x) based using a randomly generated number, ξ over the interval [0,1] College of Engineering, Peking University 生物医学光学II
Generation of Random Numbers College of Engineering, Peking University 生物医学光学II
Selecting the step size, s • The step size of the photon is calculated based on sampling the probability for the photon’s mean free path • If step size too small, MC is inefficient, but if step size is too large, poor approximation of real photon travel • Choose step size from probability density function College of Engineering, Peking University 生物医学光学II
The total attenuation coefficient Recall that the probability of interaction of a photon with a medium per unit path length is: P[s1,s1+ds1]=μtds1 College of Engineering, Peking University 生物医学光学II
The total attenuation coefficient The probability of interaction of a photon with a medium per unit path length is related to the gradient of transmission: College of Engineering, Peking University 生物医学光学II
The total attenuation coefficient The probability distribution function (from Beer’s law) is defined as: College of Engineering, Peking University 生物医学光学II
Solving for “s” yields: Final expression Solving for “s” yields: College of Engineering, Peking University 生物医学光学II
Sampling the Step Size College of Engineering, Peking University 生物医学光学II
College of Engineering, Peking University 生物医学光学II
College of Engineering, Peking University 生物医学光学II
College of Engineering, Peking University 生物医学光学II
College of Engineering, Peking University 生物医学光学II
Sampling the Scattering Angle
Sampling the Azimuthal Scattering Angle College of Engineering, Peking University 生物医学光学II
Moving the Photon Packet College of Engineering, Peking University 生物医学光学II
Absorption
Update of Photon Propagation Direction College of Engineering, Peking University 生物医学光学II
Please go to Jianan Qu’s ppt: 13b.pdf and 13c.pdf. College of Engineering, Peking University 生物医学光学II
Monte Carlo Program int main () { albedo = mu_s / (mu_s + mu_a); rs = (n-1.0)*(n-1.0)/(n+1.0)/(n+1.0); /* specular reflection */ crit_angle = sqrt(1.0-1.0/n/n); /* cos of critical angle */ bins_per_mfp = 1e4/microns_per_bin/(mu_a+mu_s); for (i = 1; i <= photons; i++){ launch (); while (weight > 0) { move (); absorb (); scatter (); } print_results(); return 0; College of Engineering, Peking University 生物医学光学II
Monte Carlo Program void launch() /* Start the photon */ { x = 0.0; y = 0.0; z = 0.0; u = 0.0; v = 0.0; w = 1.0; weight = 1.0 - rs; } void bounce () /* Interact with top surface */ double t, temp, temp1,rf; w = -w; z = -z; if (w <= crit_angle) return; /* total internal reflection */ t = sqrt(1.0-n*n*(1.0-w*w)); /* cos of exit angle */ temp1 = (w - n*t)/(w + n*t); temp = (t - n*w)/(t + n*w); rf = (temp1*temp1+temp*temp)/2.0; /* Fresnel reflection */ rd += (1.0-rf) * weight; weight -= (1.0-rf) * weight; College of Engineering, Peking University 生物医学光学II
Monte Carlo Program void move() /* move to next scattering or absorption event */ { double d = -log((rand()+1.0)/(RAND_MAX+1.0)); x += d * u; y += d * v; z += d * w; if ( z<=0 ) bounce(); } void absorb () /* Absorb light in the medium */ int bin=z*bins_per_mfp; if (bin >= BINS) bin = BINS-1; heat[bin] += (1.0-albedo)*weight; weight *= albedo; if (weight < 0.001){ /* Roulette */ bit -= weight; if (rand() > 0.1*RAND_MAX) weight = 0; else weight /= 0.1; bit += weight; College of Engineering, Peking University 生物医学光学II
Monte Carlo Program void scatter() /* Scatter photon and establish new direction */ { double x1, x2, x3, t, mu; for(;;) { /*new direction*/ x1=2.0*rand()/RAND_MAX - 1.0; x2=2.0*rand()/RAND_MAX - 1.0; if ((x3=x1*x1+x2*x2)<=1) break; } if (g==0) { /* isotropic */ u = 2.0 * x3 -1.0; v = x1 * sqrt((1-u*u)/x3); w = x2 * sqrt((1-u*u)/x3); return; 接下 College of Engineering, Peking University 生物医学光学II
Monte Carlo Program mu = (1-g*g)/(1-g+2.0*g*rand()/RAND_MAX); mu = (1 + g*g-mu*mu)/2.0/g; if ( fabs(w) < 0.9 ) { t = mu * u + sqrt((1-mu*mu)/(1-w*w)/x3) * (x1*u*w-x2*v); v = mu * v + sqrt((1-mu*mu)/(1-w*w)/x3) * (x1*v*w+x2*u); w = mu * w - sqrt((1-mu*mu)*(1-w*w)/x3) * x1; } else { t = mu * u + sqrt((1-mu*mu)/(1-v*v)/x3) * (x1*u*v + x2*w); w = mu * w + sqrt((1-mu*mu)/(1-v*v)/x3) * (x1*v*w - x2*u); v = mu * v - sqrt((1-mu*mu)*(1-v*v)/x3) * x1; } u = t; College of Engineering, Peking University 生物医学光学II
Monte Carlo Program void print_results() /* Print the results */ { int i; printf("%s\n%s\n\nScattering = %8.3f/cm\nAbsorption = %8.3f/cm\n",t1,t2,mu_s,mu_a); printf("Anisotropy = %8.3f\nRefr Index = %8.3f\nPhotons = %8ld",g,n,photons); printf("\n\nSpecular Refl = %10.5f\nBackscattered Refl = %10.5f",rs,rd/(bit+photons)); printf("\n\n Depth Heat\n[microns] [W/cm^3]\n"); for (i=0;i<BINS-1;i++){ printf("%6.0f %12.5f\n",i*microns_per_bin, heat[i]/microns_per_bin*1e4/(bit+photons)); } printf(" extra %12.5f\n",heat[BINS-1]/(bit+photons)); College of Engineering, Peking University 生物医学光学II
Monte Carlo Program char t1[80] = "Small Monte Carlo by Scott Prahl (http://omlc.ogi.edu)"; char t2[80] = "1 W/cm^2 Uniform Illumination of Semi-Infinite Medium"; #include <stdio.h> #include <stdlib.h> #include <math.h> #define BINS 101 double mu_a = 5; /* Absorption Coefficient in 1/cm */ double mu_s = 95; /* Scattering Coefficient in 1/cm */ double g = 0.25; /* Scattering Anisotropy -1<=g<=1 */ double n = 1.5; /* Index of refraction of medium */ double microns_per_bin = 20;/* Thickness of one bin layer */ long i, photons = 100000; double x,y,z,u,v,w,weight; double rs, rd, bit, albedo, crit_angle, bins_per_mfp, heat[BINS]; College of Engineering, Peking University 生物医学光学II
Summary Monte Carlo can simulate photon transport in biological tissue Three steps: move, absorb, scatter Weight defines its alive or dead The trajectory of a photon is modeled as a persistent random walk. The directions are independent. College of Engineering, Peking University 生物医学光学II
Further readings http://omlc.ogi.edu/classroom/ece532/class4/index.html Tiny_mc.c, Small_mc.c, mc321.c: http://omlc.ogi.edu/software/mc/ MCML download: http://labs.seas.wustl.edu/bme/Wang/mc.html College of Engineering, Peking University 生物医学光学II
Homework Plot the Henyey Greenstein Function with different g. Write a program (in C or MATLAB) to describe a simple random walk in x-y plane. The direction is uniformly random in 360 degrees, and the walking step size follows the same way of a photon transportation in a medium with μ=100 /cm. Plot your result and hand in your program. (up to 20 steps) Rewrite the tiny_mc.c program to Matlab. College of Engineering, Peking University 生物医学光学II
Experiment: Monte Carlo Simulation Fiber λ = 633 nm College of Engineering, Peking University Biomedical Optics II
Experiment: Monte Carlo Simulation Fiber λ = 633 nm College of Engineering, Peking University Biomedical Optics II
Experiment: Monte Carlo Simulation Fiber λ = 633 nm College of Engineering, Peking University Biomedical Optics II
Experiment report Using g = 0.9, and the measured scattering coefficient as well as other parameters, apply Monte Carlo simulation (next experiment), then compare your simulated result with your measured data. College of Engineering, Peking University Biomedical Optics II