Download presentation
Presentation is loading. Please wait.
1
Introduction to Monte Carlo Simulation
Robert L. Harrison University of Washington Medical Center Seattle, Washington, USA Supported in part by PHS grants CA42593 and CA126593 SimSET as platform for research
2
What is Monte Carlo? Monte Carlo methods are a class of algorithms that rely on repeated random sampling to compute their results. (Wikipedia) Step through what is meant by modular: photons are tracked through the phantom/object, then through the collimator/endplates, then through the detector. Various models are available for the collimators and detectors. Available for free download from our website. We also supply user support.
3
An example: estimating an integral
• Randomly generate points in square. • Count the points under the curve. • Divide the number under curve by total number of points. • 1000 points. • 717 under curve. • Estimate = • 100 points. • 69 under curve. • Estimate = 0.69. • 400 points. • 278 under curve. • Estimate = Over four hundred registered users. Looking through the hundreds of papers, dissertations and theses that have used SimSET, most have done one of these three things: Optimizing patient studies, e.g. Chicco et al compared the diagnostic capabilities of planar imaging and SPECT for diagnosing pulmonary lesions; Assessing and improving quantitation, e.g. Ollinger used SimSET in the development of model-based scatter correction; Prototyping tomomgraphs, big and small, e.g. Shokouhi et al at Brookhaven prototyped their RatCap tomograph using SimSET.
4
A little history… Buffon’s needle. Student / William Gosset.
Manhattan project. The new block detector model allows a detector array to be built up from rectangular boxes of material. The block model is much closer to the actual design of most PET scanners than SimSET’s previous model (solid cylindrical annuli of crystal)
5
Buffon’s needle Georges-Louis Leclerc, Comte de Buffon (1707 – 1788).
A party game using a lined piece of paper and a pin. Estimates the value of = 2*drops/hits. Can’t really give a live demonstration of SimSET - it doesn’t have a pretty user interface with buttons and slider bars. It is run from the command line in Unix. A run is set up and controlled using text parameter files. This talk steps through the process of setting up a simulation.
6
William Gosset ( ) Supervised the experimental brewery at Guiness. Developed methods to draw conclusions from small sample size experiments. Published under the penname A. Student. Student t-test.
7
Manhattan project Development of first nuclear weapons.
Needed to extrapolate knowledge of a single neutron’s behavior to the behavior of a system of neutrons. Experimentation was to dangerous, time-consuming, costly.
8
Manhattan project… John von Neumann ( ) and Stanislaus Ulam ( ). Developed particle tracking Monte Carlo simulation.
9
Why do people simulate? Throughout the following slides emphasize that these values are given in text parameter files.
10
Why do people simulate? Low cost way to experiment.
Easy to repeat/modify. Study systems to complex to solve analytically. Examine hidden quantities. Throughout the following slides emphasize that these values are given in text parameter files.
11
Disadvantages Time consuming. Doesn’t give exact solution.
Is the model correct? Bugs, bugs, bugs. Throughout the following slides emphasize that these values are given in text parameter files.
12
Alternatives Analytic solution. Experiment.
Throughout the following slides emphasize that these values are given in text parameter files.
13
Mechanics of simulation
General method. Random number generator. Sampling from a distribution. Accelerating a simulation. Only endplates.
14
General Monte Carlo Method
Model a physical system as a (series of) probability density function(s). Repeatedly sample from the pdf(s). Tally the statistics of interest. (There are many Monte Carlo simulations that don’t fit the above exactly.)
15
Random numbers Generally we sample from a uniform distribution of integers over [0,n]. Convert to a uniform distribution on the interval (0,0), [0,1) or [0,1]. (e.g., divide integer value by n or n+1.) Lists of truly random numbers. E.g., time between radioactive decays. Pseudo-random number generators. Calculate a randoms number!?
16
Pseudo-random number generators
Usually called random number generators (RNG). (Early - bad) Middle squares. (Still around - bad) Linear congruential generator. (Good) Mersenne twister.
17
Middle square Von Neumann, 1946.
To generate a sequence of 10 digit integers, start with one, and square it and then take the middle 10 digits from the result as the next number in the sequence e.g = the next number is • Not a recommended method!
18
Linear congruential generator
Lehmer, 1948. In+1 = (aIn + c) mod m I0 = Starting value (seed) a, c, and m are specially chosen constants.
19
Linear congruential generator…
Values used by some built-in random functions are very poor. Good values for a, c, and m on-line. Even with good values, there can be problems. Three dimensional sampling from a linear congruential generator with poorly chosen values, RANDU (Wikipedia).
20
Mersenne twister Used in MatLab, Maple.
Does very well on most tests of randomness. Ridiculously long period. Reasonably fast.
21
Mersenne twister Used in MatLab, Maple.
Does very well on most tests of randomness. Ridiculously long period. Reasonably fast. Quite complicated to implement/describe.
22
Sampling from a distribution
We have a uniform distribution, how do we sample from An exponential distribution? Other continuous distributions? A Poisson distribution?
23
Exponential distribution
Time between radioactive decays. Distance a photon travels before an interaction. Mean 1/, variance 1/ Probability density function (pdf) (Wikipedia) Cumulative distribution function (cdf)
24
Sampling from the exponential distribution
Sample u from the uniform distribution on [0,1).
25
Sampling from the exponential distribution
Sample u from [0,1). Locate u on the y-axis of the exponential distribution cdf. u
26
Sampling from the exponential distribution
Sample u from [0,1). Locate u on y-axis. Find the x value that corresponds to u. u x
27
Sampling from the exponential distribution
Sample u from [0,1). Locate u on y-axis. Find x = F-1(u). u x
28
Sampling from an invertible continuous distribution
Sample u from the unit interval. Find x = F-1(u).
29
Other sampling methods for continuous distributions
Approximate F-1(u), e.g., as a piecewise linear function. Table lookups are fast! Approximate => bias. Acceptance-rejection method. AKA rejection method, accept-reject method, rejection sampling.
30
Acceptance-rejection
To sample from a pdf f(x): Choose pdf g(x) and constant c such that c*g(x) ≥ f(x) for all x
31
Acceptance-rejection
To sample from f(x): Choose g(x) and c: c*g(x) ≥ f(x) for all x. Generate a random number v from g(x). Generate a random number u from the uniform distribution on (0,1). v
32
Acceptance-rejection
To sample from f(x): Choose g(x) and c: c*g(x) ≥ f(x) for all x. Generate v from g(x). Generate u from uniform distribution. If c*u ≤ f(v)/g(v) accept v else reject v and go to 2.
33
Acceptance-rejection
To sample from f(x): Choose g(x) and c: c*g(x) ≥ f(x) for all x. Generate v from g(x). Generate uniform u. If c*u ≤ f(v)/g(v) accept v else reject, go to 2. The average number of iterations is c.
34
Acceptance-rejection
Sampling from a normal distribution. While the cdf is invertible, the resulting formula is computationally inefficient. Generally sampling is done using the Box-Muller or Ziggurat algorithms. Use a library function! Acceptance-rejection also be used to remove the bias from an approximation/table lookup sampling method.
35
Sampling from a normal distribution
Gaussian, bell curve. Everything is normal. Central limit theorem: the sum of a large number of independent random variables is approximately normally distributed. Generally sampled using the acceptance-rejection method. Use a library function! pdf cdf (Wikipedia)
36
Poisson distribution Discrete probability distribution.
{0,1,2…} (non-negative integer) result. Mean = variance = Probability mass function (Wikipedia) Cumulative density function
37
Poisson distribution Distribution for: how many light bulbs will burn out in a month? Large building. Maintenance department immediately replaces burned out bulb. Choose = the average number that burn out in a month How many mathematicians does it take to change a light bulb? In earlier work, Haynor[1] has shown that one mathematician can change a light bulb. (
38
Poisson distribution Other examples: Number of radioactive decays.
Number of bugs discovered in a program. Number of calls to a call center. Number of scintillation photons. How many mathematicians does it take to change a light bulb? None. It's left to the reader as an exercise. (
39
Sampling from Poisson distributions
Use a library function! Use the exponential distribution. Let T be the time period, set t = 0, k = 0. Sample tk from the exponential distribution. t = t + tk, k = k + 1; If t < T, go to 2. Return (k - 1). For large approximate using a normal distribution. How many quantum physicists does it take to change a light bulb? They can't. If they know where the socket is, they cannot locate the new bulb. (
40
Keeping track of results
Tally (score, bin, histogram) the quantities we are interested in, e.g.: Number of light bulbs replaced by month; Time to failure for a product.
41
Building a simulation Often a single ‘event’ in a simulation will require sampling from many different pdfs, some many times, and be tallied in many ways.
42
Building a simulation For example, a nuclear physics simulation might model the time between decays the decay process the paths of photons and particles the energy deposited during tracking and any secondary particles created thereby the detection electronics… and tally energy, position, and type of detected particles.
43
Take away Simulation a key tool for analytically intractable problems.
Currently the Mersenne Twister is a good choice of random number generator. Random sampling for functions: cdfs are analytically invertible; use library functions if available; acceptance-rejection method; piecewise approximation. Four key distributions: uniform, exponential, normal, Poisson.
45
References J.T. Bushberg, The essential physics of medical imaging, Lippincott Williams & Wilkins, 2002. K.P. George et al, Brain Imaging in Neurocommunicative Disorders, in Medical speech-language pathology: a practitioner's guide, ed. A.F. Johnson, Thieme, 1998. D.E. Heron et al, FDG-PET and PET/CT in Radiation Therapy Simulation and Management of Patients Who Have Primary and Recurrent Breast Cancer, PET Clin, 1:39–49, 2006. E.G.A. Aird and J. Conway, CT simulation for radiotherapy treatment planning, British J Radiology, 75: , 2002. R. McGarry and A.T. Turrisi, Lung Cancer, in Handbook of Radiation Oncology: Basic Principles and Clinical Protocols, ed. B.G. Haffty and L.D. Wilson, Jones & Bartlett Publishers, 2008. R. Schmitz et al, The Physics of PET/CT Scanners, in PET and PET/CT: a clinical guide, ed. E. Lin and A. Alavi, Thieme, 2005. W.P. Segars and B.M.W. Tsui, Study of the efficacy of respiratory gating in myocardial SPECT using the new 4-D NCAT phantom, IEEE Transactions on Nuclear Science, 49(3): , 2002. V.W. Stieber et al, Central Nervous System Tumors, in Technical Basis of Radiation Therapy: Practical Clinical Applications, ed. S.H. Levitt et al, Springer, 2008. P. Suetens, Fundamentals of medical imaging, Cambridge University Press, 2002.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.