Sie sind auf Seite 1von 59

Biomedical Optics II

II
Monte Carlo Modeling of
Photon Transport
2011/09/28
Radiative Transfer in Living Tissue
2 College of Engineering, Peking University II
How to
solve the
problem?
Maxwells
equations?
Modeling based
on scattering
and absorption
Monte Carlo
simulation
Radiative
transfer
equation
Monte Carlo
3 College of Engineering, Peking University II
4 College of Engineering, Peking University II
5 College of Engineering, Peking University II

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.
Monte Carlo Simulations
6 College of Engineering, Peking University II
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.

Introduction
7 College of Engineering, Peking University II
The medium is random Use dice to build it






A system with known probability distributions
(scattering and absorption)
Monte Carlo
8 College of Engineering, Peking University II
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.
Definition of Monte Carlo Method
9 College of Engineering, Peking University II
The photon propagation is random and determined by tissue optical properties:
1. 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.

2. Direction after scattering? Apply "dice" with phase function + anisotropy
of scattering to set the scattering angles.
10 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
11 College of Engineering, Peking University II
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.
Ensemble Averaging
12 College of Engineering, Peking University II
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.

Simplifications
13 College of Engineering, Peking University II
Determine the spatial interval between two
successive interaction events
Determine the scattering angle
Determine the survival of the photon
Three Major Sampling Procedures
14 College of Engineering, Peking University II
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
The variables that govern Monte Carlo
15 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(u) 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(u):

It is common to express the definition of anisotropy in an equivalent
way:

16 College of Engineering, Peking University II

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
Basis for the Monte Carlo method
17 College of Engineering, Peking University II
Scattering and Absorption Probability
18 College of Engineering, Peking University II
Beer-Lambert law
I
0

I(d)
d
t) coefficien absorption or scattering represents (

, ) (
0
d
e I d I

=
The probability of the photon passing through the medium
without scattering or absorption is:
d
e

Within any infinitesimal interval ds, the probability of being
scattered or absorbed is:
ds
Henyey-Greenstein Phase Function
19 College of Engineering, Peking University II
Which is approximately used by Henyey-Greenstein 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.
20 College of Engineering, Peking University II
Homework 1: reproduce this plot with Matlab.
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 Greens functions.
Although never infinitely wide in reality,
a layer can be so treated if it is much
wider than the photon distribution.
Definition of Problem
21 College of Engineering, Peking University II
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.
Optical Properties
22 College of Engineering, Peking University II
Coordinates
Global Cartesian coordinate system for photon tracking: ) , , ( z y x
Global cylindrical coordinate system for photon recording: ) , ' , ( z r |
Local moving spherical coordinate system for photon scattering: (1, u ,| )
23 College of Engineering, Peking University II
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
How to sample random variables
24 College of Engineering, Peking University II
( ) 1
b
a
p x =
}
The probability that x will fall in
the interval [a, x
1
] is given by the
distribution function F(x
1
),
defined as:



where x
1
is a random variable.
Sample random variables
25 College of Engineering, Peking University II
1
1
( ) ( )
x
a
F x p x dx =
}
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.
Sample random variables
26 College of Engineering, Peking University II
1
1 1
( ) ( ) [0,1]
a
F p d

