Sie sind auf Seite 1von 59

Biomedical Optics II

II
Monte Carlo Modeling of
Photon Transport

2011/09/28

Radiative Transfer in Living


Tissue
How to
solve the
problem?

Maxwells
equations?

Modeling
based on
scattering
and
absorption
Monte Carlo
simulation

College of Engineering, Peking University

II

Radiative
transfer
equation
2

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:


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.

College of Engineering, Peking University

II

10

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

11

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

12

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

13

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

14

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

15

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

16

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

17

Scattering and Absorption


Probability
d

Beer-Lambert law

I0

I(d)

I (d ) I 0 e d , ( represents scattering or absorption coefficient)

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:
ds
College of Engineering, Peking University

II

18

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

19

Homework 1: reproduce this plot with Matlab.

College of Engineering, Peking University

II

20

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 multilayered 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.
College of Engineering, Peking University

II

21

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

22

Coordinates

College of Engineering, Peking University

II

23

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

p( x) 1

II

24

Sample random
variables
The probability that x will fall in
the interval [a, x1] is given by the
distribution function F(x1),
defined as:
x1

F ( x1 ) p ( x)dx
a

where x1 is a random variable.


College of Engineering, Peking University

II

25

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
1

F (1 ) p ( )d 1 [0,1]
a

where p(x)=1, a<x<b.


College of Engineering, Peking University

II

26

This means that the random number picked gives


the integrated value of p(x), that is :
x1

1 F ( x1 ) p ( x)dx
a

College of Engineering, Peking University

II

27

For generality, we replace the variables, 1 and x1


by the continuous variables, and x:
x

p ( x)dx
a

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

28

Generation of Random Numbers

p x dx

Cumulative density function(CDF)

then the sampling can be calculaed by

P 1 ( ), is a uniform random number in 0,1

p(x )

College of Engineering, Peking University

II

P( ) a p( x )dx

29

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

II

30

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

31

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:

dT ( s1 )
t ds1
T ( s1 )

College of Engineering, Peking University

II

32

The total attenuation coefficient


The probability distribution function (from Beers
law) is defined as:

P ( s s1 ) T ( s1 ) exp( t s1 )
P ( s s1 ) 1 T ( s1 ) 1 exp( t s1 )

College of Engineering, Peking University

II

33

Final expression
Solving for s yields:

ln
s
t

College of Engineering, Peking University

II

34

Sampling the Step Size


Cumulative distribution function of step size :
P s 1 exp( t s )
Inverse distribution method :
1 exp( t s )
Sampled step size :
ln 1
ln
s
or s
t
t
College of Engineering, Peking University

II

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

Sampling the Scattering Angle


Henyey-Greenstein phase function:
1 g2
p(cos )
, 0,
2
3/2
2(1 g 2 g cos )

Sampled scattering angle:


2
1

g
2
1 g

cos 2 g
1 g 2 g

2 1

if

g0

if

g 0

Sampling the Azimuthal


Scattering Angle

[0, 2
1
p
2
2
College of Engineering, Peking University

II

41

Moving the Photon Packet

x x x si
y y y si
z z z si
College of Engineering, Peking University

II

42

Absorption

a
W
W
t
W W W

Update of Photon Propagation


Direction
'x
'y

sin ( x z cos y sin )


1

2
z

sin ( y z cos x sin )


1

2
z

x cos ,
y cos ,

'z 1 z2 sin cos z cos .


If z 1, then 'x sin cos , 'y sin sin , 'z sgn z cos .
Note : Prescatte ring photon propagation k has polar and azimuthal angles 0 , 0 .

To transform from global coordinates x, y , z to local coordinates x ' , y ' , z ' ,


(1) Rotate x, y , z about z for 0 to get intermediate coordinates x * , y * , z * .
(2) Rotate x * , y * , z * about y * for 0 to get x ' , y ' , z ' .

Postscattering photon propagation k ' along z has polar and azimuthal angles , in x ' , y ' , z ' .
Alternative solution exists.

College of Engineering, Peking University

II

44

Please go to Jianan Qus ppt: 13b.pdf and 13c.pdf.

College of Engineering, Peking University

II

45

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

46

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

47

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

48

Monte Carlo Program


void scatter() /* Scatter photon and establish new direction */
{
double x1, x2, x3, t, mu;
for(;;) {
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;
}

/*new direction*/

College of Engineering, Peking University

II

49

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

50

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

51

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

52

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

53

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

54

Homework
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.

College of Engineering, Peking University

II

55

Experiment: Monte Carlo


Simulation

Fiber

=633nm
College of Engineering, Peking University

Biomedical Optics II

56

Experiment: Monte Carlo


Simulation

Fiber

=633nm
College of Engineering, Peking University

Biomedical Optics II

57

Experiment: Monte Carlo


Simulation

Fiber

=633nm
College of Engineering, Peking University

Biomedical Optics II

58

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

59

Das könnte Ihnen auch gefallen