= = e
}
This means that the random number picked gives
the integrated value of p(x), that is :
27 College of Engineering, Peking University II
1
1 1
( ) ( )
x
a
F x p x dx = =
}
For generality, we replace the variables,
1
and x
1

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]
28 College of Engineering, Peking University II
( )
x
a
p x dx =
}
Generation of Random Numbers
29 College of Engineering, Peking University II
) (x p
( )
( )
| | 1 , 0 in number random uniform a is ), (
by calculaed be can sampling then the
DF) function(C density Cumulative
1
_
_

=
=
}
P
P
dx x p
a
}
=
_
_
a
dx x p ) ( ) ( P

Selecting the step size, s


The step size of the photon is calculated based on
sampling the probability for the photons 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
30 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[s
1
,s
1
+ds
1
]=
t
ds
1

31 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:
32 College of Engineering, Peking University II
1
1
1
( )
( )
t
dT s
ds
T s
=
The total attenuation coefficient
The probability distribution function (from Beers
law) is defined as:
33 College of Engineering, Peking University II
1 1 1
1 1 1
( ) ( ) exp( )
( ) 1 ( ) 1 exp( )
t
t
P s s T s s
P s s T s s

> = =
< = =
Final expression
Solving for s yields:
34 College of Engineering, Peking University II
ln
t
s

=
Sampling the Step Size
( )
( ) ( )
t t
t
t
s s
s
s s P

ln 1 ln
=

=
=
=
or
: size step Sampled
) exp( 1
: method on distributi Inverse
) exp( 1
: size step of function on distributi Cumulative
35 College of Engineering, Peking University II

36 College of Engineering, Peking University II

37 College of Engineering, Peking University II

38 College of Engineering, Peking University II

39 College of Engineering, Peking University II
Sampling the Scattering Angle
| |
2
2 3/ 2
2
2
2
Henyey-Greenstein phase function:
1
(cos ) , 0,
2(1 2 cos )
Sampled scattering angle:
1 1
1 if 0
cos 2 1 2
2 1 if 0
g
p
g g
g
g g
g g g
g
u u t
u
u

= e
+

+ =
`
(
= +

Sampling the Azimuthal Scattering Angle


( )
[0, 2
1
2
2
p
t

t
t
e )
=
=
41 College of Engineering, Peking University II
Moving the Photon Packet
i z
i y
i x
s z z
s y y
s x x

+
+
+
42 College of Engineering, Peking University II
Absorption
W W W
W

W
t
a
A
= A
Update of Photon Propagation Direction
( )
( )
( ) ( )
( ) ( )
( ) ( )
( ) ( ) ( )
exists. solution e Alternativ
. ' , ' , ' in , angles azimuthal and polar has along ' n propagatio photon ring Postscatte
. ' , ' , ' get to for about , , Rotate (2)
. , , s coordinate te intermedia get to for about , , Rotate (1)
, ' , ' , ' s coordinate local to , , s coordinate global from transform To
. , angles azimuthal and polar has n propagatio photon ring Prescatte : Note
. cos sgn sin sin cos sin then , 1 If
. cos cos sin 1
, cos
1
) sin cos ( sin

, cos
1
) sin cos ( sin

0
* * * *
* * *
0
0 0
2
2
2
z y x z k
z y x y z y x
z y x z z y x
z y x z y x
k
, ,

z
'
z
'
y
'
x z
z z
'
z
y
z
x z y '
y
x
z
y z x '
x
| u
u
|
| u
| |
u | u
u
| | u
u
| | u
= = =
+ =
+

+
=
+


=
44 College of Engineering, Peking University II
Please go to Jianan Qus ppt: 13b.pdf and 13c.pdf.
45 College of Engineering, Peking University II
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;
}

Monte Carlo Program
46 College of Engineering, Peking University II
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;
}

Monte Carlo Program
47 College of Engineering, Peking University II
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;
}
}
Monte Carlo Program
48 College of Engineering, Peking University II
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;
}


Monte Carlo Program
49 College of Engineering, Peking University II

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;
}
Monte Carlo Program
50 College of Engineering, Peking University II
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));
}
Monte Carlo Program
51 College of Engineering, Peking University II
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];
Monte Carlo Program
52 College of Engineering, Peking University II
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.


Summary
53 College of Engineering, Peking University II
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

Further readings
54 College of Engineering, Peking University II
1. Plot the Henyey Greenstein Function with different g.
2. 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)
3. Rewrite the tiny_mc.c program to Matlab.
Homework
55 College of Engineering, Peking University II
Experiment: Monte Carlo Simulation
56 College of Engineering, Peking University Biomedical Optics II
Fiber
= 633 nm
Experiment: Monte Carlo Simulation
57 College of Engineering, Peking University Biomedical Optics II
Fiber
= 633 nm
Experiment: Monte Carlo Simulation
58 College of Engineering, Peking University Biomedical Optics II
Fiber
= 633 nm
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.
Experiment report
59 College of Engineering, Peking University Biomedical Optics II

Das könnte Ihnen auch gefallen